From 4cf0393974bbff3ce90051e4e993bdecdf0d7839 Mon Sep 17 00:00:00 2001 From: Iulian Dragos Date: Fri, 13 Sep 2013 16:22:24 +0200 Subject: [PATCH 001/789] Add OSGi headers. Fixed #1. --- build.sbt | 20 +++++++++++++++++++- project/plugins.sbt | 1 + 2 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 project/plugins.sbt diff --git a/build.sbt b/build.sbt index b4a9629eb..6056ec8c4 100644 --- a/build.sbt +++ b/build.sbt @@ -2,7 +2,7 @@ organization := "org.scala-lang.modules" name := "scala-xml" -version := "1.0-RC4" +version := "1.0.0-RC4" // standard stuff follows: scalaVersion := "2.11.0-M5" @@ -105,6 +105,24 @@ definedTests in Test += ( }, true, Array()) ) +osgiSettings + +val osgiVersion = version(_.replace('-', '.')) + +OsgiKeys.bundleSymbolicName := s"${organization.value}.${name.value}" + +OsgiKeys.bundleVersion := osgiVersion.value + +OsgiKeys.exportPackage := Seq(s"scala.xml.*;version=${version.value}") + +// Sources should also have a nice MANIFEST file +packageOptions in packageSrc := Seq(Package.ManifestAttributes( + ("Bundle-SymbolicName", s"${organization.value}.${name.value}.source"), + ("Bundle-Name", s"${name.value} sources"), + ("Bundle-Version", osgiVersion.value), + ("Eclipse-SourceBundle", s"""${organization.value}.${name.value};version="${osgiVersion.value}";roots:="."""") + )) + // TODO: mima // import com.typesafe.tools.mima.plugin.MimaPlugin.mimaDefaultSettings diff --git a/project/plugins.sbt b/project/plugins.sbt new file mode 100644 index 000000000..c2f7976c3 --- /dev/null +++ b/project/plugins.sbt @@ -0,0 +1 @@ +addSbtPlugin("com.typesafe.sbt" % "sbt-osgi" % "0.6.0") \ No newline at end of file From b9695f013a2e57bd643e3dbb756af4a0f6a99383 Mon Sep 17 00:00:00 2001 From: Adriaan Moors Date: Wed, 25 Sep 2013 10:39:53 -0700 Subject: [PATCH 002/789] Test deps conditional on TestKeys.includeTestDependencies --- build.sbt | 12 +++++++++--- project/keys.scala | 6 ++++++ 2 files changed, 15 insertions(+), 3 deletions(-) create mode 100644 project/keys.scala diff --git a/build.sbt b/build.sbt index b4a9629eb..4d442a3fc 100644 --- a/build.sbt +++ b/build.sbt @@ -78,12 +78,18 @@ pomExtra := ( ) -// for testing with partest -libraryDependencies += "org.scala-lang.modules" %% "scala-partest-interface" % "0.2" % "test" +// default value must be set here +TestKeys.includeTestDependencies := true // the actual partest the interface calls into -- must be binary version close enough to ours // so that it can link to the compiler/lib we're using (testing) -libraryDependencies += "org.scala-lang.modules" %% "scala-partest" % "1.0-RC5" % "test" +libraryDependencies ++= ( + if (TestKeys.includeTestDependencies.value) + Seq("org.scala-lang.modules" %% "scala-partest" % "1.0-RC5" % "test", + "org.scala-lang.modules" %% "scala-partest-interface" % "0.2" % "test") + else Seq.empty +) + // necessary for partest -- see comments in its build.sbt conflictWarning ~= { _.copy(failOnConflict = false) } diff --git a/project/keys.scala b/project/keys.scala new file mode 100644 index 000000000..8403a25ad --- /dev/null +++ b/project/keys.scala @@ -0,0 +1,6 @@ +object TestKeys { + import sbt.settingKey + + // for testing with partest + val includeTestDependencies = settingKey[Boolean]("Doesn't declare test dependencies.") +} \ No newline at end of file From 00c59c295d7a0145b9e0b6edda4b7bbd219709f6 Mon Sep 17 00:00:00 2001 From: Iulian Dragos Date: Thu, 26 Sep 2013 19:37:48 +0200 Subject: [PATCH 003/789] Switch to -SNAPSHOT version. --- build.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index a86086ac0..f4246533f 100644 --- a/build.sbt +++ b/build.sbt @@ -2,7 +2,7 @@ organization := "org.scala-lang.modules" name := "scala-xml" -version := "1.0.0-RC4" +version := "1.0.0-SNAPSHOT" // standard stuff follows: scalaVersion := "2.11.0-M5" From dd1e0e43f0024b8b06c79fd940ccd253525d02d7 Mon Sep 17 00:00:00 2001 From: Adriaan Moors Date: Thu, 26 Sep 2013 11:50:09 -0700 Subject: [PATCH 004/789] Make partest version a setting Note: this fixes the breakage introduced by b9695f013a (could not `test`). Apparently, the order of the test dependencies matters... (Perhaps because of the conflicting binary version of xml/parsers?) --- build.sbt | 8 ++++++-- project/keys.scala | 2 ++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/build.sbt b/build.sbt index f4246533f..8cd957ab7 100644 --- a/build.sbt +++ b/build.sbt @@ -81,12 +81,16 @@ pomExtra := ( // default value must be set here TestKeys.includeTestDependencies := true +// default +TestKeys.partestVersion := "1.0.0-RC6" + // the actual partest the interface calls into -- must be binary version close enough to ours // so that it can link to the compiler/lib we're using (testing) +// NOTE: not sure why, but the order matters (maybe due to the binary version conflicts for xml/parser combinators pulled in for scaladoc?) libraryDependencies ++= ( if (TestKeys.includeTestDependencies.value) - Seq("org.scala-lang.modules" %% "scala-partest" % "1.0-RC5" % "test", - "org.scala-lang.modules" %% "scala-partest-interface" % "0.2" % "test") + Seq("org.scala-lang.modules" %% "scala-partest-interface" % "0.2" % "test", + "org.scala-lang.modules" %% "scala-partest" % TestKeys.partestVersion.value % "test") else Seq.empty ) diff --git a/project/keys.scala b/project/keys.scala index 8403a25ad..07003822c 100644 --- a/project/keys.scala +++ b/project/keys.scala @@ -3,4 +3,6 @@ object TestKeys { // for testing with partest val includeTestDependencies = settingKey[Boolean]("Doesn't declare test dependencies.") + + val partestVersion = settingKey[String]("Partest version.") } \ No newline at end of file From 1d665334756b3990eea5f219dd0e54b237f0e7fe Mon Sep 17 00:00:00 2001 From: Grzegorz Kossakowski Date: Mon, 21 Oct 2013 16:23:55 +0200 Subject: [PATCH 005/789] Exclude scala-xml from transitive dependencies of partest. As discovered here: https://github.com/scala/scala-xml/pull/6#issuecomment-26614894 we would have two different versions of scala-xml on test classpath: 1. scala-xml classes compiled from source (we are in scala-xml project) 2. scala-xml transitive dependencies of partest Duplicated classpath entries are always dangerous. I implemented a set of exclude rules that get rid of transitive dependencies of scala-xml. This fixes the problem of JUnit using wrong version of scala-xml for testing (now there's only one choice). Also, this allowed me to to enable conflictWarning again. They are very useful to warn us against dangerous situations that almost always result in broken classpath (as we just learned). --- build.sbt | 32 +++++++++++++++++++++++++------- 1 file changed, 25 insertions(+), 7 deletions(-) diff --git a/build.sbt b/build.sbt index 8cd957ab7..0c56cd914 100644 --- a/build.sbt +++ b/build.sbt @@ -88,16 +88,34 @@ TestKeys.partestVersion := "1.0.0-RC6" // so that it can link to the compiler/lib we're using (testing) // NOTE: not sure why, but the order matters (maybe due to the binary version conflicts for xml/parser combinators pulled in for scaladoc?) libraryDependencies ++= ( - if (TestKeys.includeTestDependencies.value) - Seq("org.scala-lang.modules" %% "scala-partest-interface" % "0.2" % "test", - "org.scala-lang.modules" %% "scala-partest" % TestKeys.partestVersion.value % "test") + if (TestKeys.includeTestDependencies.value) { + /** + * Exclude all transitive dependencies of partest that include scala-.xml. + * This way we avoid having two (or more) versions of scala-xml on a classpath. + * This fixes problem described here: + * https://github.com/scala/scala-xml/pull/6#issuecomment-26614894 + * + * Note that we are using ModuleID.exclude instead of more flexible ModuleID.excludeAll + * (describe here: http://www.scala-sbt.org/release/docs/Detailed-Topics/Library-Management#exclude-transitive-dependencies) + * because only plain excludes are incorporated in generated pom.xml. There are two ways + * to address this problem: + * + * 1. Figure out how to depend on partest in non-transitive way: not include that dependency + * in generated pom.xml for scala-xml. + * 2. Declare dependencies in partest as provided so they are not includeded transitively. + * + */ + def excludeScalaXml(dep: ModuleID): ModuleID = + dep.exclude("org.scala-lang.modules", "scala-xml_2.11.0-M5"). + exclude("org.scala-lang.modules", "scala-xml_2.11.0-M4"). + exclude("org.scalacheck", "scalacheck_2.11.0-M5") + Seq("org.scala-lang.modules" % "scala-partest-interface_2.11.0-M5" % "0.2" % "test", + "org.scala-lang.modules" % "scala-partest_2.11.0-M5" % TestKeys.partestVersion.value % "test"). + map(excludeScalaXml) + } else Seq.empty ) - -// necessary for partest -- see comments in its build.sbt -conflictWarning ~= { _.copy(failOnConflict = false) } - fork in Test := true javaOptions in Test += "-Xmx1G" From 8b2e8e04d30eed12027cf00dad73dbe9e5a0ebde Mon Sep 17 00:00:00 2001 From: Grzegorz Kossakowski Date: Mon, 21 Oct 2013 16:30:55 +0200 Subject: [PATCH 006/789] Migrate a few partest jvm tests to JUnit tests. Migrated to JUnit the following tests (from test/files/jvm): * t0632.scala * t1118.scala * unittest_xml.scala None of those tests were dependent on anything jvm specific. --- build.sbt | 2 + .../scala/scala/xml/JUnitAssertsForXML.scala | 8 ++ src/test/scala/scala/xml/MetaDataTest.scala | 60 +++++++++++ .../scala/xml/PrintEmptyElementsTest.scala | 58 ++++++++++ src/test/scala/scala/xml/UtilityTest.scala | 57 ++++++++++ .../scala/xml/parsing/Ticket0632Test.scala | 43 ++++++++ test/files/jvm/t0632.check | 12 --- test/files/jvm/t0632.scala | 22 ---- test/files/jvm/t1118.check | 11 -- test/files/jvm/t1118.scala | 21 ---- test/files/jvm/unittest_xml.scala | 101 ------------------ 11 files changed, 228 insertions(+), 167 deletions(-) create mode 100644 src/test/scala/scala/xml/JUnitAssertsForXML.scala create mode 100644 src/test/scala/scala/xml/MetaDataTest.scala create mode 100644 src/test/scala/scala/xml/PrintEmptyElementsTest.scala create mode 100644 src/test/scala/scala/xml/UtilityTest.scala create mode 100644 src/test/scala/scala/xml/parsing/Ticket0632Test.scala delete mode 100755 test/files/jvm/t0632.check delete mode 100644 test/files/jvm/t0632.scala delete mode 100755 test/files/jvm/t1118.check delete mode 100755 test/files/jvm/t1118.scala delete mode 100644 test/files/jvm/unittest_xml.scala diff --git a/build.sbt b/build.sbt index 0c56cd914..455c86f82 100644 --- a/build.sbt +++ b/build.sbt @@ -81,6 +81,8 @@ pomExtra := ( // default value must be set here TestKeys.includeTestDependencies := true +libraryDependencies ++= Seq("junit" % "junit" % "4.11" % "test", "com.novocode" % "junit-interface" % "0.10" % "test") + // default TestKeys.partestVersion := "1.0.0-RC6" diff --git a/src/test/scala/scala/xml/JUnitAssertsForXML.scala b/src/test/scala/scala/xml/JUnitAssertsForXML.scala new file mode 100644 index 000000000..374ed704d --- /dev/null +++ b/src/test/scala/scala/xml/JUnitAssertsForXML.scala @@ -0,0 +1,8 @@ +package scala.xml + +object JUnitAssertsForXML { + + private[xml] def assertEquals(expected: String, actual: NodeSeq): Unit = + org.junit.Assert.assertEquals(expected, actual.toString) + +} diff --git a/src/test/scala/scala/xml/MetaDataTest.scala b/src/test/scala/scala/xml/MetaDataTest.scala new file mode 100644 index 000000000..46b598c3a --- /dev/null +++ b/src/test/scala/scala/xml/MetaDataTest.scala @@ -0,0 +1,60 @@ +package scala.xml + +import org.junit.Test +import org.junit.Ignore +import org.junit.runner.RunWith +import org.junit.runners.JUnit4 +import org.junit.Assert.assertEquals + +class MetaDataTest { + + @Test + def absentElementPrefixed1: Unit = { + // type ascription to help overload resolution pick the right variant + assertEquals(null: Object, Null("za://foo.com", TopScope, "bar")) + assertEquals(null, Null("bar")) + } + + @Test + def absentElementPrefixed2: Unit = { + assertEquals(None, Null.get("za://foo.com", TopScope, "bar" )) + assertEquals(None, Null.get("bar")) + } + + @Test + def presentElement1: Unit = { + val x = new PrefixedAttribute("zo","bar", new Atom(42), Null) + val s = new NamespaceBinding("zo","za://foo.com", TopScope) + assertEquals(new Atom(42), x("za://foo.com", s, "bar" )) + assertEquals(null, x("bar")) + assertEquals(Some(new Atom(42)), x.get("za://foo.com", s, "bar")) + assertEquals(None, x.get("bar")) + } + + @Test + def presentElement2: Unit = { + val s = new NamespaceBinding("zo","za://foo.com", TopScope) + val x1 = new PrefixedAttribute("zo","bar", new Atom(42), Null) + val x = new UnprefixedAttribute("bar","meaning", x1) + assertEquals(null, x(null, s, "bar")) + assertEquals(Text("meaning"), x("bar")) + assertEquals(None, x.get(null, s, "bar" )) + assertEquals(Some(Text("meaning")), x.get("bar")) + } + + @Test + def attributeExtractor: Unit = { + def domatch(x:Node): Node = { + x match { + case Node("foo", md @ UnprefixedAttribute(_, value, _), _*) if !value.isEmpty => + md("bar")(0) + case _ => new Atom(3) + } + } + val z = + val z2 = + assertEquals(Text("gar"), domatch(z)) + assertEquals(new Atom(3), domatch(z2)) + } + +} diff --git a/src/test/scala/scala/xml/PrintEmptyElementsTest.scala b/src/test/scala/scala/xml/PrintEmptyElementsTest.scala new file mode 100644 index 000000000..f5270b473 --- /dev/null +++ b/src/test/scala/scala/xml/PrintEmptyElementsTest.scala @@ -0,0 +1,58 @@ +package scala.xml + +import org.junit.Test +import org.junit.Ignore +import org.junit.runner.RunWith +import org.junit.runners.JUnit4 +import JUnitAssertsForXML.assertEquals + +class PrintEmptyElementsTest { + + @Test + def representEmptyXMLElementsInShortForm: Unit = { + val expected: String = + """| + | + | + | + | + |is pretty cool + |""".stripMargin + // the xml snippet is not indented because indentation affects pretty printing + // results + val actual: NodeSeq = + + + + + +is pretty cool + + assertEquals(expected, actual) + } + + @Test + def programmaticLong: Unit = { + assertEquals(" ", + Elem(null, "emptiness", Null, TopScope, false) ++ Text(" ") ++ Comment("programmatic long")) + } + + @Test + def programmaticShort: Unit = { + assertEquals(" ", + Elem(null, "vide", Null, TopScope, true) ++ Text(" ") ++ Comment("programmatic short")) + } + + @Test + def programmaticShortWithAttribute: Unit = { + assertEquals(""" """, + Elem(null, "elem", Attribute("attr", Text("value"), Null), TopScope, true) ++ Text(" ") ++ Comment ("programmatic short with attribute")) + } + + @Test + def programmaticLongWithAttribute: Unit = { + assertEquals(""" """, + Elem(null, "elem2", Attribute("attr2", Text("value2"), Null), TopScope, false) ++ Text(" ") ++ Comment ("programmatic long with attribute")) + } + +} diff --git a/src/test/scala/scala/xml/UtilityTest.scala b/src/test/scala/scala/xml/UtilityTest.scala new file mode 100644 index 000000000..eba631efb --- /dev/null +++ b/src/test/scala/scala/xml/UtilityTest.scala @@ -0,0 +1,57 @@ +package scala.xml + +import org.junit.Test +import org.junit.Ignore +import org.junit.runner.RunWith +import org.junit.runners.JUnit4 +import org.junit.Assert.assertTrue +import org.junit.Assert.assertFalse +import org.junit.Assert.assertEquals + +class UtilityTest { + + @Test + def isNameStart: Unit = { + assertTrue(Utility.isNameStart('b')) + assertFalse(Utility.isNameStart(':')) + } + + @Test + def trim: Unit = { + val x = + + + val y = xml.Utility.trim(x) + assertEquals(1, y match { case => 1 }) + + val x2 = + a b b a + + val y2 = xml.Utility.trim(x2) + assertEquals(2, y2 match { case a b b a => 2 }) + } + + @Test + def aposEscaping: Unit = { + val z = '' + val z1 = z.toString + assertEquals("''", z1) + } + + @Test + def sort: Unit = { + val q = xml.Utility.sort() + assertEquals(" a=\"2\" g=\"3\" j=\"2\" oo=\"2\"", xml.Utility.sort(q.attributes).toString) + val pp = new xml.PrettyPrinter(80,5) + assertEquals("", pp.format(q)) + } + + @Test + def issue777: Unit = { + + + + .hashCode // Bug #777 + } + +} diff --git a/src/test/scala/scala/xml/parsing/Ticket0632Test.scala b/src/test/scala/scala/xml/parsing/Ticket0632Test.scala new file mode 100644 index 000000000..7a6b71a71 --- /dev/null +++ b/src/test/scala/scala/xml/parsing/Ticket0632Test.scala @@ -0,0 +1,43 @@ +package scala.xml.parsing + +import org.junit.Test +import org.junit.Ignore +import org.junit.runner.RunWith +import org.junit.runners.JUnit4 +import scala.xml.JUnitAssertsForXML.assertEquals + +class Ticket0632Test { + + import scala.io.Source.fromString + import scala.xml.parsing.ConstructingParser.fromSource + import scala.xml.{NodeSeq, TopScope} + private def parse(s:String) = fromSource(fromString(s), false).element(TopScope) + + @Test + def singleAmp: Unit = { + val expected = "" + assertEquals(expected, parse("")) + assertEquals(expected, xml.XML.loadString("")) + assertEquals(expected, ) + assertEquals(expected, ) + } + + @Test + def oneAndHalfAmp: Unit = { + val expected = "" + assertEquals(expected, xml.XML.loadString("")) + assertEquals(expected, parse("")) + assertEquals(expected, ) + assertEquals(expected, ) + } + + @Test + def doubleAmp: Unit = { + val expected = "" + assertEquals(expected, xml.XML.loadString("")) + assertEquals(expected, parse("")) + assertEquals(expected, ) + assertEquals(expected, ) + } + +} diff --git a/test/files/jvm/t0632.check b/test/files/jvm/t0632.check deleted file mode 100755 index 681bc9da9..000000000 --- a/test/files/jvm/t0632.check +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - diff --git a/test/files/jvm/t0632.scala b/test/files/jvm/t0632.scala deleted file mode 100644 index a2bb5aa7f..000000000 --- a/test/files/jvm/t0632.scala +++ /dev/null @@ -1,22 +0,0 @@ -object Test { -import scala.io.Source.fromString -import scala.xml.parsing.ConstructingParser.fromSource -import scala.xml.TopScope - def parse(s:String) = fromSource(fromString(s), false).element(TopScope) - def main(argv : Array[String]) : Unit = { - - println(parse("")) - println(xml.XML.loadString("")) - println() - println() - - println(xml.XML.loadString("")) - println(parse("")) - println() - println() - println(xml.XML.loadString("")) - println(parse("")) - println() - println() - } -} diff --git a/test/files/jvm/t1118.check b/test/files/jvm/t1118.check deleted file mode 100755 index d676b413c..000000000 --- a/test/files/jvm/t1118.check +++ /dev/null @@ -1,11 +0,0 @@ - - - - - -is pretty cool - - - - - diff --git a/test/files/jvm/t1118.scala b/test/files/jvm/t1118.scala deleted file mode 100755 index 3c8654724..000000000 --- a/test/files/jvm/t1118.scala +++ /dev/null @@ -1,21 +0,0 @@ -import scala.xml._ - -object Test { - def main(args: Array[String]) { - println( - - - - -is pretty cool -) - - println(Elem(null, "emptiness", Null, TopScope, false) ++ Text(" ") ++ Comment("programmatic long")) - - println(Elem(null, "vide", Null, TopScope, true) ++ Text(" ") ++ Comment("programmatic short")) - - println(Elem(null, "elem", Attribute("attr", Text("value"), Null), TopScope, true) ++ Text(" ") ++ Comment ("programmatic short with attribute")) - - println(Elem(null, "elem2", Attribute("attr2", Text("value2"), Null), TopScope, false) ++ Text(" ") ++ Comment ("programmatic long with attribute")) - } -} \ No newline at end of file diff --git a/test/files/jvm/unittest_xml.scala b/test/files/jvm/unittest_xml.scala deleted file mode 100644 index 106334e62..000000000 --- a/test/files/jvm/unittest_xml.scala +++ /dev/null @@ -1,101 +0,0 @@ -import scala.xml.{ MetaData, Null, Utility, PrefixedAttribute, UnprefixedAttribute } - -object Test { - - def main(args:Array[String]) = { - MetaDataTest.run() - UtilityTest.run() - } - - object MetaDataTest { - - import scala.xml.{ TopScope, NamespaceBinding, Node, Atom, Text } - - def domatch(x:Node): Node = { - x match { - case Node("foo", md @ UnprefixedAttribute(_, value, _), _*) if !value.isEmpty => - md("bar")(0) - case _ => new Atom(3) - } - } - - def run() { - - var x: MetaData = Null - var s: NamespaceBinding = TopScope - - // testing method def apply(uri:String, scp:NamespaceBinding, k:String): Seq[Node] - // def apply(k:String): Seq[Node] - - assert(null == x("za://foo.com", s, "bar" ), "absent element (prefixed) 1") - assert(null == x("bar"), "absent element (unprefix) 1") - - assert(None == x.get("za://foo.com", s, "bar" ), "absent element (prefixed) 2") - assert(None == x.get("bar"), "absent element (unprefix) 2") - - x = new PrefixedAttribute("zo","bar", new Atom(42), x) - s = new NamespaceBinding("zo","za://foo.com",s) - - assert(new Atom(42) == x("za://foo.com", s, "bar" ), "present element (prefixed) 3") - assert(null == x("bar"), "present element (unprefix) 3") - - assert(Some(new Atom(42)) == x.get("za://foo.com", s, "bar" ), "present element (prefixed) 4") - assert(None == x.get("bar"), "present element (unprefix) 4") - - x = new UnprefixedAttribute("bar","meaning", x) - - assert(null == x(null, s, "bar"), "present element (prefixed) 5") - assert(Text("meaning") == x("bar"), "present element (unprefix) 5") - - assert(None == x.get(null, s, "bar" ), "present element (prefixed) 6") - assert(Some(Text("meaning")) == x.get("bar"), "present element (unprefix) 6") - - val z = - val z2 = - - assert(Text("gar") == domatch(z), "attribute extractor 1") - assert(new Atom(3) == domatch(z2), "attribute extractor 2") - - } - } - - object UtilityTest { - def run() { - assert(Utility.isNameStart('b')) - assert(!Utility.isNameStart(':')) - - val x = - - - - val y = xml.Utility.trim(x) - - assert(1 == (y match { case => 1 }), "trim 1") - - val x2 = - a b b a - - - val y2 = xml.Utility.trim(x2) - - assert(2 == (y2 match { case a b b a => 2 }), "trim 2") - - val z = '' - val z1 = z.toString - - assert("''" == z1, "apos unescaped") - - val q = xml.Utility.sort() - assert(" a=\"2\" g=\"3\" j=\"2\" oo=\"2\"" == xml.Utility.sort(q.attributes).toString) - - val pp = new xml.PrettyPrinter(80,5) - assert("" == pp.format(q)) - - - - - .hashCode // Bug #777 - } - } - -} From 533afbcfbbd02c17126bc703e6ad3cc12439ca64 Mon Sep 17 00:00:00 2001 From: Grzegorz Kossakowski Date: Fri, 18 Oct 2013 12:51:24 +0200 Subject: [PATCH 007/789] Remove test/files/jvm/backendBugUnapply.scala test. It doesn't seem to test anything XML-specific and I couldn't trace what kind of backend problem this test is supposed to guard against. --- test/files/jvm/backendBugUnapply.check | 2 -- test/files/jvm/backendBugUnapply.scala | 17 ----------------- 2 files changed, 19 deletions(-) delete mode 100644 test/files/jvm/backendBugUnapply.check delete mode 100644 test/files/jvm/backendBugUnapply.scala diff --git a/test/files/jvm/backendBugUnapply.check b/test/files/jvm/backendBugUnapply.check deleted file mode 100644 index 9d1e7b29c..000000000 --- a/test/files/jvm/backendBugUnapply.check +++ /dev/null @@ -1,2 +0,0 @@ -baz -null diff --git a/test/files/jvm/backendBugUnapply.scala b/test/files/jvm/backendBugUnapply.scala deleted file mode 100644 index 45ee6f7d4..000000000 --- a/test/files/jvm/backendBugUnapply.scala +++ /dev/null @@ -1,17 +0,0 @@ -object Test { - import scala.xml.{Node,UnprefixedAttribute} - - def domatch(x:Node) = - x match { - case Node("foo", UnprefixedAttribute("bar", z, _), _*) => z - case _ => null - } - - def main(args: Array[String]): Unit = { - println(domatch()) - println(domatch()) - // - // assert(domatch().toString == "baz") - // assert(domatch() == null)//, domatch()) - } -} From 952cc8b3e9bb8c4bf865136ef61ddb0545a40141 Mon Sep 17 00:00:00 2001 From: Grzegorz Kossakowski Date: Fri, 18 Oct 2013 13:26:43 +0200 Subject: [PATCH 008/789] Migrate partest jvm/xmlstuff.scala test to JUnit. --- src/test/scala/scala/xml/XMLTest.scala | 198 +++++++++++++++++++++++++ test/files/jvm/xmlstuff.check | 22 --- test/files/jvm/xmlstuff.scala | 181 ---------------------- 3 files changed, 198 insertions(+), 203 deletions(-) create mode 100644 src/test/scala/scala/xml/XMLTest.scala delete mode 100644 test/files/jvm/xmlstuff.check delete mode 100644 test/files/jvm/xmlstuff.scala diff --git a/src/test/scala/scala/xml/XMLTest.scala b/src/test/scala/scala/xml/XMLTest.scala new file mode 100644 index 000000000..ba88c91c5 --- /dev/null +++ b/src/test/scala/scala/xml/XMLTest.scala @@ -0,0 +1,198 @@ +package scala.xml + +import org.junit.Test +import org.junit.Ignore +import org.junit.runner.RunWith +import org.junit.runners.JUnit4 +import org.junit.Assert.assertTrue +import org.junit.Assert.assertFalse +import org.junit.Assert.assertEquals + +class XMLTest { + + @Test + def nodeSeq: Unit = { + val p = + + + + + + val pelems_1 = for (x <- p \ "bar"; y <- p \ "baz" ) yield { + Text(x.attributes("value").toString + y.attributes("bazValue").toString+ "!") + }; + + val pelems_2 = new NodeSeq { val theSeq = List(Text("38!"),Text("58!")) }; + assertTrue(pelems_1 sameElements pelems_2) + assertTrue(Text("8") sameElements (p \\ "@bazValue")) + } + + @Test + def queryBooks: Unit = { + val books = + + Blabla + Blubabla + Baaaaaaalabla + ; + + val reviews = + + Blabla + + Hallo Welt. + + + Blubabla + + Hello Blu + + + Blubabla + + rem 2 + + + ; + + val results1 = new scala.xml.PrettyPrinter(80, 5).formatNodes ( + for (t <- books \\ "title"; + r <- reviews \\ "entry" + if (r \ "title") xml_== t) yield + + { t } + { r \ "remarks" } + + ); + val results1Expected = """ + | Blabla + | Hallo Welt. + | + | Blubabla + | Hello Blu + | + | Blubabla + | rem 2 + |""".stripMargin + assertEquals(results1Expected, results1) + + { + val actual = for (t @ Blabla <- new NodeSeq { val theSeq = books.child }.toList) + yield t + val expected = List(Blabla) + assertEquals(expected, actual) + } + + } + + @Test + def queryPhoneBook: Unit = { + val phoneBook = + + + This is the phonebook of the + ACME corporation. + + + John + +41 21 693 68 67 + +41 79 602 23 23 + + ; + + val addrBook = + + + This is the addressbook of the + ACME corporation. + + + John + Elm Street + Dolphin City + + ; + + val actual: String = new scala.xml.PrettyPrinter(80, 5).formatNodes ( + for (t <- addrBook \\ "entry"; + r <- phoneBook \\ "entry" + if (t \ "name") xml_== (r \ "name")) yield + + { t.child } + { r \ "phone" } + + ) + val expected = """| + | John + | Elm Street + | Dolphin City + | +41 21 693 68 67 + | +41 79 602 23 23 + |""".stripMargin + assertEquals(expected, actual) + } + + @Test + def namespaces: Unit = { + val cuckoo = + + + ; + assertEquals("http://cuckoo.com", cuckoo.namespace) + for (n <- cuckoo \ "_" ) { + assertEquals("http://cuckoo.com", n.namespace) + } + } + + @Test + def validationOfElements: Unit = { + val vtor = new scala.xml.dtd.ElementValidator(); + { + import scala.xml.dtd.ELEMENTS + import scala.xml.dtd.ContentModel._ + vtor.setContentModel( + ELEMENTS( + Sequ( + Letter(ElemName("bar")), + Star(Letter(ElemName("baz"))) ))); + } + assertTrue(vtor()) + + { + import scala.xml.dtd.MIXED + import scala.xml.dtd.ContentModel._ + + vtor.setContentModel( + MIXED( + Alt(Letter(ElemName("bar")), + Letter(ElemName("baz")), + Letter(ElemName("bal"))))); + } + + assertTrue(vtor( )) + assertTrue(vtor(abcdedgh )) + assertFalse(vtor( )) + } + + def validationfOfAttributes: Unit = { + val vtor = new scala.xml.dtd.ElementValidator(); + vtor.setContentModel(null) + vtor.setMetaData(List()) + assertFalse(vtor( )) + + { + import scala.xml.dtd._ + vtor setMetaData List(AttrDecl("bar", "CDATA", IMPLIED)) + } + assertFalse(vtor()) + assertTrue(vtor()) + + { + import scala.xml.dtd._ + vtor.setMetaData(List(AttrDecl("bar","CDATA",REQUIRED))) + } + assertFalse(vtor( )) + assertTrue( vtor( )) + } + +} diff --git a/test/files/jvm/xmlstuff.check b/test/files/jvm/xmlstuff.check deleted file mode 100644 index e1222479f..000000000 --- a/test/files/jvm/xmlstuff.check +++ /dev/null @@ -1,22 +0,0 @@ -NodeSeq - - Blabla - Hallo Welt. - - Blubabla - Hello Blu - - Blubabla - rem 2 - -List(Blabla) - - John - Elm Street - Dolphin City - +41 21 693 68 67 - +41 79 602 23 23 - -namespaces -validation - elements -validation - attributes diff --git a/test/files/jvm/xmlstuff.scala b/test/files/jvm/xmlstuff.scala deleted file mode 100644 index 45234c713..000000000 --- a/test/files/jvm/xmlstuff.scala +++ /dev/null @@ -1,181 +0,0 @@ -import java.io.StringReader -import org.xml.sax.InputSource -import scala.xml.{Node, NodeSeq, Elem, Text, XML} - -object Test { - - /** returns true if exception was thrown */ - def catcher(att: Function1[Unit, scala.xml.MetaData]): Boolean = { - var ex = false - try { - att.apply({}) - } catch { - case scala.xml.MalformedAttributeException(msg) => - println(msg) - ex = true - } - ex - } - - def main(args: Array[String]) { - - println("NodeSeq") - - val p = - - - - ; - - val pelems_1 = for (x <- p \ "bar"; y <- p \ "baz" ) yield { - Text(x.attributes("value").toString + y.attributes("bazValue").toString+ "!") - }; - val pelems_2 = new NodeSeq { val theSeq = List(Text("38!"),Text("58!")) }; - assert(pelems_1 sameElements pelems_2) - - assert(Text("8") sameElements (p \\ "@bazValue")) - - val books = - - Blabla - Blubabla - Baaaaaaalabla - ; - - val reviews = - - Blabla - - Hallo Welt. - - - Blubabla - - Hello Blu - - - Blubabla - - rem 2 - - - ; - - println( new scala.xml.PrettyPrinter(80, 5).formatNodes ( - for (t <- books \\ "title"; - r <- reviews \\ "entry" - if (r \ "title") xml_== t) yield - - { t } - { r \ "remarks" } - - )); - - // example - println( - for (t @ Blabla <- new NodeSeq { val theSeq = books.child }.toList) - yield t - ); - val phoneBook = - - - This is the phonebook of the - ACME corporation. - - - John - +41 21 693 68 67 - +41 79 602 23 23 - - ; - - - val addrBook = - - - This is the addressbook of the - ACME corporation. - - - John - Elm Street - Dolphin City - - ; - - println( new scala.xml.PrettyPrinter(80, 5).formatNodes ( - for (t <- addrBook \\ "entry"; - r <- phoneBook \\ "entry" - if (t \ "name") xml_== (r \ "name")) yield - - { t.child } - { r \ "phone" } - - )); - - - /* namespaces */ - // begin tmp - println("namespaces") - val cuckoo = - - - ; - assert(cuckoo.namespace == "http://cuckoo.com") - for (n <- cuckoo \ "_" ) { - //println("n = "+n); - //println("n.prefix = "+n.prefix); - //.println("n.scope = "+n.scope); - assert( n.namespace == "http://cuckoo.com") - } - - println("validation - elements") - val vtor = new scala.xml.dtd.ElementValidator(); - { - import scala.xml.dtd.ELEMENTS - import scala.xml.dtd.ContentModel._ - vtor.setContentModel( - ELEMENTS( - Sequ( - Letter(ElemName("bar")), - Star(Letter(ElemName("baz"))) ))); - - } - assert(vtor( )) - - { - import scala.xml.dtd.MIXED - import scala.xml.dtd.ContentModel._ - - vtor.setContentModel( - MIXED( - Alt(Letter(ElemName("bar")), - Letter(ElemName("baz")), - Letter(ElemName("bal"))))); - } - - assert(vtor( )) - assert(vtor(abcdedgh )) - assert(!vtor( )) - - println("validation - attributes") - vtor.setContentModel(null) - vtor.setMetaData(List()) - assert(!vtor( )) - - { - import scala.xml.dtd._ - vtor setMetaData List(AttrDecl("bar", "CDATA", IMPLIED)) - } - assert(!vtor()) - assert(vtor()) - - { - import scala.xml.dtd._ - vtor.setMetaData(List(AttrDecl("bar","CDATA",REQUIRED))) - } - assert(!vtor( )) - assert( vtor( )) - - } -} From 8ab2d60832f4a1477e3d1c6232ea3b72de39ffc1 Mon Sep 17 00:00:00 2001 From: Grzegorz Kossakowski Date: Fri, 18 Oct 2013 13:32:40 +0200 Subject: [PATCH 009/789] Migrate partest jvm/xmlpull.scala test to JUnit. --- .../scala/xml/pull/XMLEventReaderTest.scala | 43 +++++++++++++++++++ test/files/jvm/xmlpull.scala | 31 ------------- 2 files changed, 43 insertions(+), 31 deletions(-) create mode 100644 src/test/scala/scala/xml/pull/XMLEventReaderTest.scala delete mode 100644 test/files/jvm/xmlpull.scala diff --git a/src/test/scala/scala/xml/pull/XMLEventReaderTest.scala b/src/test/scala/scala/xml/pull/XMLEventReaderTest.scala new file mode 100644 index 000000000..060276531 --- /dev/null +++ b/src/test/scala/scala/xml/pull/XMLEventReaderTest.scala @@ -0,0 +1,43 @@ +package scala.xml.pull + +import org.junit.Test +import org.junit.Ignore +import org.junit.runner.RunWith +import org.junit.runners.JUnit4 +import org.junit.Assert.assertTrue +import org.junit.Assert.assertFalse +import org.junit.Assert.assertEquals + +import scala.io.Source + +class XMLEventReaderTest { + + val src = Source.fromString("!") + + @Test + def pull: Unit = { + val er = new XMLEventReader(src) + assertTrue(er.next match { + case EvElemStart(_, "hello", _, _) => true + case _ => false + }) + assertTrue(er.next match { + case EvElemStart(_, "world", _, _) => true + case _ => false + }) + assertTrue(er.next match { + case EvElemEnd(_, "world") => true + case _ => false + }) + assertTrue(er.next match { + case EvText("!") => true + case _ => false + }) + assertTrue(er.next match { + case EvElemEnd(_, "hello") => true + case _ => false + }) + er.stop // allow thread to be garbage-collected + } + +} \ No newline at end of file diff --git a/test/files/jvm/xmlpull.scala b/test/files/jvm/xmlpull.scala deleted file mode 100644 index 9ba7d4cf0..000000000 --- a/test/files/jvm/xmlpull.scala +++ /dev/null @@ -1,31 +0,0 @@ -import scala.xml._ -import scala.xml.pull._ -import scala.io.Source - -object Test { - - val src = Source.fromString("!") - - def main(args: Array[String]) { - var er = new XMLEventReader(src) - er.next match { - case EvElemStart(_, "hello", _, _) => //println("1") - } - er.next match { - case EvElemStart(_, "world", _, _) => //println("2") - } - er.next match { - case EvElemEnd(_, "world") => //println("3") - } - er.next match { - case EvText("!") => //println("4") - } - er.next match { - case EvElemEnd(_, "hello") => //println("5") - } - // you get the picture... - er.stop // allow thread to be garbage-collected - //println("6") - } -} - From dcbf2120b79b80c824845d52bafef79e8b34b626 Mon Sep 17 00:00:00 2001 From: Grzegorz Kossakowski Date: Fri, 18 Oct 2013 13:45:50 +0200 Subject: [PATCH 010/789] Migrate partest jvm/xmlattr.scala test to JUnit. --- src/test/scala/scala/xml/AttributeTest.scala | 68 +++++++++++++++++++ test/files/jvm/xmlattr.check | 18 ----- test/files/jvm/xmlattr.scala | 70 -------------------- 3 files changed, 68 insertions(+), 88 deletions(-) create mode 100644 src/test/scala/scala/xml/AttributeTest.scala delete mode 100644 test/files/jvm/xmlattr.check delete mode 100644 test/files/jvm/xmlattr.scala diff --git a/src/test/scala/scala/xml/AttributeTest.scala b/src/test/scala/scala/xml/AttributeTest.scala new file mode 100644 index 000000000..13aa7bfc6 --- /dev/null +++ b/src/test/scala/scala/xml/AttributeTest.scala @@ -0,0 +1,68 @@ +package scala.xml + +import org.junit.Test +import org.junit.Ignore +import org.junit.runner.RunWith +import org.junit.runners.JUnit4 +import org.junit.Assert.assertTrue +import org.junit.Assert.assertFalse +import org.junit.Assert.assertEquals + +class AttributeTest { + @Test + def unprefixedAttribute: Unit = { + val x = new UnprefixedAttribute("foo","bar", Null) + assertEquals(Some(Text("bar")), x.get("foo")) + assertEquals(Text("bar"), x("foo")) + assertEquals(None, x.get("no_foo")) + assertEquals(null, x("no_foo")) + + val y = x.remove("foo") + assertEquals(Null, y) + + val z = new UnprefixedAttribute("foo", null:NodeSeq, x) + assertEquals(None, z.get("foo")) + + var appended = x append x append x append x + var len = 0; while (appended ne Null) { + appended = appended.next + len = len + 1 + } + assertEquals("removal of duplicates for unprefixed attributes in append", 1, len) + } + + @Test + def attributeWithOption: Unit = { + val x = new UnprefixedAttribute("foo", Some(Text("bar")), Null) + + assertEquals(Some(Text("bar")), x.get("foo")) + assertEquals(Text("bar"), x("foo")) + assertEquals(None, x.get("no_foo")) + assertEquals(null, x("no_foo")) + + val attr1 = Some(Text("foo value")) + val attr2 = None + val y = + assertEquals(Some(Text("foo value")), y.attributes.get("foo")) + assertEquals(Text("foo value"), y.attributes("foo")) + assertEquals(None, y.attributes.get("bar")) + assertEquals(null, y.attributes("bar")) + + val z = new UnprefixedAttribute("foo", None, x) + assertEquals(None, z.get("foo")) + } + + @Test + def attributeToString: Unit = { + val expected: String = """""" + assertEquals(expected, ().toString) + assertEquals(expected, ().toString) + } + + @Test + def attributeOperator: Unit = { + val xml = + assertEquals("apple", xml \@ "bar") + } + +} \ No newline at end of file diff --git a/test/files/jvm/xmlattr.check b/test/files/jvm/xmlattr.check deleted file mode 100644 index a87420d86..000000000 --- a/test/files/jvm/xmlattr.check +++ /dev/null @@ -1,18 +0,0 @@ -true -true -true -true -true -true -removal of duplicates for unprefixed attributes in append = 1 -true -true -true -true -true -true -true -true -true - - diff --git a/test/files/jvm/xmlattr.scala b/test/files/jvm/xmlattr.scala deleted file mode 100644 index 6423268ba..000000000 --- a/test/files/jvm/xmlattr.scala +++ /dev/null @@ -1,70 +0,0 @@ -import xml.{ NodeSeq, Null, Text, UnprefixedAttribute } - -object Test { - - def main(args: Array[String]) { - UnprefixedAttributeTest() - AttributeWithOptionTest() - AttributeOutputTest() - AttributeOperatorTest() - } - - object UnprefixedAttributeTest { - def apply() { - val x = new UnprefixedAttribute("foo","bar", Null) - println(Some(Text("bar")) == x.get("foo")) - println(Text("bar") == x("foo")) - println(None == x.get("no_foo")) - println(null == x("no_foo")) - - val y = x.remove("foo") - println(Null == y) - - val z = new UnprefixedAttribute("foo", null:NodeSeq, x) - println(None == z.get("foo")) - - var appended = x append x append x append x - var len = 0; while (appended ne Null) { - appended = appended.next - len = len + 1 - } - println("removal of duplicates for unprefixed attributes in append = " + len) - } - } - - object AttributeWithOptionTest { - def apply() { - val x = new UnprefixedAttribute("foo", Some(Text("bar")), Null) - - println(Some(Text("bar")) == x.get("foo")) - println(Text("bar") == x("foo")) - println(None == x.get("no_foo")) - println(null == x("no_foo")) - - val attr1 = Some(Text("foo value")) - val attr2 = None - val y = - println(Some(Text("foo value")) == y.attributes.get("foo")); - println(Text("foo value") == y.attributes("foo")) - println(None == y.attributes.get("bar")) - println(null == y.attributes("bar")) - - val z = new UnprefixedAttribute("foo", None, x) - println(None == z.get("foo")) - } - } - - object AttributeOutputTest { - def apply() { - println() - println() - } - } - - object AttributeOperatorTest { - def apply() { - val xml = - assert(xml \@ "bar" == "apple") - } - } -} From be7046bc9f8a152dedd156adfe37e45806e7a979 Mon Sep 17 00:00:00 2001 From: Grzegorz Kossakowski Date: Fri, 18 Oct 2013 13:56:10 +0200 Subject: [PATCH 011/789] Migrate partest jvm/xml04embed.scala test to JUnit. --- .../scala/scala/xml/XMLEmbeddingTest.scala | 23 +++++++++++++++++++ test/files/jvm/xml04embed.check | 3 --- test/files/jvm/xml04embed.scala | 10 -------- 3 files changed, 23 insertions(+), 13 deletions(-) create mode 100644 src/test/scala/scala/xml/XMLEmbeddingTest.scala delete mode 100644 test/files/jvm/xml04embed.check delete mode 100644 test/files/jvm/xml04embed.scala diff --git a/src/test/scala/scala/xml/XMLEmbeddingTest.scala b/src/test/scala/scala/xml/XMLEmbeddingTest.scala new file mode 100644 index 000000000..81c69bfb3 --- /dev/null +++ b/src/test/scala/scala/xml/XMLEmbeddingTest.scala @@ -0,0 +1,23 @@ +package scala.xml + +import org.junit.Test +import org.junit.Ignore +import org.junit.runner.RunWith +import org.junit.runners.JUnit4 +import org.junit.Assert.assertTrue +import org.junit.Assert.assertFalse +import org.junit.Assert.assertEquals + +class XMLEmbeddingTest { + + @Test + def basic: Unit = { + val ya = {{ + assertEquals("{", ya.text) + val ua = }} + assertEquals("}", ua.text) + val za = {{}}{{}}{{}} + assertEquals("{}{}{}", za.text) + } + +} \ No newline at end of file diff --git a/test/files/jvm/xml04embed.check b/test/files/jvm/xml04embed.check deleted file mode 100644 index e71e64514..000000000 --- a/test/files/jvm/xml04embed.check +++ /dev/null @@ -1,3 +0,0 @@ -{ -} -{}{}{} diff --git a/test/files/jvm/xml04embed.scala b/test/files/jvm/xml04embed.scala deleted file mode 100644 index fa453e429..000000000 --- a/test/files/jvm/xml04embed.scala +++ /dev/null @@ -1,10 +0,0 @@ -object Test { - def main(args: Array[String]) { - val ya = {{ - println(ya.text) - val ua = }} - println(ua.text) - val za = {{}}{{}}{{}} - println(za.text) - } -} From e36604efc454d73b196aed0ab58c5764079e1508 Mon Sep 17 00:00:00 2001 From: Grzegorz Kossakowski Date: Fri, 18 Oct 2013 17:10:26 +0200 Subject: [PATCH 012/789] Migrate partest jvm/xml03syntax.scala test to JUnit. --- .../test/scala/scala/xml/XMLSyntaxTest.scala | 75 ++++++++----------- test/files/jvm/xml03syntax.check | 27 ------- 2 files changed, 32 insertions(+), 70 deletions(-) rename test/files/jvm/xml03syntax.scala => src/test/scala/scala/xml/XMLSyntaxTest.scala (58%) delete mode 100755 test/files/jvm/xml03syntax.check diff --git a/test/files/jvm/xml03syntax.scala b/src/test/scala/scala/xml/XMLSyntaxTest.scala similarity index 58% rename from test/files/jvm/xml03syntax.scala rename to src/test/scala/scala/xml/XMLSyntaxTest.scala index 41663681c..fa250b416 100644 --- a/test/files/jvm/xml03syntax.scala +++ b/src/test/scala/scala/xml/XMLSyntaxTest.scala @@ -1,83 +1,72 @@ -import scala.xml._ +package scala.xml -object Test { +import org.junit.Test +import org.junit.Ignore +import org.junit.runner.RunWith +import org.junit.runners.JUnit4 +import org.junit.Assert.assertTrue +import org.junit.Assert.assertFalse +import org.junit.Assert.assertEquals + +class XMLSyntaxTest { private def handle[A](x: Node): A = { - println(x) x.child(0).asInstanceOf[Atom[A]].data } - def main(args: Array[String]) { - test1() - test2() - test3() - } - - private def test1() { + @Test + def test1(): Unit = { val xNull = {null} // these used to be Atom(unit), changed to empty children - - println(xNull.child sameElements Nil) + assertTrue(xNull.child sameElements Nil) val x0 = {} // these used to be Atom(unit), changed to empty children val x00 = { } // dto. - val xa = { "world" } - - println(x0.child sameElements Nil) - println(x00.child sameElements Nil) - println(handle[String](xa) == "world") + assertTrue(x0.child sameElements Nil) + assertTrue(x00.child sameElements Nil) + assertEquals("world", handle[String](xa)) val xb = { 1.5 } - - println(handle[Double](xb) == 1.5) + assertEquals(1.5, handle[Double](xb), 0.0) val xc = { 5 } - - println(handle[Int](xc) == 5) + assertEquals(5, handle[Int](xc)) val xd = { true } - - println(handle[Boolean](xd) == true) + assertEquals(true, handle[Boolean](xd)) val xe = { 5:Short } - - println(handle[Short](xe) == (5:Short)) + assertEquals((5:Short), handle[Short](xe)) val xf = { val x = 27; x } - - println(handle[Int](xf) == 27) + assertEquals(27, handle[Int](xf)) val xg = { List(1,2,3,4) } - - println(xg) - for (z <- xg.child) { - println(z.toString() + {if (z.isInstanceOf[Text]) "(is text node ' ')" else ""}) - } + assertEquals("1 2 3 4", xg.toString) + assertFalse(xg.child.map(_.isInstanceOf[Text]).exists(identity)) val xh = { for(x <- List(1,2,3,4) if x % 2 == 0) yield x } - - println(xh) - for (z <- xh.child) { - println(z.toString() + {if (z.isInstanceOf[Text]) "(is text node ' ')" else ""}) - } - println + assertEquals("2 4", xh.toString) + assertFalse(xh.child.map(_.isInstanceOf[Text]).exists(identity)) } /** see SVN r13821 (emir): support for , * so that Options can be used for optional attributes. */ - private def test2() { + @Test + def test2(): Unit = { val x1: Option[Seq[Node]] = Some(hello) val n1 = ; - println("node="+n1+", key="+n1.attribute("key")) + assertEquals(x1, n1.attribute("key")) val x2: Option[Seq[Node]] = None val n2 = ; - println("node="+n2+", key="+n2.attribute("key")) + assertEquals(x2, n2.attribute("key")) } - private def test3() { + @Test + def test3(): Unit = { // this demonstrates how to handle entities val s = io.Source.fromString(" ") object parser extends xml.parsing.ConstructingParser(s, false /*ignore ws*/) { @@ -91,7 +80,7 @@ object Test { } val parsed = parser.element(TopScope) // parse the source as element // alternatively, we could call document() - println(parsed) + assertEquals("Š", parsed.toString) } } diff --git a/test/files/jvm/xml03syntax.check b/test/files/jvm/xml03syntax.check deleted file mode 100755 index 599cbad68..000000000 --- a/test/files/jvm/xml03syntax.check +++ /dev/null @@ -1,27 +0,0 @@ -true -true -true -world -true -1.5 -true -5 -true -true -true -5 -true -27 -true -1 2 3 4 -1 -2 -3 -4 -2 4 -2 -4 - -node=, key=Some(hello) -node=, key=None -Š From 053193f83a2e84996ac33e692322ea5b0b3e1321 Mon Sep 17 00:00:00 2001 From: Grzegorz Kossakowski Date: Wed, 23 Oct 2013 00:03:21 +0200 Subject: [PATCH 013/789] Do not include partest and it's dependencies in generated pom. Define custom Ivy configuration that contains all dependencies of partest (and partest itself) and make sure that this configuration is not considered when pom is generated. Remove the comment about significance of dependency order declaration. Given the fact that we excluded conflicting, transitive dependencies and all partest dependencies are isolated from regular dependencies the situation is much better. --- build.sbt | 33 ++++++++++++++++++++++++++++++--- 1 file changed, 30 insertions(+), 3 deletions(-) diff --git a/build.sbt b/build.sbt index 455c86f82..cec1bcb76 100644 --- a/build.sbt +++ b/build.sbt @@ -83,12 +83,39 @@ TestKeys.includeTestDependencies := true libraryDependencies ++= Seq("junit" % "junit" % "4.11" % "test", "com.novocode" % "junit-interface" % "0.10" % "test") +// Define custom Ivy configuration called "partest". Ivy configuration is analogous to Maven scope +// and allows to group dependencies together, see: +// http://www.scala-sbt.org/release/docs/Detailed-Topics/Library-Management#configurations +// We define custom configuration so we can resolve partest through Ivy from Maven repository. +// However, by putting partest dependency in custom configuration we can make sure that +// it doesn't interfere with any other dependencies. Also, we can make sure that dependencies +// resolved in partest configuration NOT included in generated pom. See makePomConfiguration +// setting we define below. +val partestConfiguration = config("partest") + +// Define configuration to be used to assemble the classpath for compiling and running +// tests. We define it as an union of default test configuration (scope in Maven's speak) +// and partest configuration. +val testWithPartestConfiguration = Configurations.Test.extend(partestConfiguration) + +// register both configurations we defined so they are processed by `update` command +ivyConfigurations ++= Seq(partestConfiguration, testWithPartestConfiguration) + +// override configuration used to assemble classpath for tests +configuration in Test := testWithPartestConfiguration + +// Define configurations (scopes in Maven's speak) that are taken into account when +// generating pom. By default sbt sets MakePomConfiguration.configurations to None which is +// interpreted as "include dependencies in all configurations". That would include +// dependencies in partest configuration which is not what we want: see comment above +// where we define the partest configuration. +makePomConfiguration := makePomConfiguration.value.copy(configurations = Some(Configurations.default)) + // default TestKeys.partestVersion := "1.0.0-RC6" // the actual partest the interface calls into -- must be binary version close enough to ours // so that it can link to the compiler/lib we're using (testing) -// NOTE: not sure why, but the order matters (maybe due to the binary version conflicts for xml/parser combinators pulled in for scaladoc?) libraryDependencies ++= ( if (TestKeys.includeTestDependencies.value) { /** @@ -111,8 +138,8 @@ libraryDependencies ++= ( dep.exclude("org.scala-lang.modules", "scala-xml_2.11.0-M5"). exclude("org.scala-lang.modules", "scala-xml_2.11.0-M4"). exclude("org.scalacheck", "scalacheck_2.11.0-M5") - Seq("org.scala-lang.modules" % "scala-partest-interface_2.11.0-M5" % "0.2" % "test", - "org.scala-lang.modules" % "scala-partest_2.11.0-M5" % TestKeys.partestVersion.value % "test"). + Seq("org.scala-lang.modules" % "scala-partest-interface_2.11.0-M5" % "0.2" % "partest", + "org.scala-lang.modules" % "scala-partest_2.11.0-M5" % TestKeys.partestVersion.value % "partest"). map(excludeScalaXml) } else Seq.empty From 34f043760b12d48c8825dc5c661fa5eba57aad0c Mon Sep 17 00:00:00 2001 From: Grzegorz Kossakowski Date: Wed, 23 Oct 2013 16:44:43 +0200 Subject: [PATCH 014/789] Revert "Do not include partest and it's dependencies in generated pom." This reverts commit 053193f83a2e84996ac33e692322ea5b0b3e1321. I misunderstood bevaior of test scope/configuration in relation to transitive dependency. Partest can be included in generated pom as long as it's declared to be in test scope. Therefore the changes in 053193f83a2e84996ac33e692322ea5b0b3e1321 are not needed. --- build.sbt | 33 +++------------------------------ 1 file changed, 3 insertions(+), 30 deletions(-) diff --git a/build.sbt b/build.sbt index cec1bcb76..455c86f82 100644 --- a/build.sbt +++ b/build.sbt @@ -83,39 +83,12 @@ TestKeys.includeTestDependencies := true libraryDependencies ++= Seq("junit" % "junit" % "4.11" % "test", "com.novocode" % "junit-interface" % "0.10" % "test") -// Define custom Ivy configuration called "partest". Ivy configuration is analogous to Maven scope -// and allows to group dependencies together, see: -// http://www.scala-sbt.org/release/docs/Detailed-Topics/Library-Management#configurations -// We define custom configuration so we can resolve partest through Ivy from Maven repository. -// However, by putting partest dependency in custom configuration we can make sure that -// it doesn't interfere with any other dependencies. Also, we can make sure that dependencies -// resolved in partest configuration NOT included in generated pom. See makePomConfiguration -// setting we define below. -val partestConfiguration = config("partest") - -// Define configuration to be used to assemble the classpath for compiling and running -// tests. We define it as an union of default test configuration (scope in Maven's speak) -// and partest configuration. -val testWithPartestConfiguration = Configurations.Test.extend(partestConfiguration) - -// register both configurations we defined so they are processed by `update` command -ivyConfigurations ++= Seq(partestConfiguration, testWithPartestConfiguration) - -// override configuration used to assemble classpath for tests -configuration in Test := testWithPartestConfiguration - -// Define configurations (scopes in Maven's speak) that are taken into account when -// generating pom. By default sbt sets MakePomConfiguration.configurations to None which is -// interpreted as "include dependencies in all configurations". That would include -// dependencies in partest configuration which is not what we want: see comment above -// where we define the partest configuration. -makePomConfiguration := makePomConfiguration.value.copy(configurations = Some(Configurations.default)) - // default TestKeys.partestVersion := "1.0.0-RC6" // the actual partest the interface calls into -- must be binary version close enough to ours // so that it can link to the compiler/lib we're using (testing) +// NOTE: not sure why, but the order matters (maybe due to the binary version conflicts for xml/parser combinators pulled in for scaladoc?) libraryDependencies ++= ( if (TestKeys.includeTestDependencies.value) { /** @@ -138,8 +111,8 @@ libraryDependencies ++= ( dep.exclude("org.scala-lang.modules", "scala-xml_2.11.0-M5"). exclude("org.scala-lang.modules", "scala-xml_2.11.0-M4"). exclude("org.scalacheck", "scalacheck_2.11.0-M5") - Seq("org.scala-lang.modules" % "scala-partest-interface_2.11.0-M5" % "0.2" % "partest", - "org.scala-lang.modules" % "scala-partest_2.11.0-M5" % TestKeys.partestVersion.value % "partest"). + Seq("org.scala-lang.modules" % "scala-partest-interface_2.11.0-M5" % "0.2" % "test", + "org.scala-lang.modules" % "scala-partest_2.11.0-M5" % TestKeys.partestVersion.value % "test"). map(excludeScalaXml) } else Seq.empty From cc1f8befd2fff0138bd9c87e75f3d7ab8ccaa477 Mon Sep 17 00:00:00 2001 From: Grzegorz Kossakowski Date: Fri, 25 Oct 2013 17:44:51 +0200 Subject: [PATCH 015/789] Upgrade to Scala 2.11.0-M6. That entails tweaking dependencies once again. Hold your breath: * we can't upgrade to new version of partest because it's not been released yet; we can't release it first because scalacheck is needed * therefore we are using the M5 version and then we have to exclude all transitive dependencies that were built against M5; one such dependency would be scala-compiler itself * since we excluded all transitive dependencies we need to bring some back: we add diffutils and scala-compiler but M6 version All newly added dependencies are in "test" scope. I verified that nothing leaks to a pom.xml. Also, updated check file for one of the tests because there were some improvements to error handling that changed errors being emitted. See SI-7895 for details. --- build.sbt | 16 +-- test/files/neg/t1011.check | 206 ++++++++++++++++++++++++++++++++++++- 2 files changed, 215 insertions(+), 7 deletions(-) diff --git a/build.sbt b/build.sbt index 455c86f82..8b0aeaea5 100644 --- a/build.sbt +++ b/build.sbt @@ -5,12 +5,12 @@ name := "scala-xml" version := "1.0.0-SNAPSHOT" // standard stuff follows: -scalaVersion := "2.11.0-M5" +scalaVersion := "2.11.0-M6" // NOTE: not necessarily equal to scalaVersion // (e.g., during PR validation, we override scalaVersion to validate, // but don't rebuild scalacheck, so we don't want to rewire that dependency) -scalaBinaryVersion := "2.11.0-M5" +scalaBinaryVersion := "2.11.0-M6" // don't use for doc scope, scaladoc warnings are not to be reckoned with @@ -108,11 +108,15 @@ libraryDependencies ++= ( * */ def excludeScalaXml(dep: ModuleID): ModuleID = - dep.exclude("org.scala-lang.modules", "scala-xml_2.11.0-M5"). - exclude("org.scala-lang.modules", "scala-xml_2.11.0-M4"). + dep.exclude("org.scala-lang.modules", "scala-xml_2.11.0-M4"). + exclude("org.scala-lang.modules", "scala-xml_2.11.0-M5"). + exclude("org.scala-lang.modules", "scala-xml_2.11.0-M6"). exclude("org.scalacheck", "scalacheck_2.11.0-M5") - Seq("org.scala-lang.modules" % "scala-partest-interface_2.11.0-M5" % "0.2" % "test", - "org.scala-lang.modules" % "scala-partest_2.11.0-M5" % TestKeys.partestVersion.value % "test"). + Seq("org.scala-lang.modules" % "scala-partest-interface_2.11.0-M5" % "0.2" % "test" intransitive, + "org.scala-lang.modules" % "scala-partest_2.11.0-M5" % TestKeys.partestVersion.value % "test" intransitive, + // diffutils is needed by partest + "com.googlecode.java-diff-utils" % "diffutils" % "1.3.0" % "test", + "org.scala-lang" % "scala-compiler" % scalaVersion.value % "test"). map(excludeScalaXml) } else Seq.empty diff --git a/test/files/neg/t1011.check b/test/files/neg/t1011.check index d9c812354..3c9e4ecd8 100644 --- a/test/files/neg/t1011.check +++ b/test/files/neg/t1011.check @@ -1,4 +1,208 @@ t1011.scala:8: error: not found: value entity
{Text(entity)} ^ -one error found +t1011.scala:9: error: not found: value entity + {Text(entity)} + ^ +t1011.scala:10: error: not found: value entity + {Text(entity)} + ^ +t1011.scala:11: error: not found: value entity + {Text(entity)} + ^ +t1011.scala:12: error: not found: value entity + {Text(entity)} + ^ +t1011.scala:13: error: not found: value entity + {Text(entity)} + ^ +t1011.scala:14: error: not found: value entity + {Text(entity)} + ^ +t1011.scala:15: error: not found: value entity + {Text(entity)} + ^ +t1011.scala:16: error: not found: value entity + {Text(entity)} + ^ +t1011.scala:17: error: not found: value entity + {Text(entity)} + ^ +t1011.scala:18: error: not found: value entity + {Text(entity)} + ^ +t1011.scala:19: error: not found: value entity + {Text(entity)} + ^ +t1011.scala:20: error: not found: value entity + {Text(entity)} + ^ +t1011.scala:21: error: not found: value entity + {Text(entity)} + ^ +t1011.scala:22: error: not found: value entity + {Text(entity)} + ^ +t1011.scala:23: error: not found: value entity + {Text(entity)} + ^ +t1011.scala:24: error: not found: value entity + {Text(entity)} + ^ +t1011.scala:25: error: not found: value entity + {Text(entity)} + ^ +t1011.scala:26: error: not found: value entity + {Text(entity)} + ^ +t1011.scala:27: error: not found: value entity + {Text(entity)} + ^ +t1011.scala:28: error: not found: value entity + {Text(entity)} + ^ +t1011.scala:29: error: not found: value entity + {Text(entity)} + ^ +t1011.scala:30: error: not found: value entity + {Text(entity)} + ^ +t1011.scala:31: error: not found: value entity + {Text(entity)} + ^ +t1011.scala:32: error: not found: value entity + {Text(entity)} + ^ +t1011.scala:33: error: not found: value entity + {Text(entity)} + ^ +t1011.scala:34: error: not found: value entity + {Text(entity)} + ^ +t1011.scala:35: error: not found: value entity + {Text(entity)} + ^ +t1011.scala:36: error: not found: value entity + {Text(entity)} + ^ +t1011.scala:37: error: not found: value entity + {Text(entity)} + ^ +t1011.scala:38: error: not found: value entity + {Text(entity)} + ^ +t1011.scala:39: error: not found: value entity + {Text(entity)} + ^ +t1011.scala:40: error: not found: value entity + {Text(entity)} + ^ +t1011.scala:41: error: not found: value entity + {Text(entity)} + ^ +t1011.scala:42: error: not found: value entity + {Text(entity)} + ^ +t1011.scala:43: error: not found: value entity + {Text(entity)} + ^ +t1011.scala:44: error: not found: value entity + {Text(entity)} + ^ +t1011.scala:45: error: not found: value entity + {Text(entity)} + ^ +t1011.scala:46: error: not found: value entity + {Text(entity)} + ^ +t1011.scala:47: error: not found: value entity + {Text(entity)} + ^ +t1011.scala:48: error: not found: value entity + {Text(entity)} + ^ +t1011.scala:49: error: not found: value entity + {Text(entity)} + ^ +t1011.scala:50: error: not found: value entity + {Text(entity)} + ^ +t1011.scala:51: error: not found: value entity + {Text(entity)} + ^ +t1011.scala:52: error: not found: value entity + {Text(entity)} + ^ +t1011.scala:53: error: not found: value entity + {Text(entity)} + ^ +t1011.scala:54: error: not found: value entity + {Text(entity)} + ^ +t1011.scala:55: error: not found: value entity + {Text(entity)} + ^ +t1011.scala:56: error: not found: value entity + {Text(entity)} + ^ +t1011.scala:57: error: not found: value entity + {Text(entity)} + ^ +t1011.scala:58: error: not found: value entity + {Text(entity)} + ^ +t1011.scala:59: error: not found: value entity + {Text(entity)} + ^ +t1011.scala:60: error: not found: value entity + {Text(entity)} + ^ +t1011.scala:61: error: not found: value entity + {Text(entity)} + ^ +t1011.scala:62: error: not found: value entity + {Text(entity)} + ^ +t1011.scala:63: error: not found: value entity + {Text(entity)} + ^ +t1011.scala:64: error: not found: value entity + {Text(entity)} + ^ +t1011.scala:65: error: not found: value entity + {Text(entity)} + ^ +t1011.scala:66: error: not found: value entity + {Text(entity)} + ^ +t1011.scala:67: error: not found: value entity + {Text(entity)} + ^ +t1011.scala:68: error: not found: value entity + {Text(entity)} + ^ +t1011.scala:69: error: not found: value entity + {Text(entity)} + ^ +t1011.scala:70: error: not found: value entity + {Text(entity)} + ^ +t1011.scala:71: error: not found: value entity + {Text(entity)} + ^ +t1011.scala:72: error: not found: value entity + {Text(entity)} + ^ +t1011.scala:73: error: not found: value entity + {Text(entity)} + ^ +t1011.scala:74: error: not found: value entity + {Text(entity)} + ^ +t1011.scala:75: error: not found: value entity + {Text(entity)} + ^ +t1011.scala:76: error: not found: value entity + {Text(entity)}
+ ^ +69 errors found From edc72b7840465d20e400679a0a1d5d72512607a3 Mon Sep 17 00:00:00 2001 From: Grzegorz Kossakowski Date: Mon, 28 Oct 2013 13:17:03 +0100 Subject: [PATCH 016/789] Add default credentials definition in build.sbt. Credentials file is configured according to this sbt documentation page: http://www.scala-sbt.org/release/docs/Detailed-Topics/Publishing.html#credentials --- build.sbt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/build.sbt b/build.sbt index 8b0aeaea5..56e41378f 100644 --- a/build.sbt +++ b/build.sbt @@ -42,6 +42,8 @@ publishTo := { Some("releases" at nexus + "service/local/staging/deploy/maven2") } +credentials += Credentials(Path.userHome / ".ivy2" / ".credentials") + publishMavenStyle := true publishArtifact in Test := false From af83cdb25f1c35727f7711386461b44b0963587e Mon Sep 17 00:00:00 2001 From: Grzegorz Kossakowski Date: Mon, 28 Oct 2013 13:27:34 +0100 Subject: [PATCH 017/789] Release scala-xml 1.0.0-RC6. --- build.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index 56e41378f..b4340ba0d 100644 --- a/build.sbt +++ b/build.sbt @@ -2,7 +2,7 @@ organization := "org.scala-lang.modules" name := "scala-xml" -version := "1.0.0-SNAPSHOT" +version := "1.0.0-RC6" // standard stuff follows: scalaVersion := "2.11.0-M6" From 2e5ea5e3bba86aa3d96985e482c9f0ee8f6def32 Mon Sep 17 00:00:00 2001 From: Grzegorz Kossakowski Date: Mon, 28 Oct 2013 13:34:17 +0100 Subject: [PATCH 018/789] Switch back to SNAPSHOT version after 1.0.0-RC6 release. --- build.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index b4340ba0d..56e41378f 100644 --- a/build.sbt +++ b/build.sbt @@ -2,7 +2,7 @@ organization := "org.scala-lang.modules" name := "scala-xml" -version := "1.0.0-RC6" +version := "1.0.0-SNAPSHOT" // standard stuff follows: scalaVersion := "2.11.0-M6" From 917f4c21c1fde63e3bca4e4b2dac92946e190782 Mon Sep 17 00:00:00 2001 From: Adriaan Moors Date: Tue, 12 Nov 2013 16:29:08 -0800 Subject: [PATCH 019/789] Bump to partest 1.0.0-RC7 --- build.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index 56e41378f..76f6b644c 100644 --- a/build.sbt +++ b/build.sbt @@ -86,7 +86,7 @@ TestKeys.includeTestDependencies := true libraryDependencies ++= Seq("junit" % "junit" % "4.11" % "test", "com.novocode" % "junit-interface" % "0.10" % "test") // default -TestKeys.partestVersion := "1.0.0-RC6" +TestKeys.partestVersion := "1.0.0-RC7" // the actual partest the interface calls into -- must be binary version close enough to ours // so that it can link to the compiler/lib we're using (testing) From 3181d75613a6128ab0a778569f71368e17d145e6 Mon Sep 17 00:00:00 2001 From: Adriaan Moors Date: Tue, 12 Nov 2013 16:29:20 -0800 Subject: [PATCH 020/789] Set up travis validation. --- .travis.yml | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 000000000..d665c7054 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,13 @@ +language: scala +script: + - sbt ++$TRAVIS_SCALA_VERSION 'set concurrentRestrictions in Global += Tags.limit(Tags.Compile, 2)' compile test:compile + - sbt ++$TRAVIS_SCALA_VERSION 'set concurrentRestrictions in Global += Tags.limit(Tags.Test, 1)' test +scala: + - 2.10.3 + - 2.11.0-M6 +jdk: + - oraclejdk6 + - openjdk7 +notifications: + email: + - adriaan.moors@typesafe.com \ No newline at end of file From bff2d8473861baefcf91a2ccbb919361f160e479 Mon Sep 17 00:00:00 2001 From: Adriaan Moors Date: Tue, 12 Nov 2013 16:40:57 -0800 Subject: [PATCH 021/789] Abstract over scala binary version in partest deps. --- build.sbt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build.sbt b/build.sbt index 76f6b644c..4ec9f6dce 100644 --- a/build.sbt +++ b/build.sbt @@ -114,8 +114,8 @@ libraryDependencies ++= ( exclude("org.scala-lang.modules", "scala-xml_2.11.0-M5"). exclude("org.scala-lang.modules", "scala-xml_2.11.0-M6"). exclude("org.scalacheck", "scalacheck_2.11.0-M5") - Seq("org.scala-lang.modules" % "scala-partest-interface_2.11.0-M5" % "0.2" % "test" intransitive, - "org.scala-lang.modules" % "scala-partest_2.11.0-M5" % TestKeys.partestVersion.value % "test" intransitive, + Seq("org.scala-lang.modules" % s"scala-partest-interface_${scalaBinaryVersion.value}" % "0.2" % "test" intransitive, + "org.scala-lang.modules" % s"scala-partest_${scalaBinaryVersion.value}" % TestKeys.partestVersion.value % "test" intransitive, // diffutils is needed by partest "com.googlecode.java-diff-utils" % "diffutils" % "1.3.0" % "test", "org.scala-lang" % "scala-compiler" % scalaVersion.value % "test"). From 98aa871f6b46ae18897049f0e8c681825a0a334e Mon Sep 17 00:00:00 2001 From: Adriaan Moors Date: Tue, 12 Nov 2013 19:21:47 -0800 Subject: [PATCH 022/789] Add Travis CI status. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index c9debc1b2..ee18e9bbe 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -scala-xml +scala-xml ========= The standard Scala XML library. From 668ebe5c1806588a8a0368ed0ceeeb71e40f908b Mon Sep 17 00:00:00 2001 From: Adriaan Moors Date: Tue, 12 Nov 2013 19:25:08 -0800 Subject: [PATCH 023/789] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index ee18e9bbe..fe1d9b2ab 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -scala-xml +scala-xml [](https://travis-ci.org/scala/scala-xml) ========= The standard Scala XML library. From 48e8c80194fc93b1c6d8667298e648e5661982e0 Mon Sep 17 00:00:00 2001 From: Adriaan Moors Date: Tue, 12 Nov 2013 19:47:59 -0800 Subject: [PATCH 024/789] Validate against 2.11.0-SNAPSHOT --- .travis.yml | 2 +- build.sbt | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index d665c7054..058d62b1c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,7 +4,7 @@ script: - sbt ++$TRAVIS_SCALA_VERSION 'set concurrentRestrictions in Global += Tags.limit(Tags.Test, 1)' test scala: - 2.10.3 - - 2.11.0-M6 + - 2.11.0-SNAPSHOT jdk: - oraclejdk6 - openjdk7 diff --git a/build.sbt b/build.sbt index 4ec9f6dce..e482e50e8 100644 --- a/build.sbt +++ b/build.sbt @@ -12,11 +12,12 @@ scalaVersion := "2.11.0-M6" // but don't rebuild scalacheck, so we don't want to rewire that dependency) scalaBinaryVersion := "2.11.0-M6" +// to allow compiling against snapshot versions of Scala +resolvers += Resolver.sonatypeRepo("snapshots") // don't use for doc scope, scaladoc warnings are not to be reckoned with scalacOptions in compile ++= Seq("-optimize", "-Xfatal-warnings", "-feature", "-deprecation", "-unchecked", "-Xlint") - // Generate $name.properties to store our version as well as the scala version used to build resourceGenerators in Compile <+= Def.task { val props = new java.util.Properties From d22e505585d971cf0943af4aa610a6d69f9fac30 Mon Sep 17 00:00:00 2001 From: Adriaan Moors Date: Wed, 13 Nov 2013 20:42:06 -0800 Subject: [PATCH 025/789] pattern matching --- .../scala/scala/xml/PatternMatching.scala | 113 ++++++++++++++++++ test/files/jvm/t560bis.check | 2 - test/files/jvm/t560bis.scala | 21 ---- 3 files changed, 113 insertions(+), 23 deletions(-) create mode 100644 src/test/scala/scala/xml/PatternMatching.scala delete mode 100644 test/files/jvm/t560bis.check delete mode 100644 test/files/jvm/t560bis.scala diff --git a/src/test/scala/scala/xml/PatternMatching.scala b/src/test/scala/scala/xml/PatternMatching.scala new file mode 100644 index 000000000..05ec06268 --- /dev/null +++ b/src/test/scala/scala/xml/PatternMatching.scala @@ -0,0 +1,113 @@ +package scala.xml + +import org.junit.Test +import org.junit.Assert.assertTrue +import org.junit.Assert.assertEquals + +class PatternMatching extends { + @Test + def unprefixedAttribute: Unit = { + val li = List("1", "2", "3", "4") + assertTrue(matchSeq(li)) + assertTrue(matchList(li)) + } + + def matchSeq(args: Seq[String]) = args match { + case Seq(a, b, c, d @ _*) => true + } + + def matchList(args: List[String]) = + Elem(null, "bla", Null, TopScope, minimizeEmpty = true, (args map { x => Text(x) }): _*) match { + case Elem(_, _, _, _, Text("1"), _*) => true + } + + @Test + def simpleNode = + assertTrue( match { + case => true + }) + + @Test + def nameSpaced = + assertTrue( match { + case => true + }) + + val cx = + crazy text world + + + @Test + def nodeContents = { + assertTrue(Utility.trim(cx) match { + case n @ crazy text world if (n \ "@foo") xml_== "bar" => true + }) + assertTrue(Utility.trim(cx) match { + case n @ crazy text world if (n \ "@foo") xml_== "bar" => true + }) + assertTrue( match { + case scala.xml.QNode("gaga", "foo", md, child @ _*) => true + }) + + assertTrue( match { + case scala.xml.Node("foo", md, child @ _*) => true + }) + + } + + object SafeNodeSeq { + def unapplySeq(any: Any): Option[Seq[Node]] = any match { + case s: Seq[_] => Some(s flatMap (_ match { + case n: Node => n case _ => NodeSeq.Empty + })) case _ => None + } + } + + @Test + def nodeSeq = { // t0646 + import scala.xml.NodeSeq + + val books = + + Blabla + Blubabla + Baaaaaaalabla + ; + + assertTrue(new NodeSeq { val theSeq = books.child } match { + case t @ Seq(Blabla) => false + case _ => true + }) + + // SI-1059 + var m: PartialFunction[Any, Any] = { case SafeNodeSeq(s @ _*) => s } + + assertEquals(m( ++ ), List(, )) + assertTrue(m.isDefinedAt( ++ )) + } + + @Test + def SI_4124 = { + val body: Node = hi + + assertTrue((body: AnyRef, "foo") match { + case (node: Node, "bar") => false + case (ser: Serializable, "foo") => true + }) + + assertTrue((body, "foo") match { + case (node: Node, "bar") => false + case (ser: Serializable, "foo") => true + }) + + assertTrue((body: AnyRef, "foo") match { + case (node: Node, "foo") => true + case (ser: Serializable, "foo") => false + }) + + assertTrue((body: AnyRef, "foo") match { + case (node: Node, "foo") => true + case (ser: Serializable, "foo") => false + }) + } +} \ No newline at end of file diff --git a/test/files/jvm/t560bis.check b/test/files/jvm/t560bis.check deleted file mode 100644 index 91eb4c19a..000000000 --- a/test/files/jvm/t560bis.check +++ /dev/null @@ -1,2 +0,0 @@ -cool! -cool! diff --git a/test/files/jvm/t560bis.scala b/test/files/jvm/t560bis.scala deleted file mode 100644 index 21eb8dde2..000000000 --- a/test/files/jvm/t560bis.scala +++ /dev/null @@ -1,21 +0,0 @@ -object Test { -import scala.xml._; - - def bar(args: Seq[String]) = args match { - case Seq(a,b,c,d @ _*) => Console.println("cool!") - case _ => Console.println("bah") - } - def foo(args: List[String]) = - Elem(null,"bla",Null, TopScope, minimizeEmpty = true, (args map {x => Text(x)}):_*) match { - case Elem(_,_,_,_,Text("1"),_*) => - Console.println("cool!") - case _ => - Console.println("bah") - } - - def main(args: Array[String]) = { - val li = List("1","2","3","4") - bar(li) - foo(li) - } -} From e266dcc1c54b90fafcac5afaa9208da95ca31f2a Mon Sep 17 00:00:00 2001 From: Adriaan Moors Date: Wed, 13 Nov 2013 23:03:18 -0800 Subject: [PATCH 026/789] Ported jvm tests --- src/test/scala/scala/xml/XMLTest.scala | 437 ++++++++++++++++++++----- test/files/jvm/xml01.check | 8 - test/files/jvm/xml01.scala | 182 ---------- test/files/jvm/xml02.check | 0 test/files/jvm/xml02.scala | 78 ----- test/files/jvm/xmlmore.check | 10 - test/files/jvm/xmlmore.scala | 29 -- 7 files changed, 353 insertions(+), 391 deletions(-) delete mode 100755 test/files/jvm/xml01.check delete mode 100644 test/files/jvm/xml01.scala delete mode 100644 test/files/jvm/xml02.check delete mode 100644 test/files/jvm/xml02.scala delete mode 100644 test/files/jvm/xmlmore.check delete mode 100644 test/files/jvm/xmlmore.scala diff --git a/src/test/scala/scala/xml/XMLTest.scala b/src/test/scala/scala/xml/XMLTest.scala index ba88c91c5..c3bc1ca4d 100644 --- a/src/test/scala/scala/xml/XMLTest.scala +++ b/src/test/scala/scala/xml/XMLTest.scala @@ -8,21 +8,27 @@ import org.junit.Assert.assertTrue import org.junit.Assert.assertFalse import org.junit.Assert.assertEquals +object XMLTest { + val e: scala.xml.MetaData = Null //Node.NoAttributes + val sc: scala.xml.NamespaceBinding = TopScope +} + class XMLTest { + import XMLTest.{ e, sc } @Test def nodeSeq: Unit = { val p = - - - - + + + +
- val pelems_1 = for (x <- p \ "bar"; y <- p \ "baz" ) yield { - Text(x.attributes("value").toString + y.attributes("bazValue").toString+ "!") + val pelems_1 = for (x <- p \ "bar"; y <- p \ "baz") yield { + Text(x.attributes("value").toString + y.attributes("bazValue").toString + "!") }; - val pelems_2 = new NodeSeq { val theSeq = List(Text("38!"),Text("58!")) }; + val pelems_2 = new NodeSeq { val theSeq = List(Text("38!"), Text("58!")) }; assertTrue(pelems_1 sameElements pelems_2) assertTrue(Text("8") sameElements (p \\ "@bazValue")) } @@ -31,39 +37,41 @@ class XMLTest { def queryBooks: Unit = { val books = - Blabla - Blubabla - Baaaaaaalabla - ; + Blabla + Blubabla + Baaaaaaalabla + ; val reviews = - Blabla - - Hallo Welt. - - - Blubabla - - Hello Blu - - - Blubabla - - rem 2 - - - ; - - val results1 = new scala.xml.PrettyPrinter(80, 5).formatNodes ( - for (t <- books \\ "title"; - r <- reviews \\ "entry" - if (r \ "title") xml_== t) yield - - { t } - { r \ "remarks" } - - ); + + Blabla + + Hallo Welt. + + + + Blubabla + + Hello Blu + + + + Blubabla + + rem 2 + + + ; + + val results1 = new scala.xml.PrettyPrinter(80, 5).formatNodes( + for ( + t <- books \\ "title"; + r <- reviews \\ "entry" if (r \ "title") xml_== t + ) yield + { t } + { r \ "remarks" } + ); val results1Expected = """ | Blabla | Hallo Welt. @@ -89,39 +97,42 @@ class XMLTest { def queryPhoneBook: Unit = { val phoneBook = - - This is the phonebook of the - ACME corporation. - - - John - +41 21 693 68 67 - +41 79 602 23 23 - - ; + + This is thephonebook + of the + ACME + corporation. + + + John + +41 21 693 68 67 + +41 79 602 23 23 + + ; val addrBook = - - This is the addressbook of the - ACME corporation. - - - John - Elm Street - Dolphin City - - ; - - val actual: String = new scala.xml.PrettyPrinter(80, 5).formatNodes ( - for (t <- addrBook \\ "entry"; - r <- phoneBook \\ "entry" - if (t \ "name") xml_== (r \ "name")) yield - - { t.child } - { r \ "phone" } - - ) + + This is theaddressbook + of the + ACME + corporation. + + + John + Elm Street + Dolphin City + + ; + + val actual: String = new scala.xml.PrettyPrinter(80, 5).formatNodes( + for ( + t <- addrBook \\ "entry"; + r <- phoneBook \\ "entry" if (t \ "name") xml_== (r \ "name") + ) yield + { t.child } + { r \ "phone" } + ) val expected = """| | John | Elm Street @@ -135,11 +146,11 @@ class XMLTest { @Test def namespaces: Unit = { val cuckoo = - - - ; + + + ; assertEquals("http://cuckoo.com", cuckoo.namespace) - for (n <- cuckoo \ "_" ) { + for (n <- cuckoo \ "_") { assertEquals("http://cuckoo.com", n.namespace) } } @@ -151,10 +162,10 @@ class XMLTest { import scala.xml.dtd.ELEMENTS import scala.xml.dtd.ContentModel._ vtor.setContentModel( - ELEMENTS( - Sequ( - Letter(ElemName("bar")), - Star(Letter(ElemName("baz"))) ))); + ELEMENTS( + Sequ( + Letter(ElemName("bar")), + Star(Letter(ElemName("baz")))))); } assertTrue(vtor()) @@ -165,20 +176,20 @@ class XMLTest { vtor.setContentModel( MIXED( Alt(Letter(ElemName("bar")), - Letter(ElemName("baz")), - Letter(ElemName("bal"))))); + Letter(ElemName("baz")), + Letter(ElemName("bal"))))); } - assertTrue(vtor( )) - assertTrue(vtor(abcdedgh )) - assertFalse(vtor( )) + assertTrue(vtor()) + assertTrue(vtor(abcdedgh)) + assertFalse(vtor( )) } def validationfOfAttributes: Unit = { val vtor = new scala.xml.dtd.ElementValidator(); vtor.setContentModel(null) vtor.setMetaData(List()) - assertFalse(vtor( )) + assertFalse(vtor()) { import scala.xml.dtd._ @@ -189,10 +200,268 @@ class XMLTest { { import scala.xml.dtd._ - vtor.setMetaData(List(AttrDecl("bar","CDATA",REQUIRED))) + vtor.setMetaData(List(AttrDecl("bar", "CDATA", REQUIRED))) + } + assertFalse(vtor()) + assertTrue(vtor()) + } + + import java.io.StringReader + import org.xml.sax.InputSource + + def Elem(prefix: String, label: String, attributes: MetaData, scope: NamespaceBinding, child: Node*): Elem = + scala.xml.Elem.apply(prefix, label, attributes, scope, minimizeEmpty = true, child: _*) + + lazy val parsedxml1 = XML.load(new InputSource(new StringReader(""))) + lazy val parsedxml11 = XML.load(new InputSource(new StringReader(""))) + val xmlFile2 = "Peter BunemanDan SuciuData on ze webJohn MitchellFoundations of Programming Languages"; + lazy val parsedxml2 = XML.load(new InputSource(new StringReader(xmlFile2))) + + @Test + def equality = { + val c = new Node { + def label = "hello" + override def hashCode() = + Utility.hashCode(prefix, label, attributes.hashCode(), scope.hashCode(), child); + def child = Elem(null, "world", e, sc); + //def attributes = e; + override def text = "" + } + + assertTrue(c == parsedxml11) + assertTrue(parsedxml1 == parsedxml11) + assertTrue(List(parsedxml1) sameElements List(parsedxml11)) + assertTrue(Array(parsedxml1).toList sameElements List(parsedxml11)) + + val x2 = "Peter BunemanDan SuciuData on ze web"; + + val i = new InputSource(new StringReader(x2)) + val x2p = scala.xml.XML.load(i) + + assertTrue(x2p == Elem(null, "book", e, sc, + Elem(null, "author", e, sc, Text("Peter Buneman")), + Elem(null, "author", e, sc, Text("Dan Suciu")), + Elem(null, "title", e, sc, Text("Data on ze web")))) + + } + + @Test + def xpath = { + assertTrue(parsedxml1 \ "_" sameElements List(Elem(null, "world", e, sc))) + + assertTrue(parsedxml1 \ "world" sameElements List(Elem(null, "world", e, sc))) + + assertTrue( + (parsedxml2 \ "_") sameElements List( + Elem(null, "book", e, sc, + Elem(null, "author", e, sc, Text("Peter Buneman")), + Elem(null, "author", e, sc, Text("Dan Suciu")), + Elem(null, "title", e, sc, Text("Data on ze web"))), + Elem(null, "book", e, sc, + Elem(null, "author", e, sc, Text("John Mitchell")), + Elem(null, "title", e, sc, Text("Foundations of Programming Languages"))))) + assertTrue((parsedxml2 \ "author").isEmpty) + + assertTrue( + (parsedxml2 \ "book") sameElements List( + Elem(null, "book", e, sc, + Elem(null, "author", e, sc, Text("Peter Buneman")), + Elem(null, "author", e, sc, Text("Dan Suciu")), + Elem(null, "title", e, sc, Text("Data on ze web"))), + Elem(null, "book", e, sc, + Elem(null, "author", e, sc, Text("John Mitchell")), + Elem(null, "title", e, sc, Text("Foundations of Programming Languages"))))) + + assertTrue( + (parsedxml2 \ "_" \ "_") sameElements List( + Elem(null, "author", e, sc, Text("Peter Buneman")), + Elem(null, "author", e, sc, Text("Dan Suciu")), + Elem(null, "title", e, sc, Text("Data on ze web")), + Elem(null, "author", e, sc, Text("John Mitchell")), + Elem(null, "title", e, sc, Text("Foundations of Programming Languages")))) + + assertTrue( + (parsedxml2 \ "_" \ "author") sameElements List( + Elem(null, "author", e, sc, Text("Peter Buneman")), + Elem(null, "author", e, sc, Text("Dan Suciu")), + Elem(null, "author", e, sc, Text("John Mitchell")))) + + assertTrue((parsedxml2 \ "_" \ "_" \ "author").isEmpty) + } + + @Test + def xpathDESCENDANTS = { + assertTrue( + (parsedxml2 \\ "author") sameElements List( + Elem(null, "author", e, sc, Text("Peter Buneman")), + Elem(null, "author", e, sc, Text("Dan Suciu")), + Elem(null, "author", e, sc, Text("John Mitchell")))) + + assertTrue( + (parsedxml2 \\ "title") sameElements List( + Elem(null, "title", e, sc, Text("Data on ze web")), + Elem(null, "title", e, sc, Text("Foundations of Programming Languages")))) + + assertEquals("Peter BunemanDan SuciuData on ze web", + (parsedxml2 \\ "book") { n: Node => (n \ "title") xml_== "Data on ze web" } toString) + + assertTrue( + ((new NodeSeq { val theSeq = List(parsedxml2) }) \\ "_") sameElements List( + Elem(null, "bib", e, sc, + Elem(null, "book", e, sc, + Elem(null, "author", e, sc, Text("Peter Buneman")), + Elem(null, "author", e, sc, Text("Dan Suciu")), + Elem(null, "title", e, sc, Text("Data on ze web"))), + Elem(null, "book", e, sc, + Elem(null, "author", e, sc, Text("John Mitchell")), + Elem(null, "title", e, sc, Text("Foundations of Programming Languages")))), + Elem(null, "book", e, sc, + Elem(null, "author", e, sc, Text("Peter Buneman")), + Elem(null, "author", e, sc, Text("Dan Suciu")), + Elem(null, "title", e, sc, Text("Data on ze web"))), + Elem(null, "author", e, sc, Text("Peter Buneman")), + Elem(null, "author", e, sc, Text("Dan Suciu")), + Elem(null, "title", e, sc, Text("Data on ze web")), + Elem(null, "book", e, sc, + Elem(null, "author", e, sc, Text("John Mitchell")), + Elem(null, "title", e, sc, Text("Foundations of Programming Languages"))), + Elem(null, "author", e, sc, Text("John Mitchell")), + Elem(null, "title", e, sc, Text("Foundations of Programming Languages")))) + } + + @Test + def groupNode = { + val zx1: Node = Group { } + val zy1: Node = { zx1 } + assertEquals("", zy1.toString) + + assertEquals("", + Group { List(, zy1, zx1) }.toString) + + val zz1 = + + assertTrue(zx1 xml_== zz1) + assertTrue(zz1.length == 3) + } + + @Test + def unparsed = { + // println("attribute value normalization") + val xmlAttrValueNorm = ""; + { + val isrcA = new InputSource(new StringReader(xmlAttrValueNorm)); + val parsedxmlA = XML.load(isrcA); + val c = (parsedxmlA \ "@nom").text.charAt(0); + assertTrue(c == '\u015e'); + } + // buraq: if the following test fails with 'character x not allowed', it is + // related to the mutable variable in a closures in MarkupParser.parsecharref + { + val isr = scala.io.Source.fromString(xmlAttrValueNorm); + val pxmlB = scala.xml.parsing.ConstructingParser.fromSource(isr, false); + val parsedxmlB = pxmlB.element(TopScope); + val c = (parsedxmlB \ "@nom").text.charAt(0); + assertTrue(c == '\u015e'); + } + + // #60 test by round trip + + val p = scala.xml.parsing.ConstructingParser.fromSource(scala.io.Source.fromString(""), true) + val n = p.element(new scala.xml.NamespaceBinding("bar", "BAR", scala.xml.TopScope))(0) + assertTrue(n.attributes.get("BAR", n, "attr").nonEmpty) + } + + @Test + def dodgyNamespace = { + val x = + assertTrue(x.toString.matches(".*xmlns:dog=\"http://dog.com\".*")); + } + + import NodeSeq.seqToNodeSeq + + val ax = + + + + val cx = + crazy text world + + + val bx = + + @Test + def XmlEx = { + assertTrue((ax \ "@foo") xml_== "bar") // uses NodeSeq.view! + assertTrue((ax \ "@foo") xml_== xml.Text("bar")) // dto. + assertTrue((bx \ "@foo") xml_== "bar&x") // dto. + assertTrue((bx \ "@foo") xml_sameElements List(xml.Text("bar&x"))) + assertTrue("" == bx.toString) + } + + @Test + def XmlEy { + val z = ax \ "@{the namespace from outer space}foo" + assertTrue((ax \ "@{the namespace from outer space}foo") xml_== "baz") + assertTrue((cx \ "@{the namespace from outer space}foo") xml_== "baz") + + try { + ax \ "@" + assertTrue(false) + } catch { + case _: IllegalArgumentException => + } + try { + ax \ "@{" + assertTrue(false) + } catch { + case _: IllegalArgumentException => + } + try { + ax \ "@{}" + assertTrue(false) + } catch { + case _: IllegalArgumentException => + } + + } + + @Test + def comment = + assertEquals("", toString) + + @Test + def weirdElem = + assertEquals("", toString) + + @Test + def escape = + assertEquals(""" + "Come, come again, whoever you are, come! +Heathen, fire worshipper or idolatrous, come! +Come even if you broke your penitence a hundred times, +Ours is the portal of hope, come as you are." + Mevlana Celaleddin Rumi""", toString) // this guy will escaped, and rightly so + + @Test + def unparsed2 = { + object myBreak extends scala.xml.Unparsed("
") + assertEquals("
", { myBreak } toString) // shows use of unparsed + } + + @Test + def justDontFail = { + match { + case scala.xml.QNode("gaga", "foo", md, child @ _*) => + } + + match { + case scala.xml.Node("foo", md, child @ _*) => } - assertFalse(vtor( )) - assertTrue( vtor( )) } } diff --git a/test/files/jvm/xml01.check b/test/files/jvm/xml01.check deleted file mode 100755 index d78e6df41..000000000 --- a/test/files/jvm/xml01.check +++ /dev/null @@ -1,8 +0,0 @@ -equality -xpath \ -xpath \\ DESCENDANTS -Peter BunemanDan SuciuData on ze web --- group nodes -
- -attribute value normalization diff --git a/test/files/jvm/xml01.scala b/test/files/jvm/xml01.scala deleted file mode 100644 index 2b456f5ff..000000000 --- a/test/files/jvm/xml01.scala +++ /dev/null @@ -1,182 +0,0 @@ -import java.io.StringReader -import org.xml.sax.InputSource - -import scala.xml._ - -object Test extends App { - def Elem(prefix: String, label: String, attributes: MetaData, scope: NamespaceBinding, child: Node*): Elem = - scala.xml.Elem.apply(prefix, label, attributes, scope, minimizeEmpty = true, child: _*) - val e: scala.xml.MetaData = Null //Node.NoAttributes - val sc: scala.xml.NamespaceBinding = TopScope - - val xmlFile1 = ""; - val isrc1 = new InputSource(new StringReader(xmlFile1)) - val parsedxml1 = XML.load(isrc1) - val isrc11 = new InputSource(new StringReader(xmlFile1)) - val parsedxml11 = XML.load(isrc11) - - val c = new Node { - def label = "hello" - override def hashCode() = - Utility.hashCode(prefix, label, attributes.hashCode(), scope.hashCode(), child); - def child = Elem(null, "world", e, sc); - //def attributes = e; - override def text = "" - } - - println("equality") - assert(c == parsedxml11) - assert(parsedxml1 == parsedxml11) - assert(List(parsedxml1) sameElements List(parsedxml11)) - assert(Array(parsedxml1).toList sameElements List(parsedxml11)) - - val x2 = "Peter BunemanDan SuciuData on ze web"; - - val i = new InputSource(new StringReader(x2)) - val x2p = XML.load(i) - - assert(x2p == Elem(null, "book" , e, sc, - Elem(null, "author", e, sc,Text("Peter Buneman")), - Elem(null, "author", e, sc,Text("Dan Suciu")), - Elem(null, "title" , e, sc,Text("Data on ze web")))) - - val xmlFile2 = "Peter BunemanDan SuciuData on ze webJohn MitchellFoundations of Programming Languages"; - val isrc2 = new InputSource(new StringReader(xmlFile2)) - val parsedxml2 = XML.load(isrc2) - - println("xpath \\") - - assert(parsedxml1 \ "_" sameElements List(Elem(null,"world", e, sc))) - - assert(parsedxml1 \ "world" sameElements List(Elem(null,"world", e, sc))) - - assert( - (parsedxml2 \ "_") sameElements List( - Elem(null,"book", e, sc, - Elem(null,"author", e, sc, Text("Peter Buneman")), - Elem(null,"author", e, sc, Text("Dan Suciu")), - Elem(null,"title" , e, sc, Text("Data on ze web"))), - Elem(null,"book",e,sc, - Elem(null,"author",e,sc,Text("John Mitchell")), - Elem(null,"title",e,sc,Text("Foundations of Programming Languages")))) - ) - assert((parsedxml2 \ "author").isEmpty) - - assert( - (parsedxml2 \ "book") sameElements List( - Elem(null,"book",e,sc, - Elem(null,"author", e, sc, Text("Peter Buneman")), - Elem(null,"author", e, sc, Text("Dan Suciu")), - Elem(null,"title" , e, sc, Text("Data on ze web"))), - Elem(null,"book",e,sc, - Elem(null,"author", e, sc, Text("John Mitchell")), - Elem(null,"title" , e, sc, Text("Foundations of Programming Languages"))) - ) - ) - - assert( - (parsedxml2 \ "_" \ "_") sameElements List( - Elem(null,"author", e, sc, Text("Peter Buneman")), - Elem(null,"author", e, sc, Text("Dan Suciu")), - Elem(null,"title" , e, sc, Text("Data on ze web")), - Elem(null,"author", e, sc, Text("John Mitchell")), - Elem(null,"title" , e, sc, Text("Foundations of Programming Languages")) - ) - ) - - assert( - (parsedxml2 \ "_" \ "author") sameElements List( - Elem(null,"author", e, sc, Text("Peter Buneman")), - Elem(null,"author", e, sc, Text("Dan Suciu")), - Elem(null,"author", e, sc, Text("John Mitchell")) - ) - ) - - assert((parsedxml2 \ "_" \ "_" \ "author").isEmpty) - - Console.println("xpath \\\\ DESCENDANTS"); - - assert( - (parsedxml2 \\ "author") sameElements List( - Elem(null,"author", e, sc, Text("Peter Buneman")), - Elem(null,"author", e, sc, Text("Dan Suciu")), - Elem(null,"author", e, sc, Text("John Mitchell")) - ) - ) - - assert( - (parsedxml2 \\ "title") sameElements List( - Elem(null,"title", e, sc, Text("Data on ze web")), - Elem(null,"title", e, sc, Text("Foundations of Programming Languages"))) - ) - - - println( - (parsedxml2 \\ "book" ){ n:Node => (n \ "title") xml_== "Data on ze web" } - ) - - assert( - ((new NodeSeq { val theSeq = List( parsedxml2 ) }) \\ "_") sameElements List( - Elem(null,"bib",e,sc, - Elem(null,"book",e,sc, - Elem(null, "author", e, sc, Text("Peter Buneman")), - Elem(null, "author", e, sc, Text("Dan Suciu")), - Elem(null, "title" , e, sc, Text("Data on ze web"))), - Elem(null,"book",e,sc, - Elem(null,"author",e,sc,Text("John Mitchell")), - Elem(null,"title",e,sc,Text("Foundations of Programming Languages")))), - Elem(null,"book",e,sc, - Elem(null,"author",e,sc,Text("Peter Buneman")), - Elem(null,"author",e,sc,Text("Dan Suciu")), - Elem(null,"title",e,sc,Text("Data on ze web"))), - Elem(null,"author",e,sc,Text("Peter Buneman")), - Elem(null,"author",e,sc,Text("Dan Suciu")), - Elem(null,"title",e,sc,Text("Data on ze web")), - Elem(null,"book",e,sc, - Elem(null,"author",e,sc,Text("John Mitchell")), - Elem(null,"title",e,sc,Text("Foundations of Programming Languages"))), - Elem(null,"author",e,sc,Text("John Mitchell")), - Elem(null,"title",e,sc,Text("Foundations of Programming Languages")) - ) - ) - - // test group node - Console println "-- group nodes" - val zx1: Node = Group { } - val zy1 = {zx1} - Console println zy1.toString() - - val zx2: Node = Group { List(,zy1,zx1) } - Console println zx2.toString() - - val zz1 = - - assert(zx1 xml_== zz1) - assert(zz1.length == 3) - - // unparsed - - println("attribute value normalization") - val xmlAttrValueNorm = ""; - { - val isrcA = new InputSource( new StringReader(xmlAttrValueNorm) ); - val parsedxmlA = XML.load(isrcA); - val c = (parsedxmlA \ "@nom").text.charAt(0); - assert(c == '\u015e'); - } - // buraq: if the following test fails with 'character x not allowed', it is - // related to the mutable variable in a closures in MarkupParser.parsecharref - { - val isr = scala.io.Source.fromString(xmlAttrValueNorm); - val pxmlB = scala.xml.parsing.ConstructingParser.fromSource(isr,false); - val parsedxmlB = pxmlB.element(TopScope); - val c = (parsedxmlB \ "@nom").text.charAt(0); - assert(c == '\u015e'); - } - - // #60 test by round trip - - val p = scala.xml.parsing.ConstructingParser.fromSource(scala.io.Source.fromString(""),true) - val n = p.element(new scala.xml.NamespaceBinding("bar","BAR",scala.xml.TopScope))(0) - assert( n.attributes.get("BAR", n, "attr").nonEmpty) -} diff --git a/test/files/jvm/xml02.check b/test/files/jvm/xml02.check deleted file mode 100644 index e69de29bb..000000000 diff --git a/test/files/jvm/xml02.scala b/test/files/jvm/xml02.scala deleted file mode 100644 index b830a0e69..000000000 --- a/test/files/jvm/xml02.scala +++ /dev/null @@ -1,78 +0,0 @@ -object Test { - - def main(args: Array[String]) { - XmlEx.run() - XmlEy.run() - XmlPat.run() - DodgyNamespace.run() - } - - import scala.xml.{NodeSeq, Utility} - import NodeSeq.seqToNodeSeq - - val ax = - - - - val cx = - crazy text world - - - val bx = - - object XmlEx { - - def run() { - assert((ax \ "@foo") xml_== "bar") // uses NodeSeq.view! - assert((ax \ "@foo") xml_== xml.Text("bar")) // dto. - assert((bx \ "@foo") xml_== "bar&x") // dto. - assert((bx \ "@foo") xml_sameElements List(xml.Text("bar&x"))) - assert("" == bx.toString) - } - } - - object XmlEy { - def run() { - val z = ax \ "@{the namespace from outer space}foo" - assert((ax \ "@{the namespace from outer space}foo") xml_== "baz") - assert((cx \ "@{the namespace from outer space}foo") xml_== "baz") - - try { - ax \ "@" - assert(false) - } catch { - case _: IllegalArgumentException => - } - try { - ax \ "@{" - assert(false) - } catch { - case _: IllegalArgumentException => - } - try { - ax \ "@{}" - assert(false) - } catch { - case _: IllegalArgumentException => - } - - } - } - - object XmlPat { - def run() { - assert( match { case => true; case _ => false; }) - assert( match { case => true; case _ => false; }); - assert(Utility.trim(cx) match { case n @ crazy text world if (n \ "@foo") xml_== "bar" => true; }) - assert(Utility.trim(cx) match { case n @ crazy text world if (n \ "@foo") xml_== "bar" => true; }) - } - } - - object DodgyNamespace { - def run() { - val x = - assert(x.toString.matches(".*xmlns:dog=\"http://dog.com\".*")); - } - } - -} diff --git a/test/files/jvm/xmlmore.check b/test/files/jvm/xmlmore.check deleted file mode 100644 index 29f144c89..000000000 --- a/test/files/jvm/xmlmore.check +++ /dev/null @@ -1,10 +0,0 @@ - - - - "Come, come again, whoever you are, come! -Heathen, fire worshipper or idolatrous, come! -Come even if you broke your penitence a hundred times, -Ours is the portal of hope, come as you are." - Mevlana Celaleddin Rumi -
-End Test diff --git a/test/files/jvm/xmlmore.scala b/test/files/jvm/xmlmore.scala deleted file mode 100644 index 04d0a6c75..000000000 --- a/test/files/jvm/xmlmore.scala +++ /dev/null @@ -1,29 +0,0 @@ -object myBreak extends scala.xml.Unparsed("
") - -object Test extends App { - val com = - val pi = - val crz = - - val nazim = {myBreak} // shows use of unparsed - - Console println com - Console println pi - Console println crz // this guy will escaped, and rightly so - Console println nazim - Console println "End Test" - - match { - case scala.xml.QNode("gaga","foo",md,child@_*) => - } - - match { - case scala.xml.Node("foo",md,child@_*) => - } - -} From 87e698367c586d0719ac15dabf493b3a73d3ea69 Mon Sep 17 00:00:00 2001 From: Adriaan Moors Date: Wed, 13 Nov 2013 23:03:39 -0800 Subject: [PATCH 027/789] Transformers --- src/test/scala/scala/xml/Transformers.scala | 59 +++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 src/test/scala/scala/xml/Transformers.scala diff --git a/src/test/scala/scala/xml/Transformers.scala b/src/test/scala/scala/xml/Transformers.scala new file mode 100644 index 000000000..575883254 --- /dev/null +++ b/src/test/scala/scala/xml/Transformers.scala @@ -0,0 +1,59 @@ +package scala.xml + +import scala.xml.transform._ + +import org.junit.Test +import org.junit.Assert.assertTrue +import org.junit.Assert.assertEquals + +class Transformers { + + + def transformer = new RuleTransformer(new RewriteRule { + override def transform(n: Node): NodeSeq = n match { + case { _* } => + case n => n + } + }) + + @Test + def transform = // SI-2124 + assertEquals(transformer.transform(

), +

) + + @Test + def transformNamespaced = // SI-2125 + assertEquals(transformer.transform(

), + Group(

)) + + @Test + def rewriteRule = { // SI-2276 + val inputXml: Node = + + + 1 + + + 1 + + + + object t1 extends RewriteRule { + override def transform(n: Node): Seq[Node] = n match { + case { x } if x.toString.toInt < 4 => { x.toString.toInt + 1 } + case other => other + } + } + + val ruleTransformer = new RuleTransformer(t1) + JUnitAssertsForXML.assertEquals(ruleTransformer(inputXml).toString, // TODO: why do we need toString? + + + 2 + + + 2 + + ) + } +} \ No newline at end of file From 0309c87edd5d9c9e02e6fc3467f2c9e009ee8835 Mon Sep 17 00:00:00 2001 From: Adriaan Moors Date: Wed, 13 Nov 2013 23:03:52 -0800 Subject: [PATCH 028/789] ShouldCompile --- src/test/scala/scala/xml/ShouldCompile.scala | 95 ++++++++++++++++++++ 1 file changed, 95 insertions(+) create mode 100644 src/test/scala/scala/xml/ShouldCompile.scala diff --git a/src/test/scala/scala/xml/ShouldCompile.scala b/src/test/scala/scala/xml/ShouldCompile.scala new file mode 100644 index 000000000..0314ff1ce --- /dev/null +++ b/src/test/scala/scala/xml/ShouldCompile.scala @@ -0,0 +1,95 @@ +package scala.xml + +// these tests depend on xml, so they ended up here, +// though really they are compiler tests + +import scala.collection._ +import scala.collection.mutable.ArrayBuffer + +// t1626 +object o { + val n =
+ n.namespace == null +} + +// t1761 +class Foo { + val elements: Seq[Node] = Nil + val innerTransform: PartialFunction[Elem, String] = { + case Elem(_, l: String, _, _, _@ _*) if elements.exists(_.label == l) => + l + } +} + +// t2281 +class A { + def f(x: Boolean) = if (x)

else
+} + +class B { + def splitSentences(text: String): ArrayBuffer[String] = { + val outarr = new ArrayBuffer[String] + var outstr = new StringBuffer + var prevspace = false + val ctext = text.replaceAll("\n+", "\n") + ctext foreach { c => + outstr append c + if (c == '.' || c == '!' || c == '?' || c == '\n' || c == ':' || c == ';' || (prevspace && c == '-')) { + outarr += outstr.toString + outstr = new StringBuffer + } + if (c == '\n') { + outarr += "\n\n" + } + prevspace = c == ' ' + } + if (outstr.length > 0) { + outarr += outstr.toString + } + outarr + } + + def spanForSentence(x: String, picktext: String) = + if (x == "\n\n") { +

+ } else { + { x } + } + + def selectableSentences(text: String, picktext: String) = { + val sentences = splitSentences(text) + sentences.map(x => spanForSentence(x, picktext)) + } +} + +// SI-5858 +object Test { + new Elem(null, null, Null, TopScope, Nil: _*) // was ambiguous +} + +class Floozy { + def fooz(x: Node => String) = {} + def foo(m: Node): Unit = fooz { + case Elem(_, _, _, _, n, _*) if (n == m) => "gaga" + } +} + +object guardedMatch { // SI-3705 + // guard caused verifyerror in oldpatmat -- TODO: move this to compiler test suite + def updateNodes(ns: Seq[Node]): Seq[Node] = + for (subnode <- ns) yield subnode match { + case { _ } if true => abc + case Elem(prefix, label, attribs, scope, children @ _*) => + Elem(prefix, label, attribs, scope, minimizeEmpty = true, updateNodes(children): _*) + case other => other + } + updateNodes() +} + +// SI-6897 +object shouldCompile { + val html = (null: Any) match { + case 1 => + case 2 =>

+ } +} \ No newline at end of file From 4c4aaaac7521f24b545ad3061410f464f8c2b8d3 Mon Sep 17 00:00:00 2001 From: Adriaan Moors Date: Wed, 13 Nov 2013 23:04:46 -0800 Subject: [PATCH 029/789] Removed pos/run test Most of the pos tests were incorporated in the ShouldCompile 'unit test'. The others are going back to scala/scala. I was a bit overzealous in moving stuff over to scala-xml in scala/scala#9c50dd5. These were all compiler tests that accidentally touched on xml. I've tried to delicately decouple them so they can roam the scalac pastures as intended. --- test/files/pos/matchStarlift.scala | 7 -- test/files/pos/t0422.scala | 16 ----- test/files/pos/t0646.scala | 21 ------ test/files/pos/t1014.scala | 15 ----- test/files/pos/t1059.scala | 28 -------- test/files/pos/t1203a.scala | 7 -- test/files/pos/t1626.scala | 4 -- test/files/pos/t1761.scala | 10 --- test/files/pos/t2281.scala | 41 ------------ test/files/pos/t2698.scala | 11 ---- test/files/pos/t3160.scala | 6 -- test/files/pos/t5858.scala | 3 - test/files/pos/t6201.scala | 13 ---- test/files/pos/t6897.scala | 6 -- test/files/pos/t715/meredith_1.scala | 98 ---------------------------- test/files/pos/t715/runner_2.scala | 3 - test/files/pos/t880.scala | 6 -- test/files/run/fors.check | 46 ------------- test/files/run/fors.scala | 97 --------------------------- test/files/run/repl-backticks.check | 2 - test/files/run/repl-backticks.scala | 18 ----- test/files/run/t1500.check | 3 - test/files/run/t1500.scala | 46 ------------- test/files/run/t1501.check | 3 - test/files/run/t1501.scala | 56 ---------------- test/files/run/t3705.scala | 17 ----- test/files/run/t4124.check | 4 -- test/files/run/t4124.scala | 24 ------- 28 files changed, 611 deletions(-) delete mode 100644 test/files/pos/matchStarlift.scala delete mode 100644 test/files/pos/t0422.scala delete mode 100644 test/files/pos/t0646.scala delete mode 100644 test/files/pos/t1014.scala delete mode 100644 test/files/pos/t1059.scala delete mode 100644 test/files/pos/t1203a.scala delete mode 100644 test/files/pos/t1626.scala delete mode 100644 test/files/pos/t1761.scala delete mode 100644 test/files/pos/t2281.scala delete mode 100644 test/files/pos/t2698.scala delete mode 100644 test/files/pos/t3160.scala delete mode 100644 test/files/pos/t5858.scala delete mode 100644 test/files/pos/t6201.scala delete mode 100644 test/files/pos/t6897.scala delete mode 100644 test/files/pos/t715/meredith_1.scala delete mode 100644 test/files/pos/t715/runner_2.scala delete mode 100644 test/files/pos/t880.scala delete mode 100644 test/files/run/fors.check delete mode 100644 test/files/run/fors.scala delete mode 100644 test/files/run/repl-backticks.check delete mode 100644 test/files/run/repl-backticks.scala delete mode 100644 test/files/run/t1500.check delete mode 100644 test/files/run/t1500.scala delete mode 100644 test/files/run/t1501.check delete mode 100644 test/files/run/t1501.scala delete mode 100644 test/files/run/t3705.scala delete mode 100644 test/files/run/t4124.check delete mode 100644 test/files/run/t4124.scala diff --git a/test/files/pos/matchStarlift.scala b/test/files/pos/matchStarlift.scala deleted file mode 100644 index dab46eada..000000000 --- a/test/files/pos/matchStarlift.scala +++ /dev/null @@ -1,7 +0,0 @@ -object Tet { - import scala.xml._; - def fooz(x: Node=>String) = {} - def foo( m:Node ):Unit = fooz { - case Elem(_,_,_,_,n,_*) if (n == m) => "gaga" - } -} diff --git a/test/files/pos/t0422.scala b/test/files/pos/t0422.scala deleted file mode 100644 index 2adfa392d..000000000 --- a/test/files/pos/t0422.scala +++ /dev/null @@ -1,16 +0,0 @@ -package scala.xml.dtd.impl - -object BoolWordExp extends WordExp { - type _labelT = MyLabels; - type _regexpT = RegExp; - abstract class MyLabels extends Label ; - case class MyLabel(c:Char) extends MyLabels; -} - -object MyTranslator extends WordBerrySethi { - override val lang = BoolWordExp; - import lang._; - override protected def seenLabel( r:RegExp, i:Int, label: _labelT ): Unit = { - super.seenLabel(r,i,label) - } -} diff --git a/test/files/pos/t0646.scala b/test/files/pos/t0646.scala deleted file mode 100644 index 6146e6002..000000000 --- a/test/files/pos/t0646.scala +++ /dev/null @@ -1,21 +0,0 @@ -object xfor { - - import scala.xml.NodeSeq - - val books = - - Blabla - Blubabla - Baaaaaaalabla - ; - - new NodeSeq { val theSeq = books.child } match { - case t @ Seq(Blabla) => t - } - - //val n: NodeSeq = new NodeSeq { val theSeq = books.child } - //n match { - // case t @ Blabla => t - //} - -} diff --git a/test/files/pos/t1014.scala b/test/files/pos/t1014.scala deleted file mode 100644 index 3fc10d10d..000000000 --- a/test/files/pos/t1014.scala +++ /dev/null @@ -1,15 +0,0 @@ -import scala.xml.{NodeSeq, Elem} - -class EO extends App with Moo { - // return type is Flog, inherited from overridden method. - // implicit conversions are applied because expected type `pt` is `Flog` when `computeType(rhs, pt)`. - def cat = dog - - implicit def nodeSeqToFlog(in: Elem): Flog = new Flog(in) -} - -trait Moo { - def cat: Flog -} - -class Flog(val in: NodeSeq) diff --git a/test/files/pos/t1059.scala b/test/files/pos/t1059.scala deleted file mode 100644 index bcd8f0374..000000000 --- a/test/files/pos/t1059.scala +++ /dev/null @@ -1,28 +0,0 @@ -package com; - -import scala.xml._ - -object Main { - - def main(args : Array[String]) : Unit = { - - var m : PartialFunction[Any, Any] = { - - case SafeNodeSeq(s @ _*) => println(s) } - - println(m(
++ )) - println(m.isDefinedAt( ++ )) - - } - -} - -object SafeNodeSeq { - - def unapplySeq(any: Any) : Option[Seq[Node]] = any match { case s: Seq[_] => Some(s flatMap ( _ match { - - case n: Node => n case _ => NodeSeq.Empty - - })) case _ => None } - -} diff --git a/test/files/pos/t1203a.scala b/test/files/pos/t1203a.scala deleted file mode 100644 index 062ef93fc..000000000 --- a/test/files/pos/t1203a.scala +++ /dev/null @@ -1,7 +0,0 @@ -case class ant(t: String) extends scala.annotation.Annotation -object Test { - def main(args: Array[String]): Unit = { - val a: scala.xml.NodeSeq @ant("12") = Nil - println(a) - } -} diff --git a/test/files/pos/t1626.scala b/test/files/pos/t1626.scala deleted file mode 100644 index 200be4743..000000000 --- a/test/files/pos/t1626.scala +++ /dev/null @@ -1,4 +0,0 @@ -object o { - val n = - n.namespace == null -} diff --git a/test/files/pos/t1761.scala b/test/files/pos/t1761.scala deleted file mode 100644 index 2af728073..000000000 --- a/test/files/pos/t1761.scala +++ /dev/null @@ -1,10 +0,0 @@ -import scala.xml._ - -class Foo { - val elements: Seq[Node] = Nil - val innerTransform: PartialFunction[Elem, String] = { - case Elem(_, l: String, _, _, _ @ _*) if elements.exists(_.label == l) => - l - } -} - diff --git a/test/files/pos/t2281.scala b/test/files/pos/t2281.scala deleted file mode 100644 index 3515d2e2e..000000000 --- a/test/files/pos/t2281.scala +++ /dev/null @@ -1,41 +0,0 @@ -import scala.collection.mutable.ArrayBuffer - -class A { - def f(x: Boolean) = if (x)

else
-} - -class B { - def splitSentences(text : String) : ArrayBuffer[String] = { - val outarr = new ArrayBuffer[String] - var outstr = new StringBuffer - var prevspace = false - val ctext = text.replaceAll("\n+","\n") - ctext foreach {c => - outstr append c - if(c == '.' || c == '!' || c == '?' || c == '\n' || c == ':' || c == ';' || (prevspace && c == '-') ){ - outarr += outstr.toString - outstr = new StringBuffer - } - if(c == '\n'){ - outarr += "\n\n" - } - prevspace = c == ' ' - } - if(outstr.length > 0){ - outarr += outstr.toString - } - outarr - } - - def spanForSentence(x : String,picktext : String) = - if(x == "\n\n"){ -

- }else{ - {x} - } - - def selectableSentences(text : String, picktext : String) = { - val sentences = splitSentences(text) - sentences.map(x => spanForSentence(x,picktext)) - } -} \ No newline at end of file diff --git a/test/files/pos/t2698.scala b/test/files/pos/t2698.scala deleted file mode 100644 index 7de50a13d..000000000 --- a/test/files/pos/t2698.scala +++ /dev/null @@ -1,11 +0,0 @@ -package scala.xml.dtd.impl - -import scala.collection._ - -abstract class S2 { - val lang: WordExp - type __labelT = lang._labelT - - var deltaq: Array[__labelT] = _ - def delta1 = immutable.Map(deltaq.zipWithIndex: _*) -} diff --git a/test/files/pos/t3160.scala b/test/files/pos/t3160.scala deleted file mode 100644 index 3309ece16..000000000 --- a/test/files/pos/t3160.scala +++ /dev/null @@ -1,6 +0,0 @@ -import scala.collection.mutable._ -import scala.xml._ - -class A { - def f(x: Node): Node = ??? -} diff --git a/test/files/pos/t5858.scala b/test/files/pos/t5858.scala deleted file mode 100644 index f2b0f58d7..000000000 --- a/test/files/pos/t5858.scala +++ /dev/null @@ -1,3 +0,0 @@ -object Test { - new xml.Elem(null, null, xml.Null, xml.TopScope, Nil: _*) // was ambiguous -} diff --git a/test/files/pos/t6201.scala b/test/files/pos/t6201.scala deleted file mode 100644 index 366c1f26e..000000000 --- a/test/files/pos/t6201.scala +++ /dev/null @@ -1,13 +0,0 @@ -class Test { - class Foo1 { - def must(x: scala.xml.Elem) = () - } - - class Foo2 { - def must(x: Int) = () - } - implicit def toFoo1(s: scala.xml.Elem) = new Foo1() - implicit def toFoo2(s: scala.xml.Elem) = new Foo2() - - def is: Unit = { (
{"a"}).must({"b"}) } -} \ No newline at end of file diff --git a/test/files/pos/t6897.scala b/test/files/pos/t6897.scala deleted file mode 100644 index a7a03a1d3..000000000 --- a/test/files/pos/t6897.scala +++ /dev/null @@ -1,6 +0,0 @@ -class A { - val html = (null: Any) match { - case 1 => - case 2 =>

- } -} diff --git a/test/files/pos/t715/meredith_1.scala b/test/files/pos/t715/meredith_1.scala deleted file mode 100644 index c28afb4a9..000000000 --- a/test/files/pos/t715/meredith_1.scala +++ /dev/null @@ -1,98 +0,0 @@ -package com.sap.dspace.model.othello; - -import scala.xml._ - -trait XMLRenderer { - type T <: Any {def getClass(): java.lang.Class[_]} - val valueTypes = - List( - classOf[java.lang.Boolean], - classOf[java.lang.Integer], - classOf[java.lang.Float], - classOf[java.lang.String] - // more to come - ) - - def value2XML( - value: Object, - field: java.lang.reflect.Field, - pojo: T - ): Node = { - value match { - case null => Text("null") - case vUnmatched => - if (value.isInstanceOf[java.lang.Boolean]) - Text(value.asInstanceOf[java.lang.Boolean].toString) - else if (value.isInstanceOf[java.lang.Integer]) - Text(value.asInstanceOf[java.lang.Integer].toString) - else if (value.isInstanceOf[java.lang.Float]) - Text(value.asInstanceOf[java.lang.Float].toString) - // else if (value.isInstanceOf[T]) - // pojo2XML(value.asInstanceOf[T]) - else - - - {vUnmatched.getClass.toString} - - - {vUnmatched.toString} - - - } - } - - def field2XML( - field: java.lang.reflect.Field, - pojo: T - ): Elem = { - - val accessible = field.isAccessible - field.setAccessible(true) - // BUGBUG lgm need to disambiguate on type and possibly make - // recursive call to pojo2XML - val fldValXML = value2XML(field.get( pojo ), field, pojo) - field.setAccessible( accessible ) - - Elem( - null, - field.getName, - null, - TopScope, - fldValXML - ) - } - - def pojo2XML(pojo: T): Elem = { - val progeny = - for (field <- pojo.getClass.getDeclaredFields) - yield field2XML(field, pojo) - - Elem( - null, - pojo.getClass.getName, - null, - TopScope, - progeny.asInstanceOf[Array[scala.xml.Node]]: _* - ) - } -} - -case class POJO2XMLRenderer(recurse: Boolean) - extends XMLRenderer { - type T = java.io.Serializable - override def value2XML( - value: Object, - field: java.lang.reflect.Field, - pojo: java.io.Serializable - ): Node = { - if (recurse) super.value2XML(value, field, pojo) - else Text(value + "") - } -} - -object thePOJO2XMLRenderer extends POJO2XMLRenderer(true) { -} - -object Test extends App { - println(com.sap.dspace.model.othello.thePOJO2XMLRenderer) -} diff --git a/test/files/pos/t715/runner_2.scala b/test/files/pos/t715/runner_2.scala deleted file mode 100644 index d54805629..000000000 --- a/test/files/pos/t715/runner_2.scala +++ /dev/null @@ -1,3 +0,0 @@ -object Test extends App { - println(com.sap.dspace.model.othello.thePOJO2XMLRenderer) -} diff --git a/test/files/pos/t880.scala b/test/files/pos/t880.scala deleted file mode 100644 index cceb53c39..000000000 --- a/test/files/pos/t880.scala +++ /dev/null @@ -1,6 +0,0 @@ -import scala.xml.Null - -class Test[A >: Null] -{ - val x : A = null -} diff --git a/test/files/run/fors.check b/test/files/run/fors.check deleted file mode 100644 index 08ecc8ed5..000000000 --- a/test/files/run/fors.check +++ /dev/null @@ -1,46 +0,0 @@ - -testOld -1 2 3 -2 -2 -3 -1 2 3 -1 2 3 -0 1 2 3 4 5 6 7 8 9 -0 2 4 6 8 -0 2 4 6 8 -a b c -b c -b c - - -Scala - - -1 2 3 - - -Scala - -testNew -3 -1 2 3 -1 2 3 -0 1 2 3 4 5 6 7 8 9 -0 2 4 6 8 -0 2 4 6 8 -0 2 4 6 8 -0 2 4 6 8 -0 2 4 6 8 -0 2 4 6 8 -0 2 4 6 8 -a b c - - -Scala - - -1 2 3 - - -Scala diff --git a/test/files/run/fors.scala b/test/files/run/fors.scala deleted file mode 100644 index 54afdc710..000000000 --- a/test/files/run/fors.scala +++ /dev/null @@ -1,97 +0,0 @@ -//############################################################################ -// for-comprehensions (old and new syntax) -//############################################################################ - -//############################################################################ - -object Test extends App { - val xs = List(1, 2, 3) - val ys = List('a, 'b, 'c) - - def it = 0 until 10 - - val ar = "abc".toCharArray - - val xml = - - Scala - {xs} - ; - - /////////////////// old syntax /////////////////// - - def testOld { - println("\ntestOld") - - // lists - for (x <- xs) print(x + " "); println - for (x <- xs; - if x % 2 == 0) print(x + " "); println - for {x <- xs - if x % 2 == 0} print(x + " "); println - var n = 0 - for (_ <- xs) n += 1; println(n) - for ((x, y) <- xs zip ys) print(x + " "); println - for (p @ (x, y) <- xs zip ys) print(p._1 + " "); println - - // iterators - for (x <- it) print(x + " "); println - for (x <- it; - if x % 2 == 0) print(x + " "); println - for {x <- it - if x % 2 == 0} print(x + " "); println - - // arrays - for (x <- ar) print(x + " "); println - for (x <- ar; - if x.toInt > 97) print(x + " "); println - for {x <- ar - if x.toInt > 97} print(x + " "); println - - // sequences - for (x <- xml.child) println(x) - for (x <- xml.child; - if x.label == "head") println(x) - } - - /////////////////// new syntax /////////////////// - - def testNew { - println("\ntestNew") - - // lists - var n = 0 - for (_ <- xs) n += 1; println(n) - for ((x, y) <- xs zip ys) print(x + " "); println - for (p @ (x, y) <- xs zip ys) print(p._1 + " "); println - - // iterators - for (x <- it) print(x + " "); println - for (x <- it if x % 2 == 0) print(x + " "); println - for (x <- it; if x % 2 == 0) print(x + " "); println - for (x <- it; - if x % 2 == 0) print(x + " "); println - for (x <- it - if x % 2 == 0) print(x + " "); println - for {x <- it - if x % 2 == 0} print(x + " "); println - for (x <- it; - y = 2 - if x % y == 0) print(x + " "); println - for {x <- it - y = 2 - if x % y == 0} print(x + " "); println - - // arrays - for (x <- ar) print(x + " "); println - - // sequences - for (x <- xml.child) println(x) - for (x <- xml.child if x.label == "head") println(x) - } - - //////////////////////////////////////////////////// - - testOld - testNew -} diff --git a/test/files/run/repl-backticks.check b/test/files/run/repl-backticks.check deleted file mode 100644 index c0561abd7..000000000 --- a/test/files/run/repl-backticks.check +++ /dev/null @@ -1,2 +0,0 @@ -import java.lang.Thread.`yield` -import scala.`package`.Throwable diff --git a/test/files/run/repl-backticks.scala b/test/files/run/repl-backticks.scala deleted file mode 100644 index ec2691d9c..000000000 --- a/test/files/run/repl-backticks.scala +++ /dev/null @@ -1,18 +0,0 @@ -import scala.tools.nsc._ - -object Test { - val testCode = - import java.lang.Thread.`yield` - import scala.`package`.Throwable - - `yield` - .text - - def main(args: Array[String]) { - val settings = new Settings() - settings.classpath.value = System.getProperty("java.class.path") - val repl = new interpreter.IMain(settings) - repl.interpret(testCode) - } -} - diff --git a/test/files/run/t1500.check b/test/files/run/t1500.check deleted file mode 100644 index 94a169333..000000000 --- a/test/files/run/t1500.check +++ /dev/null @@ -1,3 +0,0 @@ -defined class posingAs -resolve: [A, B](x: A @posingAs[B])B -x: Any = 7 diff --git a/test/files/run/t1500.scala b/test/files/run/t1500.scala deleted file mode 100644 index 75a6e31cd..000000000 --- a/test/files/run/t1500.scala +++ /dev/null @@ -1,46 +0,0 @@ -import scala.tools.nsc._ - -object Test { - - /** - * Type inference overlooks constraints posed by type parameters in annotations on types. - */ - - val testCode = - - class posingAs[A] extends annotation.TypeConstraint - - def resolve[A,B](x: A @posingAs[B]): B = x.asInstanceOf[B] - - val x = resolve(7: @posingAs[Any]) - - .text - - def main(args: Array[String]) { - - val settings = new Settings() - settings.classpath.value = System.getProperty("java.class.path") - val tool = new interpreter.IMain(settings) - val global = tool.global - - import global._ - import definitions._ - - object checker extends AnnotationChecker { - - /** Check annotations to decide whether tpe1 <:< tpe2 */ - def annotationsConform(tpe1: Type, tpe2: Type): Boolean = { - - tpe1.annotations.forall(a1 => tpe2.annotations.forall(a2 => a1.atp <:< a2.atp)) - - } - } - - global.addAnnotationChecker(checker) - - tool.interpret(testCode) - - } - -} - diff --git a/test/files/run/t1501.check b/test/files/run/t1501.check deleted file mode 100644 index f0fa9112a..000000000 --- a/test/files/run/t1501.check +++ /dev/null @@ -1,3 +0,0 @@ -defined class xyz -loopWhile: [T](cond: => Boolean)(body: => Unit @xyz[T])Unit @xyz[T] -test: ()Unit @xyz[Int] diff --git a/test/files/run/t1501.scala b/test/files/run/t1501.scala deleted file mode 100644 index 71ad0aeb5..000000000 --- a/test/files/run/t1501.scala +++ /dev/null @@ -1,56 +0,0 @@ -import scala.tools.nsc._ - -object Test { - - /** - * ... - */ - - val testCode = - - class xyz[A] extends annotation.TypeConstraint - - def loopWhile[T](cond: =>Boolean)(body: =>(Unit @xyz[T])): Unit @ xyz[T] = {{ - if (cond) {{ - body - loopWhile[T](cond)(body) - }} - }} - - def test() = {{ - var x = 7 - loopWhile(x != 0) {{ - x = x - 1 - (): @xyz[Int] - }} - }} - - .text - - def main(args: Array[String]) { - val settings = new Settings() - settings.classpath.value = System.getProperty("java.class.path") - val tool = new interpreter.IMain(settings) - val global = tool.global - - import global._ - import definitions._ - - object checker extends AnnotationChecker { - - /** Check annotations to decide whether tpe1 <:< tpe2 */ - def annotationsConform(tpe1: Type, tpe2: Type): Boolean = { - - tpe1.annotations.forall(a1 => tpe2.annotations.forall(a2 => a1.atp <:< a2.atp)) - - } - } - - global.addAnnotationChecker(checker) - - tool.interpret(testCode) - - } - -} - diff --git a/test/files/run/t3705.scala b/test/files/run/t3705.scala deleted file mode 100644 index 3ebf6fc95..000000000 --- a/test/files/run/t3705.scala +++ /dev/null @@ -1,17 +0,0 @@ -// package foo - -import scala.xml._ -object Test { - // guard caused verifyerror in oldpatmat - def updateNodes(ns: Seq[Node]): Seq[Node] = - for(subnode <- ns) yield subnode match { - case {_} if true => abc - case Elem(prefix, label, attribs, scope, children @ _*) => - Elem(prefix, label, attribs, scope, minimizeEmpty = true, updateNodes(children) : _*) - case other => other - } - def main(args: Array[String]): Unit = { - updateNodes() - } -} - diff --git a/test/files/run/t4124.check b/test/files/run/t4124.check deleted file mode 100644 index 66a0092d9..000000000 --- a/test/files/run/t4124.check +++ /dev/null @@ -1,4 +0,0 @@ -hi -hi -bye -bye diff --git a/test/files/run/t4124.scala b/test/files/run/t4124.scala deleted file mode 100644 index 9f35b57ce..000000000 --- a/test/files/run/t4124.scala +++ /dev/null @@ -1,24 +0,0 @@ -import xml.Node - -object Test extends App { - val body: Node = hi - println ((body: AnyRef, "foo") match { - case (node: Node, "bar") => "bye" - case (ser: Serializable, "foo") => "hi" - }) - - println ((body, "foo") match { - case (node: Node, "bar") => "bye" - case (ser: Serializable, "foo") => "hi" - }) - - println ((body: AnyRef, "foo") match { - case (node: Node, "foo") => "bye" - case (ser: Serializable, "foo") => "hi" - }) - - println ((body: AnyRef, "foo") match { - case (node: Node, "foo") => "bye" - case (ser: Serializable, "foo") => "hi" - }) -} From 4670d6696e131b1b6a070d70a2dd8c0b29ff496c Mon Sep 17 00:00:00 2001 From: Adriaan Moors Date: Thu, 14 Nov 2013 00:02:33 -0800 Subject: [PATCH 030/789] Converted the last of the run tests. --- src/test/scala/scala/xml/XMLTest.scala | 404 +++++++++++++++++++++++-- test/files/run/io-position.check | Bin 126 -> 0 bytes test/files/run/io-position.scala | 11 - test/files/run/nodebuffer-array.check | 3 - test/files/run/nodebuffer-array.scala | 15 - test/files/run/serialize.check | 54 ---- test/files/run/serialize.scala | 98 ------ test/files/run/t0486.check | 8 - test/files/run/t0486.scala | 24 -- test/files/run/t0663.check | 1 - test/files/run/t0663.scala | 6 - test/files/run/t1079.check | 1 - test/files/run/t1079.scala | 3 - test/files/run/t1620.check | 6 - test/files/run/t1620.scala | 16 - test/files/run/t1773.scala | 12 - test/files/run/t2124.check | 1 - test/files/run/t2124.scala | 25 -- test/files/run/t2125.check | 1 - test/files/run/t2125.scala | 25 -- test/files/run/t2276.check | 8 - test/files/run/t2276.scala | 24 -- test/files/run/t2354.scala | 17 -- test/files/run/t2721.check | 2 - test/files/run/t2721.scala | 12 - test/files/run/t3886.scala | 11 - test/files/run/t4387.scala | 12 - test/files/run/t5052.scala | 6 - test/files/run/t5115.scala | 14 - test/files/run/t5843.check | 9 - test/files/run/t5843.scala | 15 - test/files/run/t6939.scala | 13 - test/files/run/t7074.check | 9 - test/files/run/t7074.scala | 15 - test/files/run/xml-attribute.check | 12 - test/files/run/xml-attribute.scala | 37 --- test/files/run/xml-loop-bug.scala | 14 - 37 files changed, 382 insertions(+), 562 deletions(-) delete mode 100644 test/files/run/io-position.check delete mode 100644 test/files/run/io-position.scala delete mode 100644 test/files/run/nodebuffer-array.check delete mode 100644 test/files/run/nodebuffer-array.scala delete mode 100644 test/files/run/serialize.check delete mode 100644 test/files/run/serialize.scala delete mode 100644 test/files/run/t0486.check delete mode 100644 test/files/run/t0486.scala delete mode 100755 test/files/run/t0663.check delete mode 100644 test/files/run/t0663.scala delete mode 100644 test/files/run/t1079.check delete mode 100644 test/files/run/t1079.scala delete mode 100755 test/files/run/t1620.check delete mode 100644 test/files/run/t1620.scala delete mode 100644 test/files/run/t1773.scala delete mode 100755 test/files/run/t2124.check delete mode 100644 test/files/run/t2124.scala delete mode 100755 test/files/run/t2125.check delete mode 100644 test/files/run/t2125.scala delete mode 100644 test/files/run/t2276.check delete mode 100644 test/files/run/t2276.scala delete mode 100644 test/files/run/t2354.scala delete mode 100644 test/files/run/t2721.check delete mode 100644 test/files/run/t2721.scala delete mode 100644 test/files/run/t3886.scala delete mode 100644 test/files/run/t4387.scala delete mode 100644 test/files/run/t5052.scala delete mode 100644 test/files/run/t5115.scala delete mode 100644 test/files/run/t5843.check delete mode 100644 test/files/run/t5843.scala delete mode 100644 test/files/run/t6939.scala delete mode 100644 test/files/run/t7074.check delete mode 100644 test/files/run/t7074.scala delete mode 100644 test/files/run/xml-attribute.check delete mode 100644 test/files/run/xml-attribute.scala delete mode 100644 test/files/run/xml-loop-bug.scala diff --git a/src/test/scala/scala/xml/XMLTest.scala b/src/test/scala/scala/xml/XMLTest.scala index c3bc1ca4d..ae54f6da4 100644 --- a/src/test/scala/scala/xml/XMLTest.scala +++ b/src/test/scala/scala/xml/XMLTest.scala @@ -1,12 +1,19 @@ package scala.xml -import org.junit.Test +import org.junit.{Test => UnitTest} import org.junit.Ignore import org.junit.runner.RunWith import org.junit.runners.JUnit4 import org.junit.Assert.assertTrue import org.junit.Assert.assertFalse import org.junit.Assert.assertEquals +import scala.xml.parsing.ConstructingParser +import java.io.StringWriter +import java.io.BufferedOutputStream +import java.io.ByteArrayOutputStream +import java.io.StringReader +import scala.collection.Iterable +import scala.xml.Utility.sort object XMLTest { val e: scala.xml.MetaData = Null //Node.NoAttributes @@ -16,7 +23,7 @@ object XMLTest { class XMLTest { import XMLTest.{ e, sc } - @Test + @UnitTest def nodeSeq: Unit = { val p = @@ -33,7 +40,7 @@ class XMLTest { assertTrue(Text("8") sameElements (p \\ "@bazValue")) } - @Test + @UnitTest def queryBooks: Unit = { val books = @@ -93,7 +100,7 @@ class XMLTest { } - @Test + @UnitTest def queryPhoneBook: Unit = { val phoneBook = @@ -143,7 +150,7 @@ class XMLTest { assertEquals(expected, actual) } - @Test + @UnitTest def namespaces: Unit = { val cuckoo = @@ -155,7 +162,7 @@ class XMLTest { } } - @Test + @UnitTest def validationOfElements: Unit = { val vtor = new scala.xml.dtd.ElementValidator(); { @@ -206,9 +213,6 @@ class XMLTest { assertTrue(vtor()) } - import java.io.StringReader - import org.xml.sax.InputSource - def Elem(prefix: String, label: String, attributes: MetaData, scope: NamespaceBinding, child: Node*): Elem = scala.xml.Elem.apply(prefix, label, attributes, scope, minimizeEmpty = true, child: _*) @@ -217,7 +221,7 @@ class XMLTest { val xmlFile2 = "Peter BunemanDan SuciuData on ze webJohn MitchellFoundations of Programming Languages"; lazy val parsedxml2 = XML.load(new InputSource(new StringReader(xmlFile2))) - @Test + @UnitTest def equality = { val c = new Node { def label = "hello" @@ -245,7 +249,7 @@ class XMLTest { } - @Test + @UnitTest def xpath = { assertTrue(parsedxml1 \ "_" sameElements List(Elem(null, "world", e, sc))) @@ -289,7 +293,7 @@ class XMLTest { assertTrue((parsedxml2 \ "_" \ "_" \ "author").isEmpty) } - @Test + @UnitTest def xpathDESCENDANTS = { assertTrue( (parsedxml2 \\ "author") sameElements List( @@ -329,7 +333,7 @@ class XMLTest { Elem(null, "title", e, sc, Text("Foundations of Programming Languages")))) } - @Test + @UnitTest def groupNode = { val zx1: Node = Group { } val zy1: Node = { zx1 } @@ -344,7 +348,7 @@ class XMLTest { assertTrue(zz1.length == 3) } - @Test + @UnitTest def unparsed = { // println("attribute value normalization") val xmlAttrValueNorm = ""; @@ -371,7 +375,7 @@ class XMLTest { assertTrue(n.attributes.get("BAR", n, "attr").nonEmpty) } - @Test + @UnitTest def dodgyNamespace = { val x = assertTrue(x.toString.matches(".*xmlns:dog=\"http://dog.com\".*")); @@ -389,7 +393,7 @@ class XMLTest { val bx = - @Test + @UnitTest def XmlEx = { assertTrue((ax \ "@foo") xml_== "bar") // uses NodeSeq.view! assertTrue((ax \ "@foo") xml_== xml.Text("bar")) // dto. @@ -398,7 +402,7 @@ class XMLTest { assertTrue("" == bx.toString) } - @Test + @UnitTest def XmlEy { val z = ax \ "@{the namespace from outer space}foo" assertTrue((ax \ "@{the namespace from outer space}foo") xml_== "baz") @@ -425,15 +429,15 @@ class XMLTest { } - @Test + @UnitTest def comment = assertEquals("", toString) - @Test + @UnitTest def weirdElem = assertEquals("", toString) - @Test + @UnitTest def escape = assertEquals(""" "Come, come again, whoever you are, come! @@ -447,13 +451,13 @@ Come even if you broke your penitence a hundred times, Ours is the portal of hope, come as you are." Mevlana Celaleddin Rumi]]> toString) // this guy will escaped, and rightly so - @Test + @UnitTest def unparsed2 = { object myBreak extends scala.xml.Unparsed("
") assertEquals("
", { myBreak } toString) // shows use of unparsed } - @Test + @UnitTest def justDontFail = { match { case scala.xml.QNode("gaga", "foo", md, child @ _*) => @@ -464,4 +468,360 @@ Ours is the portal of hope, come as you are." } } + @UnitTest + def ioPosition = { + val out = new ByteArrayOutputStream + Console.withErr(out) { + Console.withOut(out) { + try { + xml.parsing.ConstructingParser.fromSource(io.Source.fromString(""), false).document() + } catch { + case e: Exception => println(e.getMessage) + } + } + } + out.flush() + assertEquals( + """:1:5: '/' expected instead of '' ^ +:1:5: name expected, but char '' cannot start a name ^ +expected closing tag of foo +""", out.toString) + } + + def f(s: String) = { + + { + for (item <- s split ',') yield { item } + } + + } + + @UnitTest + def nodeBuffer = + assertEquals( + """ + abc + """, f("a,b,c") toString) + + object Serialize { + @throws(classOf[java.io.IOException]) + def write[A](o: A): Array[Byte] = { + val ba = new ByteArrayOutputStream(512) + val out = new java.io.ObjectOutputStream(ba) + out.writeObject(o) + out.close() + ba.toByteArray() + } + @throws(classOf[java.io.IOException]) + @throws(classOf[ClassNotFoundException]) + def read[A](buffer: Array[Byte]): A = { + val in = + new java.io.ObjectInputStream(new java.io.ByteArrayInputStream(buffer)) + in.readObject().asInstanceOf[A] + } + def check[A, B](x: A, y: B) { + // println("x = " + x) + // println("y = " + y) + // println("x equals y: " + (x equals y) + ", y equals x: " + (y equals x)) + assertTrue((x equals y) && (y equals x)) + // println() + } + } + + import Serialize._ + + @UnitTest + def serializeAttribute = { + // Attribute + val a1 = new PrefixedAttribute("xml", "src", Text("hello"), Null) + val _a1: Attribute = read(write(a1)) + check(a1, _a1) + } + + @UnitTest + def serializeDocument = { + // Document + val d1 = new Document + d1.docElem = + d1.encoding = Some("UTF-8") + val _d1: Document = read(write(d1)) + check(d1, _d1) + } + + @UnitTest + def serializeElem = { + // Elem + val e1 = title; + val _e1: Elem = read(write(e1)) + check(e1, _e1) + } + + @UnitTest + def serializeComplex = { + case class Person(name: String, age: Int) + class AddressBook(a: Person*) { + private val people: List[Person] = a.toList + def toXHTML = + + + + + + { + for (p <- people) yield + + + + } +
Last NameFirst Name
{ p.name } { p.age.toString() }
; + } + + val people = new AddressBook( + Person("Tom", 20), + Person("Bob", 22), + Person("James", 19)) + + val e2 = + + + { people.toXHTML } + + ; + val _e2: Elem = read(write(e2)) + check(e2, _e2) + } + + // t-486 + def wsdlTemplate1(serviceName: String): Node = + + ; + + def wsdlTemplate2(serviceName: String, targetNamespace: String): Node = + + ; + + def wsdlTemplate3(serviceName: String): Node = + + ; + + def wsdlTemplate4(serviceName: String, targetNamespace: () => String): Node = + + ; + + @UnitTest + def wsdl = { + assertEquals(""" + """, wsdlTemplate1("service1") toString) + assertEquals(""" + """, wsdlTemplate2("service2", "target2") toString) + assertEquals(""" + """, wsdlTemplate3("service3") toString) + assertEquals(""" + """, wsdlTemplate4("service4", () => "target4") toString) + } + + @UnitTest + def t0663 = { + val src = scala.io.Source.fromString("") + val parser = xml.parsing.ConstructingParser.fromSource(src, true) + assertEquals("", parser.document toString) + } + + @UnitTest + def t1079 = assertFalse( == ) + + import dtd.{ DocType, PublicID } + + @UnitTest + def t1620 = { + val dt = DocType("foo", PublicID("-//Foo Corp//DTD 1.0//EN", "foo.dtd"), Seq()) + var pw = new StringWriter() + XML.write(pw, , "utf-8", true, dt) + pw.flush() + assertEquals(""" + +""", pw.toString) + + pw = new StringWriter() + val dt2 = DocType("foo", PublicID("-//Foo Corp//DTD 1.0//EN", null), Seq()) + XML.write(pw, , "utf-8", true, dt2) + pw.flush() + assertEquals(""" + +""", pw.toString) + } + + @UnitTest + def t1773 = { + val xs = List( +
, + , + { xml.NodeSeq.Empty }, + { "" }, + { if (true) "" else "I like turtles" }) + + for (x1 <- xs; x2 <- xs) assertTrue(x1 xml_== x2) + } + + @UnitTest + def t2354: Unit = { + val xml_good = "<![CDATA[Hello [tag]]]>" + val xml_bad = "<![CDATA[Hello [tag] ]]>" + + val parser1 = ConstructingParser.fromSource(io.Source.fromString(xml_good), false) + val parser2 = ConstructingParser.fromSource(io.Source.fromString(xml_bad), false) + + parser1.document + parser2.document + } + + @UnitTest + def t2771 = { + val xml1 = + val xml2 = scala.xml.XML.loadString("""""") + + def backslashSearch(x: xml.Elem) = "root:-" + (x \ "@{nsUri}at") + "-sub:-" + (x \ "sub" \ "@{nsUri}at") + "-" + + assertEquals("root:-rootVal-sub:-subVal-", backslashSearch(xml1) toString) + assertEquals("root:-rootVal-sub:-subVal-", backslashSearch(xml2) toString) + } + + @UnitTest + def t3886 = { + assertTrue( == ) + assertTrue( != ) + assertTrue( != ) + + assertTrue( != ) + assertTrue( != ) + assertTrue( != ) + } + + @UnitTest + def t4387 = { + import XML.loadString + def mkElem(arg: String) = + + val x1 = mkElem("5") + val x2 = mkElem("50") + + assertEquals(x1, loadString("" + x1)) + assertTrue(x2 != loadString("" + x1)) + } + + @UnitTest + def t5052 { + assertTrue( xml_== ) + assertTrue( xml_== ) + assertTrue( xml_== ) + assertTrue( xml_== ) + } + + @UnitTest + def t5115 = { + def assertHonorsIterableContract(i: Iterable[_]) = assertEquals(i.size, i.iterator.size) + + assertHonorsIterableContract(.attributes) + assertHonorsIterableContract(.attributes) + assertHonorsIterableContract(.attributes) + assertHonorsIterableContract(.attributes) + assertHonorsIterableContract(.attributes) + assertHonorsIterableContract(.attributes) + assertHonorsIterableContract(.attributes) + assertHonorsIterableContract(.attributes) + } + + @UnitTest + def t5843 { + val foo = scala.xml.Attribute(null, "foo", "1", scala.xml.Null) + val bar = scala.xml.Attribute(null, "bar", "2", foo) + val ns = scala.xml.NamespaceBinding(null, "uri", scala.xml.TopScope) + + assertEquals(""" foo="1"""", foo toString) + assertEquals(null, scala.xml.TopScope.getURI(foo.pre)) + assertEquals(""" bar="2"""", bar remove "foo" toString) + assertEquals(""" foo="1"""", bar remove "bar" toString) + assertEquals(""" bar="2"""", bar remove (null, scala.xml.TopScope, "foo") toString) + assertEquals(""" foo="1"""", bar remove (null, scala.xml.TopScope, "bar") toString) + assertEquals(""" bar="2" foo="1"""", bar toString) + assertEquals(""" bar="2" foo="1"""", bar remove (null, ns, "foo") toString) + assertEquals(""" bar="2" foo="1"""", bar remove (null, ns, "bar") toString) + } + + @UnitTest + def t6939 = { + val foo = + assertTrue(foo.child.head.scope.toString == """ xmlns:x="http://bar.com/"""") + + val fooDefault = + assertTrue(fooDefault.child.head.scope.toString == """ xmlns="http://bar.com/"""") + + val foo2 = scala.xml.XML.loadString("""""") + assertTrue(foo2.child.head.scope.toString == """ xmlns:x="http://bar.com/"""") + + val foo2Default = scala.xml.XML.loadString("""""") + assertTrue(foo2Default.child.head.scope.toString == """ xmlns="http://bar.com/"""") + } + + @UnitTest + def t7074 { + assertEquals("""""", sort() toString) + assertEquals("""""", sort() toString) + assertEquals("""""", sort() toString) + assertEquals("""""", sort() toString) + assertEquals("""""", sort() toString) + assertEquals("""""", sort() toString) + assertEquals("""""", sort() toString) + assertEquals("""""", sort() toString) + assertEquals("""""", sort() toString) + } + + @UnitTest + def attributes = { + val noAttr = + val attrNull = + val attrNone = + val preAttrNull = + val preAttrNone = + assertEquals(noAttr, attrNull) + assertEquals(noAttr, attrNone) + assertEquals(noAttr, preAttrNull) + assertEquals(noAttr, preAttrNone) + + val xml1 = + val xml2 = + val xml3 = + assertEquals(xml1, xml2) + assertEquals(xml1, xml3) + + assertEquals("""""", noAttr toString) + assertEquals("""""", attrNull toString) + assertEquals("""""", attrNone toString) + assertEquals("""""", preAttrNull toString) + assertEquals("""""", preAttrNone toString) + assertEquals("""""", xml1 toString) + assertEquals("""""", xml2 toString) + assertEquals("""""", xml3 toString) + + // Check if attribute order is retained + assertEquals("""""", toString) + assertEquals("""""", toString) + assertEquals("""""", toString) + assertEquals("""""", toString) + } + + import java.io.{ Console => _, _ } + import scala.io._ + import scala.xml.parsing._ + @UnitTest + def dontLoop: Unit = { + val xml = " " + val sink = new PrintStream(new ByteArrayOutputStream()) + (Console withOut sink) { + (Console withErr sink) { + ConstructingParser.fromSource((io.Source fromString xml), true).document.docElem + } + } + } + } diff --git a/test/files/run/io-position.check b/test/files/run/io-position.check deleted file mode 100644 index 09f743d750098ca5557c4de619ea8d8f30b6d536..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 126 zcmX}kF$#b%5JXXHPcdB@K`d-?7-5Z@DCn*vD|mc0g;T%ze(mB$$IT$b4q!`lz ujc|>_yQ%e+2_5{q4)bLQE9J@piKw9%Wdotodi}d$*Rn~1QTp0ZwS53BWG1`- diff --git a/test/files/run/io-position.scala b/test/files/run/io-position.scala deleted file mode 100644 index b227846fb..000000000 --- a/test/files/run/io-position.scala +++ /dev/null @@ -1,11 +0,0 @@ -object Test { - def main(args: Array[String]): Unit = Console.withErr(Console.out) { - try { - xml.parsing.ConstructingParser.fromSource(io.Source.fromString(""), false).document() - } catch { - case e:Exception => println(e.getMessage) - } - } - -} - diff --git a/test/files/run/nodebuffer-array.check b/test/files/run/nodebuffer-array.check deleted file mode 100644 index 49f8bfaf8..000000000 --- a/test/files/run/nodebuffer-array.check +++ /dev/null @@ -1,3 +0,0 @@ - - abc - diff --git a/test/files/run/nodebuffer-array.scala b/test/files/run/nodebuffer-array.scala deleted file mode 100644 index 4e1ffe1e5..000000000 --- a/test/files/run/nodebuffer-array.scala +++ /dev/null @@ -1,15 +0,0 @@ -object Test { - - def f(s: String) = { - - { - for (item <- s split ',') yield - { item } - } - - } - - def main(args: Array[String]): Unit = { - println(f("a,b,c")) - } -} diff --git a/test/files/run/serialize.check b/test/files/run/serialize.check deleted file mode 100644 index c1d1360a9..000000000 --- a/test/files/run/serialize.check +++ /dev/null @@ -1,54 +0,0 @@ -x = xml:src="hello" -y = xml:src="hello" -x equals y: true, y equals x: true - -x = -y = -x equals y: true, y equals x: true - -x = title -y = title -x equals y: true, y equals x: true - -x = - - - - - - - - - - - - - - - - -
Last NameFirst Name
Tom 20
Bob 22
James 19
- - -y = - - - - - - - - - - - - - - - - -
Last NameFirst Name
Tom 20
Bob 22
James 19
- - -x equals y: true, y equals x: true - diff --git a/test/files/run/serialize.scala b/test/files/run/serialize.scala deleted file mode 100644 index fd84bab8d..000000000 --- a/test/files/run/serialize.scala +++ /dev/null @@ -1,98 +0,0 @@ -object Test { - def main(args: Array[String]): Unit = { - Test4_xml - } -} - -//############################################################################ -// Serialization -//############################################################################ - -object Serialize { - @throws(classOf[java.io.IOException]) - def write[A](o: A): Array[Byte] = { - val ba = new java.io.ByteArrayOutputStream(512) - val out = new java.io.ObjectOutputStream(ba) - out.writeObject(o) - out.close() - ba.toByteArray() - } - @throws(classOf[java.io.IOException]) - @throws(classOf[ClassNotFoundException]) - def read[A](buffer: Array[Byte]): A = { - val in = - new java.io.ObjectInputStream(new java.io.ByteArrayInputStream(buffer)) - in.readObject().asInstanceOf[A] - } - def check[A, B](x: A, y: B) { - println("x = " + x) - println("y = " + y) - println("x equals y: " + (x equals y) + ", y equals x: " + (y equals x)) - assert((x equals y) && (y equals x)) - println() - } -} -import Serialize._ - -//############################################################################ -// Test classes in package "scala.xml" - -object Test4_xml { - import scala.xml.{Attribute, Document, Elem, Null, PrefixedAttribute, Text} - - case class Person(name: String, age: Int) - - try { - // Attribute - val a1 = new PrefixedAttribute("xml", "src", Text("hello"), Null) - val _a1: Attribute = read(write(a1)) - check(a1, _a1) - - // Document - val d1 = new Document - d1.docElem = - d1.encoding = Some("UTF-8") - val _d1: Document = read(write(d1)) - check(d1, _d1) - - // Elem - val e1 = title; - val _e1: Elem = read(write(e1)) - check(e1, _e1) - - class AddressBook(a: Person*) { - private val people: List[Person] = a.toList - def toXHTML = - - - - - - { for (p <- people) yield - - - - } -
Last NameFirst Name
{ p.name } { p.age.toString() }
; - } - - val people = new AddressBook( - Person("Tom", 20), - Person("Bob", 22), - Person("James", 19)) - - val e2 = - - - { people.toXHTML } - - ; - val _e2: Elem = read(write(e2)) - check(e2, _e2) - } - catch { - case e: Exception => - println("Error in Test4_xml: " + e) - throw e - } -} \ No newline at end of file diff --git a/test/files/run/t0486.check b/test/files/run/t0486.check deleted file mode 100644 index dd1ec2822..000000000 --- a/test/files/run/t0486.check +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - diff --git a/test/files/run/t0486.scala b/test/files/run/t0486.scala deleted file mode 100644 index d3ed8f422..000000000 --- a/test/files/run/t0486.scala +++ /dev/null @@ -1,24 +0,0 @@ -object Test extends App { - import scala.xml._ - - def wsdlTemplate1(serviceName: String): Node = - - ; - - def wsdlTemplate2(serviceName: String, targetNamespace: String): Node = - - ; - - def wsdlTemplate3(serviceName: String): Node = - - ; - - def wsdlTemplate4(serviceName: String, targetNamespace: () => String): Node = - - ; - - println(wsdlTemplate1("service1")) - println(wsdlTemplate2("service2", "target2")) - println(wsdlTemplate3("service3")) - println(wsdlTemplate4("service4", () => "target4")) -} diff --git a/test/files/run/t0663.check b/test/files/run/t0663.check deleted file mode 100755 index dd9be2af7..000000000 --- a/test/files/run/t0663.check +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/files/run/t0663.scala b/test/files/run/t0663.scala deleted file mode 100644 index dd0326d4e..000000000 --- a/test/files/run/t0663.scala +++ /dev/null @@ -1,6 +0,0 @@ -object Test extends App { - val src = scala.io.Source.fromString("") - val parser = xml.parsing.ConstructingParser.fromSource(src, true) - println(parser.document) -} - diff --git a/test/files/run/t1079.check b/test/files/run/t1079.check deleted file mode 100644 index c508d5366..000000000 --- a/test/files/run/t1079.check +++ /dev/null @@ -1 +0,0 @@ -false diff --git a/test/files/run/t1079.scala b/test/files/run/t1079.scala deleted file mode 100644 index ce435d254..000000000 --- a/test/files/run/t1079.scala +++ /dev/null @@ -1,3 +0,0 @@ -object Test extends App { - println( == ) -} diff --git a/test/files/run/t1620.check b/test/files/run/t1620.check deleted file mode 100755 index afa1e6acd..000000000 --- a/test/files/run/t1620.check +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/test/files/run/t1620.scala b/test/files/run/t1620.scala deleted file mode 100644 index e8ea06eb5..000000000 --- a/test/files/run/t1620.scala +++ /dev/null @@ -1,16 +0,0 @@ -import java.io.PrintWriter -import scala.xml.XML -import scala.xml.dtd.{DocType, PublicID} - -object Test extends App { - val dt = DocType("foo", PublicID("-//Foo Corp//DTD 1.0//EN", "foo.dtd"), Seq()) - val pw = new PrintWriter(System.out) - XML.write(pw, , "utf-8", true, dt) - pw.println() - pw.flush() - - val dt2 = DocType("foo", PublicID("-//Foo Corp//DTD 1.0//EN", null), Seq()) - XML.write(pw, , "utf-8", true, dt2) - pw.println() - pw.flush() -} diff --git a/test/files/run/t1773.scala b/test/files/run/t1773.scala deleted file mode 100644 index c50b62512..000000000 --- a/test/files/run/t1773.scala +++ /dev/null @@ -1,12 +0,0 @@ -object Test extends App -{ - val xs = List( -
, - , - { xml.NodeSeq.Empty }, - {""}, - { if (true) "" else "I like turtles" } - ) - - for (x1 <- xs; x2 <- xs) assert (x1 xml_== x2) -} diff --git a/test/files/run/t2124.check b/test/files/run/t2124.check deleted file mode 100755 index 51b40469a..000000000 --- a/test/files/run/t2124.check +++ /dev/null @@ -1 +0,0 @@ -

diff --git a/test/files/run/t2124.scala b/test/files/run/t2124.scala deleted file mode 100644 index a4fd654d7..000000000 --- a/test/files/run/t2124.scala +++ /dev/null @@ -1,25 +0,0 @@ -import scala.xml._ - -import scala.xml.transform._ - -object Test { - val sampleXml =

- - def main(args: scala.Array[String]) { - - println(new RuleTransformer(new RewriteRule { - - override def transform(n: Node): NodeSeq = { - val result = n match { - case {_*} => - - case n => n - - } -// println ("Rewriting '" +n+ "' to: '" + result+ "'") - - result - } - }).transform(sampleXml)) - } -} diff --git a/test/files/run/t2125.check b/test/files/run/t2125.check deleted file mode 100755 index 51b40469a..000000000 --- a/test/files/run/t2125.check +++ /dev/null @@ -1 +0,0 @@ -

diff --git a/test/files/run/t2125.scala b/test/files/run/t2125.scala deleted file mode 100644 index a10ed9827..000000000 --- a/test/files/run/t2125.scala +++ /dev/null @@ -1,25 +0,0 @@ -import scala.xml._ - -import scala.xml.transform._ - -object Test { - - val sampleXml =

- - def main(args: scala.Array[String]) { - println(new RuleTransformer(new RewriteRule { - - override def transform(n: Node): NodeSeq = { - - val result = n match { - - case {_*} => - - case n => n - } -// println ("Rewriting '" +n+ "' to: '" + result+ "'") - result - } - }).transform(sampleXml)) - } -} diff --git a/test/files/run/t2276.check b/test/files/run/t2276.check deleted file mode 100644 index 95f51c8e2..000000000 --- a/test/files/run/t2276.check +++ /dev/null @@ -1,8 +0,0 @@ - - - 2 - - - 2 - - diff --git a/test/files/run/t2276.scala b/test/files/run/t2276.scala deleted file mode 100644 index f0404e5fa..000000000 --- a/test/files/run/t2276.scala +++ /dev/null @@ -1,24 +0,0 @@ -import scala.xml._ -import scala.xml.transform._ - -object Test extends App { - val inputXml : Node = - - - 1 - - - 1 - - - - object t1 extends RewriteRule { - override def transform(n: Node): Seq[Node] = n match { - case {x} if x.toString.toInt < 4 => {x.toString.toInt+1} - case other => other - } - } - - val ruleTransformer = new RuleTransformer(t1) - println(ruleTransformer(inputXml)) -} diff --git a/test/files/run/t2354.scala b/test/files/run/t2354.scala deleted file mode 100644 index 5419911ac..000000000 --- a/test/files/run/t2354.scala +++ /dev/null @@ -1,17 +0,0 @@ -import scala.xml.parsing._ -import scala.io.Source - -object Test -{ - val xml_good = "<![CDATA[Hello [tag]]]>" - val xml_bad = "<![CDATA[Hello [tag] ]]>" - - val parser1 = ConstructingParser.fromSource(Source.fromString(xml_good),false) - val parser2 = ConstructingParser.fromSource(Source.fromString(xml_bad),false) - - def main(args: Array[String]): Unit = { - parser1.document - parser2.document - } -} - diff --git a/test/files/run/t2721.check b/test/files/run/t2721.check deleted file mode 100644 index 2bd7656b3..000000000 --- a/test/files/run/t2721.check +++ /dev/null @@ -1,2 +0,0 @@ -root:-rootVal-sub:-subVal- -root:-rootVal-sub:-subVal- diff --git a/test/files/run/t2721.scala b/test/files/run/t2721.scala deleted file mode 100644 index 93af884a6..000000000 --- a/test/files/run/t2721.scala +++ /dev/null @@ -1,12 +0,0 @@ -object Test -{ - val xml1 = - val xml2= scala.xml.XML.loadString("""""") - - def backslashSearch(x: xml.Elem) = "root:-"+(x \ "@{nsUri}at") +"-sub:-"+(x \ "sub" \ "@{nsUri}at") +"-" - - def main(args: Array[String]): Unit = { - println(backslashSearch(xml1)) - println(backslashSearch(xml2)) - } -} diff --git a/test/files/run/t3886.scala b/test/files/run/t3886.scala deleted file mode 100644 index 1e8e7ad25..000000000 --- a/test/files/run/t3886.scala +++ /dev/null @@ -1,11 +0,0 @@ -object Test { - def main(args: Array[String]) { - assert( == ) - assert( != ) - assert( != ) - - assert( != ) - assert( != ) - assert( != ) - } -} diff --git a/test/files/run/t4387.scala b/test/files/run/t4387.scala deleted file mode 100644 index 68cbe97d0..000000000 --- a/test/files/run/t4387.scala +++ /dev/null @@ -1,12 +0,0 @@ -object Test { - import xml.XML.loadString - def mkElem(arg: String) = - - val x1 = mkElem("5") - val x2 = mkElem("50") - - def main(args: Array[String]): Unit = { - assert(x1 == loadString("" + x1)) - assert(x2 != loadString("" + x1)) - } -} diff --git a/test/files/run/t5052.scala b/test/files/run/t5052.scala deleted file mode 100644 index 9e418e8ac..000000000 --- a/test/files/run/t5052.scala +++ /dev/null @@ -1,6 +0,0 @@ -object Test extends App { - assert( xml_== ) - assert( xml_== ) - assert( xml_== ) - assert( xml_== ) -} diff --git a/test/files/run/t5115.scala b/test/files/run/t5115.scala deleted file mode 100644 index cf2521471..000000000 --- a/test/files/run/t5115.scala +++ /dev/null @@ -1,14 +0,0 @@ -import scala.collection.Iterable - -object Test extends App { - def assertHonorsIterableContract(i: Iterable[_]) = assert(i.size == i.iterator.size) - - assertHonorsIterableContract(.attributes) - assertHonorsIterableContract(.attributes) - assertHonorsIterableContract(.attributes) - assertHonorsIterableContract(.attributes) - assertHonorsIterableContract(.attributes) - assertHonorsIterableContract(.attributes) - assertHonorsIterableContract(.attributes) - assertHonorsIterableContract(.attributes) -} diff --git a/test/files/run/t5843.check b/test/files/run/t5843.check deleted file mode 100644 index 2bf97f4cd..000000000 --- a/test/files/run/t5843.check +++ /dev/null @@ -1,9 +0,0 @@ - foo="1" - bar="2" foo="1" -null - bar="2" - foo="1" - bar="2" - foo="1" - bar="2" foo="1" - bar="2" foo="1" diff --git a/test/files/run/t5843.scala b/test/files/run/t5843.scala deleted file mode 100644 index 43d588c7b..000000000 --- a/test/files/run/t5843.scala +++ /dev/null @@ -1,15 +0,0 @@ -object Test extends App { - val foo = scala.xml.Attribute(null, "foo", "1", scala.xml.Null) - val bar = scala.xml.Attribute(null, "bar", "2", foo) - println(foo) - println(bar) - println(scala.xml.TopScope.getURI(foo.pre)) - println(bar remove "foo") - println(bar remove "bar") - println(bar remove (null, scala.xml.TopScope, "foo")) - println(bar remove (null, scala.xml.TopScope, "bar")) - - val ns = scala.xml.NamespaceBinding(null, "uri", scala.xml.TopScope) - println(bar remove (null, ns, "foo")) - println(bar remove (null, ns, "bar")) -} diff --git a/test/files/run/t6939.scala b/test/files/run/t6939.scala deleted file mode 100644 index 9fe721555..000000000 --- a/test/files/run/t6939.scala +++ /dev/null @@ -1,13 +0,0 @@ -object Test extends App { - val foo = - assert(foo.child.head.scope.toString == """ xmlns:x="http://bar.com/"""") - - val fooDefault = - assert(fooDefault.child.head.scope.toString == """ xmlns="http://bar.com/"""") - - val foo2 = scala.xml.XML.loadString("""""") - assert(foo2.child.head.scope.toString == """ xmlns:x="http://bar.com/"""") - - val foo2Default = scala.xml.XML.loadString("""""") - assert(foo2Default.child.head.scope.toString == """ xmlns="http://bar.com/"""") -} diff --git a/test/files/run/t7074.check b/test/files/run/t7074.check deleted file mode 100644 index ab9cf11f1..000000000 --- a/test/files/run/t7074.check +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - diff --git a/test/files/run/t7074.scala b/test/files/run/t7074.scala deleted file mode 100644 index 693a076a7..000000000 --- a/test/files/run/t7074.scala +++ /dev/null @@ -1,15 +0,0 @@ -import scala.xml.Utility.sort - -object Test extends App { - println(sort()) - println(sort()) - println(sort()) - println(sort()) - println(sort()) - - println(sort()) - println(sort()) - println(sort()) - println(sort()) -} - diff --git a/test/files/run/xml-attribute.check b/test/files/run/xml-attribute.check deleted file mode 100644 index 3cfe3779f..000000000 --- a/test/files/run/xml-attribute.check +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - diff --git a/test/files/run/xml-attribute.scala b/test/files/run/xml-attribute.scala deleted file mode 100644 index eb3956c41..000000000 --- a/test/files/run/xml-attribute.scala +++ /dev/null @@ -1,37 +0,0 @@ -import xml.Node - -object Test { - def main(args: Array[String]): Unit = { - val noAttr = - val attrNull = - val attrNone = - val preAttrNull = - val preAttrNone = - assert(noAttr == attrNull) - assert(noAttr == attrNone) - assert(noAttr == preAttrNull) - assert(noAttr == preAttrNone) - - println(noAttr) - println(attrNull) - println(attrNone) - println(preAttrNull) - println(preAttrNone) - - val xml1 = - val xml2 = - val xml3 = - assert(xml1 == xml2) - assert(xml1 == xml3) - - println(xml1) - println(xml2) - println(xml3) - - // Check if attribute order is retained - println() - println() - println() - println() - } -} diff --git a/test/files/run/xml-loop-bug.scala b/test/files/run/xml-loop-bug.scala deleted file mode 100644 index dc155dbb0..000000000 --- a/test/files/run/xml-loop-bug.scala +++ /dev/null @@ -1,14 +0,0 @@ -import java.io.{ Console => _, _ } -import scala.io._ -import scala.xml.parsing._ -object Test { - def main(args: Array[String]): Unit = { - val xml = " " - val sink = new PrintStream(new ByteArrayOutputStream()) - (Console withOut sink) { - (Console withErr sink) { - ConstructingParser.fromSource((Source fromString xml), true).document.docElem - } - } - } -} From d2e34801981ed9cf9afccf33f394dec5b623aa48 Mon Sep 17 00:00:00 2001 From: Adriaan Moors Date: Mon, 18 Nov 2013 10:26:54 -0800 Subject: [PATCH 031/789] Update README.md --- README.md | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index fe1d9b2ab..a5711831f 100644 --- a/README.md +++ b/README.md @@ -10,18 +10,19 @@ We're also looking forward to alternative implementations! To depend on scala-xml in SBT, add something like this to your build.sbt: ``` -libraryDependencies += "org.scala-lang.modules" %% "scala-xml" % "1.0-RC2" +libraryDependencies += "org.scala-lang.modules" %% "scala-xml" % "1.0.0-RC6" ``` (Assuming you're using a `scalaVersion` for which a scala-xml is published. -The first 2.11 milestone for which this is true is 2.11.0-M4.) +The first 2.11 milestone for which this is true is 2.11.0-M4. +The current milestone is 2.11.0-M6.) To support multiple Scala versions: - SBT 0.12: ``` libraryDependencies <++= (scalaVersion) { sVer => - if (sVer startsWith "2.11") Seq("org.scala-lang.modules" %% "scala-xml" % "1.0-RC2") + if (sVer startsWith "2.11") Seq("org.scala-lang.modules" %% "scala-xml" % "1.0.0-RC6") else Seq.empty } ``` @@ -29,7 +30,7 @@ libraryDependencies <++= (scalaVersion) { sVer => - SBT 0.13: ``` libraryDependencies ++= ( - if (scalaVersion.value startsWith "2.11") Seq("org.scala-lang.modules" %% "scala-xml" % "1.0-RC2") + if (scalaVersion.value startsWith "2.11") Seq("org.scala-lang.modules" %% "scala-xml" % "1.0.0-RC6") else Seq.empty ) ``` From 9c055a13c38445faa00ccb3507022a9a0155a629 Mon Sep 17 00:00:00 2001 From: Adriaan Moors Date: Mon, 18 Nov 2013 18:45:37 -0800 Subject: [PATCH 032/789] Replace partest neg tests with JUnit tests. Using the ToolBox compiler. Minor cheat required: must add header `import scala.xml.{TopScope => $scope}`, which is normally added (synthetically) by the compiler. Somehow, the toolbox compiler doesn't see this change to `rootContext`. This adds a dependency on scala-compiler (for the toolbox compiler), and on JUnit, but removes the dependency on partest. CompilerErrors defines a class CompilerTesting that we might factor out. It's based on https://github.com/scala/async/blob/master/src/test/scala/scala/async/package.scala#L34 --- build.sbt | 66 +----- src/test/scala/scala/xml/CompilerErrors.scala | 197 +++++++++++++++++ src/test/scala/scala/xml/ShouldCompile.scala | 2 +- test/files/neg/t1011.check | 208 ------------------ test/files/neg/t1011.scala | 127 ----------- test/files/neg/t1017.check | 4 - test/files/neg/t1017.scala | 4 - test/files/neg/t1878-typer.check | 4 - test/files/neg/t1878-typer.scala | 6 - test/files/neg/t7185.check | 7 - test/files/neg/t7185.scala | 3 - 11 files changed, 203 insertions(+), 425 deletions(-) create mode 100644 src/test/scala/scala/xml/CompilerErrors.scala delete mode 100644 test/files/neg/t1011.check delete mode 100644 test/files/neg/t1011.scala delete mode 100644 test/files/neg/t1017.check delete mode 100644 test/files/neg/t1017.scala delete mode 100644 test/files/neg/t1878-typer.check delete mode 100644 test/files/neg/t1878-typer.scala delete mode 100644 test/files/neg/t7185.check delete mode 100644 test/files/neg/t7185.scala diff --git a/build.sbt b/build.sbt index e482e50e8..e85ff6bed 100644 --- a/build.sbt +++ b/build.sbt @@ -18,6 +18,11 @@ resolvers += Resolver.sonatypeRepo("snapshots") // don't use for doc scope, scaladoc warnings are not to be reckoned with scalacOptions in compile ++= Seq("-optimize", "-Xfatal-warnings", "-feature", "-deprecation", "-unchecked", "-Xlint") +libraryDependencies ++= Seq( + "org.scala-lang" % "scala-compiler" % scalaVersion.value % "test", // used in CompilerErrors test + "junit" % "junit" % "4.11" % "test", + "com.novocode" % "junit-interface" % "0.10" % "test") + // Generate $name.properties to store our version as well as the scala version used to build resourceGenerators in Compile <+= Def.task { val props = new java.util.Properties @@ -81,67 +86,6 @@ pomExtra := ( ) -// default value must be set here -TestKeys.includeTestDependencies := true - -libraryDependencies ++= Seq("junit" % "junit" % "4.11" % "test", "com.novocode" % "junit-interface" % "0.10" % "test") - -// default -TestKeys.partestVersion := "1.0.0-RC7" - -// the actual partest the interface calls into -- must be binary version close enough to ours -// so that it can link to the compiler/lib we're using (testing) -// NOTE: not sure why, but the order matters (maybe due to the binary version conflicts for xml/parser combinators pulled in for scaladoc?) -libraryDependencies ++= ( - if (TestKeys.includeTestDependencies.value) { - /** - * Exclude all transitive dependencies of partest that include scala-.xml. - * This way we avoid having two (or more) versions of scala-xml on a classpath. - * This fixes problem described here: - * https://github.com/scala/scala-xml/pull/6#issuecomment-26614894 - * - * Note that we are using ModuleID.exclude instead of more flexible ModuleID.excludeAll - * (describe here: http://www.scala-sbt.org/release/docs/Detailed-Topics/Library-Management#exclude-transitive-dependencies) - * because only plain excludes are incorporated in generated pom.xml. There are two ways - * to address this problem: - * - * 1. Figure out how to depend on partest in non-transitive way: not include that dependency - * in generated pom.xml for scala-xml. - * 2. Declare dependencies in partest as provided so they are not includeded transitively. - * - */ - def excludeScalaXml(dep: ModuleID): ModuleID = - dep.exclude("org.scala-lang.modules", "scala-xml_2.11.0-M4"). - exclude("org.scala-lang.modules", "scala-xml_2.11.0-M5"). - exclude("org.scala-lang.modules", "scala-xml_2.11.0-M6"). - exclude("org.scalacheck", "scalacheck_2.11.0-M5") - Seq("org.scala-lang.modules" % s"scala-partest-interface_${scalaBinaryVersion.value}" % "0.2" % "test" intransitive, - "org.scala-lang.modules" % s"scala-partest_${scalaBinaryVersion.value}" % TestKeys.partestVersion.value % "test" intransitive, - // diffutils is needed by partest - "com.googlecode.java-diff-utils" % "diffutils" % "1.3.0" % "test", - "org.scala-lang" % "scala-compiler" % scalaVersion.value % "test"). - map(excludeScalaXml) - } - else Seq.empty -) - -fork in Test := true - -javaOptions in Test += "-Xmx1G" - -testFrameworks += new TestFramework("scala.tools.partest.Framework") - -definedTests in Test += ( - new sbt.TestDefinition( - "partest", - // marker fingerprint since there are no test classes - // to be discovered by sbt: - new sbt.testing.AnnotatedFingerprint { - def isModule = true - def annotationName = "partest" - }, true, Array()) - ) - osgiSettings val osgiVersion = version(_.replace('-', '.')) diff --git a/src/test/scala/scala/xml/CompilerErrors.scala b/src/test/scala/scala/xml/CompilerErrors.scala new file mode 100644 index 000000000..285c99f71 --- /dev/null +++ b/src/test/scala/scala/xml/CompilerErrors.scala @@ -0,0 +1,197 @@ +package scala.xml + +import org.junit.Test + +class CompilerErrors extends CompilerTesting { + @Test + def t7185() = + expectXmlError("""|overloaded method value apply with alternatives: + | (f: scala.xml.Node => Boolean)scala.xml.NodeSeq + | (i: Int)scala.xml.Node + | cannot be applied to ()""".stripMargin, + """|object Test { + | () + |}""") + + @Test + def t1878_typer() = + expectXmlError("_* may only come last", + """|object Test extends App { + | // illegal - bug #1764 + | null match { + | case

{ _* }

=> + | } + |}""") + + + @Test + def t1017() = + expectXmlErrors(1, "not found: value foo", + """|object Test { + | { foo } + |}""") + + @Test + def t1011() = + expectXmlErrors(69, "not found: value entity", + """|import scala.xml._; + | + |abstract class Test { + | //val entity : String; + | def primitiveHeader : NodeSeq = + | Group({ + |
{Text(entity)} + | {Text(entity)} + | {Text(entity)} + | {Text(entity)} + | {Text(entity)} + | {Text(entity)} + | {Text(entity)} + | {Text(entity)} + | {Text(entity)} + | {Text(entity)} + | {Text(entity)} + | {Text(entity)} + | {Text(entity)} + | {Text(entity)} + | {Text(entity)} + | {Text(entity)} + | {Text(entity)} + | {Text(entity)} + | {Text(entity)} + | {Text(entity)} + | {Text(entity)} + | {Text(entity)} + | {Text(entity)} + | {Text(entity)} + | {Text(entity)} + | {Text(entity)} + | {Text(entity)} + | {Text(entity)} + | {Text(entity)} + | {Text(entity)} + | {Text(entity)} + | {Text(entity)} + | {Text(entity)} + | {Text(entity)} + | {Text(entity)} + | {Text(entity)} + | {Text(entity)} + | {Text(entity)} + | {Text(entity)} + | {Text(entity)} + | {Text(entity)} + | {Text(entity)} + | {Text(entity)} + | {Text(entity)} + | {Text(entity)} + | {Text(entity)} + | {Text(entity)} + | {Text(entity)} + | {Text(entity)} + | {Text(entity)} + | {Text(entity)} + | {Text(entity)} + | {Text(entity)} + | {Text(entity)} + | {Text(entity)} + | {Text(entity)} + | {Text(entity)} + | {Text(entity)} + | {Text(entity)} + | {Text(entity)} + | {Text(entity)} + | {Text(entity)} + | {Text(entity)} + | {Text(entity)} + | {Text(entity)} + | {Text(entity)} + | {Text(entity)} + | {Text(entity)} + | {Text(entity)}
+ | } ++ // 3 seconds + | {}++ // 5 seconds + | {}++ // 10 seconds + | {}++ // 20 seconds + | {}++ // 40 seconds + | {}++ // 40 seconds + | {}++ // 40 seconds + | {}++ // 40 seconds + | {}++ // 40 seconds + | {}++ // 40 seconds + | {}++ // 40 seconds + | {}++ // 40 seconds + | {}++ // 40 seconds + | {}++ // 40 seconds + | {}++ // 40 seconds + | {}++ // 40 seconds + | {}++ // 40 seconds + | {}++ // 5 seconds + | {}++ // 10 seconds + | {}++ // 20 seconds + | {}++ // 40 seconds + | {}++ // 40 seconds + | {}++ // 40 seconds + | {}++ // 40 seconds + | {}++ // 40 seconds + | {}++ // 40 seconds + | {}++ // 40 seconds + | {}++ // 40 seconds + | {}++ // 40 seconds + | {}++ // 40 seconds + | {}++ // 40 seconds + | {}++ // 40 seconds + | {}++ // 40 seconds + | {}++ // 5 seconds + | {}++ // 10 seconds + | {}++ // 20 seconds + | {}++ // 40 seconds + | {}++ // 40 seconds + | {}++ // 40 seconds + | {}++ // 40 seconds + | {}++ // 40 seconds + | {}++ // 40 seconds + | {}++ // 40 seconds + | {}++ // 40 seconds + | {}++ // 40 seconds + | {}++ // 40 seconds + | {}++ // 40 seconds + | {}++ // 40 seconds + | {}++ // 40 seconds + |
); + |}""") +} + +// TODO: factor out somewhere? +class CompilerTesting { + def errorMessages(errorSnippet: String, compileOptions: String = "")(code: String): List[String] = { + import scala.tools.reflect._ + val m = scala.reflect.runtime.currentMirror + val tb = m.mkToolBox(options = compileOptions) //: ToolBox[m.universe.type] + val fe = tb.frontEnd + + try { + tb.eval(tb.parse(code)) + Nil + } catch { case _: ToolBoxError => + import fe._ + infos.toList collect { case Info(_, msg, ERROR) => msg } + } + } + + // note: `code` should have a | margin + // the import's needed because toolbox compiler does not accumulate imports like the real one (TODO: verify hypothesis) + def xmlErrorMessages(msg: String, code: String) = + errorMessages(msg)("import scala.xml.{TopScope => $scope}\n"+ code.stripMargin) + + def expectXmlError(msg: String, code: String) = { + val errors = xmlErrorMessages(msg, code) + assert(errors exists (_ contains msg), errors mkString "\n") + } + + def expectXmlErrors(msgCount: Int, msg: String, code: String) = { + val errors = xmlErrorMessages(msg, code) + val errorCount = errors.filter(_ contains msg).length + assert(errorCount == msgCount, s"$errorCount occurrences of \'$msg\' found -- expected $msgCount in:\n${errors mkString "\n"}") + } +} diff --git a/src/test/scala/scala/xml/ShouldCompile.scala b/src/test/scala/scala/xml/ShouldCompile.scala index 0314ff1ce..f2ddffce5 100644 --- a/src/test/scala/scala/xml/ShouldCompile.scala +++ b/src/test/scala/scala/xml/ShouldCompile.scala @@ -63,7 +63,7 @@ class B { } // SI-5858 -object Test { +object SI_5858 { new Elem(null, null, Null, TopScope, Nil: _*) // was ambiguous } diff --git a/test/files/neg/t1011.check b/test/files/neg/t1011.check deleted file mode 100644 index 3c9e4ecd8..000000000 --- a/test/files/neg/t1011.check +++ /dev/null @@ -1,208 +0,0 @@ -t1011.scala:8: error: not found: value entity -
{Text(entity)} - ^ -t1011.scala:9: error: not found: value entity - {Text(entity)} - ^ -t1011.scala:10: error: not found: value entity - {Text(entity)} - ^ -t1011.scala:11: error: not found: value entity - {Text(entity)} - ^ -t1011.scala:12: error: not found: value entity - {Text(entity)} - ^ -t1011.scala:13: error: not found: value entity - {Text(entity)} - ^ -t1011.scala:14: error: not found: value entity - {Text(entity)} - ^ -t1011.scala:15: error: not found: value entity - {Text(entity)} - ^ -t1011.scala:16: error: not found: value entity - {Text(entity)} - ^ -t1011.scala:17: error: not found: value entity - {Text(entity)} - ^ -t1011.scala:18: error: not found: value entity - {Text(entity)} - ^ -t1011.scala:19: error: not found: value entity - {Text(entity)} - ^ -t1011.scala:20: error: not found: value entity - {Text(entity)} - ^ -t1011.scala:21: error: not found: value entity - {Text(entity)} - ^ -t1011.scala:22: error: not found: value entity - {Text(entity)} - ^ -t1011.scala:23: error: not found: value entity - {Text(entity)} - ^ -t1011.scala:24: error: not found: value entity - {Text(entity)} - ^ -t1011.scala:25: error: not found: value entity - {Text(entity)} - ^ -t1011.scala:26: error: not found: value entity - {Text(entity)} - ^ -t1011.scala:27: error: not found: value entity - {Text(entity)} - ^ -t1011.scala:28: error: not found: value entity - {Text(entity)} - ^ -t1011.scala:29: error: not found: value entity - {Text(entity)} - ^ -t1011.scala:30: error: not found: value entity - {Text(entity)} - ^ -t1011.scala:31: error: not found: value entity - {Text(entity)} - ^ -t1011.scala:32: error: not found: value entity - {Text(entity)} - ^ -t1011.scala:33: error: not found: value entity - {Text(entity)} - ^ -t1011.scala:34: error: not found: value entity - {Text(entity)} - ^ -t1011.scala:35: error: not found: value entity - {Text(entity)} - ^ -t1011.scala:36: error: not found: value entity - {Text(entity)} - ^ -t1011.scala:37: error: not found: value entity - {Text(entity)} - ^ -t1011.scala:38: error: not found: value entity - {Text(entity)} - ^ -t1011.scala:39: error: not found: value entity - {Text(entity)} - ^ -t1011.scala:40: error: not found: value entity - {Text(entity)} - ^ -t1011.scala:41: error: not found: value entity - {Text(entity)} - ^ -t1011.scala:42: error: not found: value entity - {Text(entity)} - ^ -t1011.scala:43: error: not found: value entity - {Text(entity)} - ^ -t1011.scala:44: error: not found: value entity - {Text(entity)} - ^ -t1011.scala:45: error: not found: value entity - {Text(entity)} - ^ -t1011.scala:46: error: not found: value entity - {Text(entity)} - ^ -t1011.scala:47: error: not found: value entity - {Text(entity)} - ^ -t1011.scala:48: error: not found: value entity - {Text(entity)} - ^ -t1011.scala:49: error: not found: value entity - {Text(entity)} - ^ -t1011.scala:50: error: not found: value entity - {Text(entity)} - ^ -t1011.scala:51: error: not found: value entity - {Text(entity)} - ^ -t1011.scala:52: error: not found: value entity - {Text(entity)} - ^ -t1011.scala:53: error: not found: value entity - {Text(entity)} - ^ -t1011.scala:54: error: not found: value entity - {Text(entity)} - ^ -t1011.scala:55: error: not found: value entity - {Text(entity)} - ^ -t1011.scala:56: error: not found: value entity - {Text(entity)} - ^ -t1011.scala:57: error: not found: value entity - {Text(entity)} - ^ -t1011.scala:58: error: not found: value entity - {Text(entity)} - ^ -t1011.scala:59: error: not found: value entity - {Text(entity)} - ^ -t1011.scala:60: error: not found: value entity - {Text(entity)} - ^ -t1011.scala:61: error: not found: value entity - {Text(entity)} - ^ -t1011.scala:62: error: not found: value entity - {Text(entity)} - ^ -t1011.scala:63: error: not found: value entity - {Text(entity)} - ^ -t1011.scala:64: error: not found: value entity - {Text(entity)} - ^ -t1011.scala:65: error: not found: value entity - {Text(entity)} - ^ -t1011.scala:66: error: not found: value entity - {Text(entity)} - ^ -t1011.scala:67: error: not found: value entity - {Text(entity)} - ^ -t1011.scala:68: error: not found: value entity - {Text(entity)} - ^ -t1011.scala:69: error: not found: value entity - {Text(entity)} - ^ -t1011.scala:70: error: not found: value entity - {Text(entity)} - ^ -t1011.scala:71: error: not found: value entity - {Text(entity)} - ^ -t1011.scala:72: error: not found: value entity - {Text(entity)} - ^ -t1011.scala:73: error: not found: value entity - {Text(entity)} - ^ -t1011.scala:74: error: not found: value entity - {Text(entity)} - ^ -t1011.scala:75: error: not found: value entity - {Text(entity)} - ^ -t1011.scala:76: error: not found: value entity - {Text(entity)}
- ^ -69 errors found diff --git a/test/files/neg/t1011.scala b/test/files/neg/t1011.scala deleted file mode 100644 index 57a6ad7b4..000000000 --- a/test/files/neg/t1011.scala +++ /dev/null @@ -1,127 +0,0 @@ -package test; -import scala.xml._; - -abstract class Test { - //val entity : String; - def primitiveHeader : NodeSeq = - Group({ -
{Text(entity)} - {Text(entity)} - {Text(entity)} - {Text(entity)} - {Text(entity)} - {Text(entity)} - {Text(entity)} - {Text(entity)} - {Text(entity)} - {Text(entity)} - {Text(entity)} - {Text(entity)} - {Text(entity)} - {Text(entity)} - {Text(entity)} - {Text(entity)} - {Text(entity)} - {Text(entity)} - {Text(entity)} - {Text(entity)} - {Text(entity)} - {Text(entity)} - {Text(entity)} - {Text(entity)} - {Text(entity)} - {Text(entity)} - {Text(entity)} - {Text(entity)} - {Text(entity)} - {Text(entity)} - {Text(entity)} - {Text(entity)} - {Text(entity)} - {Text(entity)} - {Text(entity)} - {Text(entity)} - {Text(entity)} - {Text(entity)} - {Text(entity)} - {Text(entity)} - {Text(entity)} - {Text(entity)} - {Text(entity)} - {Text(entity)} - {Text(entity)} - {Text(entity)} - {Text(entity)} - {Text(entity)} - {Text(entity)} - {Text(entity)} - {Text(entity)} - {Text(entity)} - {Text(entity)} - {Text(entity)} - {Text(entity)} - {Text(entity)} - {Text(entity)} - {Text(entity)} - {Text(entity)} - {Text(entity)} - {Text(entity)} - {Text(entity)} - {Text(entity)} - {Text(entity)} - {Text(entity)} - {Text(entity)} - {Text(entity)} - {Text(entity)} - {Text(entity)}
- } ++ // 3 seconds - {}++ // 5 seconds - {}++ // 10 seconds - {}++ // 20 seconds - {}++ // 40 seconds - {}++ // 40 seconds - {}++ // 40 seconds - {}++ // 40 seconds - {}++ // 40 seconds - {}++ // 40 seconds - {}++ // 40 seconds - {}++ // 40 seconds - {}++ // 40 seconds - {}++ // 40 seconds - {}++ // 40 seconds - {}++ // 40 seconds - {}++ // 40 seconds - {}++ // 5 seconds - {}++ // 10 seconds - {}++ // 20 seconds - {}++ // 40 seconds - {}++ // 40 seconds - {}++ // 40 seconds - {}++ // 40 seconds - {}++ // 40 seconds - {}++ // 40 seconds - {}++ // 40 seconds - {}++ // 40 seconds - {}++ // 40 seconds - {}++ // 40 seconds - {}++ // 40 seconds - {}++ // 40 seconds - {}++ // 40 seconds - {}++ // 5 seconds - {}++ // 10 seconds - {}++ // 20 seconds - {}++ // 40 seconds - {}++ // 40 seconds - {}++ // 40 seconds - {}++ // 40 seconds - {}++ // 40 seconds - {}++ // 40 seconds - {}++ // 40 seconds - {}++ // 40 seconds - {}++ // 40 seconds - {}++ // 40 seconds - {}++ // 40 seconds - {}++ // 40 seconds - {}++ // 40 seconds -
); -} diff --git a/test/files/neg/t1017.check b/test/files/neg/t1017.check deleted file mode 100644 index 52101c7f6..000000000 --- a/test/files/neg/t1017.check +++ /dev/null @@ -1,4 +0,0 @@ -t1017.scala:3: error: not found: value foo -{ foo } - ^ -one error found diff --git a/test/files/neg/t1017.scala b/test/files/neg/t1017.scala deleted file mode 100644 index e389f308c..000000000 --- a/test/files/neg/t1017.scala +++ /dev/null @@ -1,4 +0,0 @@ -// 'foo' is not defined -object Test { -{ foo } -} diff --git a/test/files/neg/t1878-typer.check b/test/files/neg/t1878-typer.check deleted file mode 100644 index e3a20d0be..000000000 --- a/test/files/neg/t1878-typer.check +++ /dev/null @@ -1,4 +0,0 @@ -t1878-typer.scala:4: error: _* may only come last - case

{ _* }

=> - ^ -one error found diff --git a/test/files/neg/t1878-typer.scala b/test/files/neg/t1878-typer.scala deleted file mode 100644 index 1eb0cb7df..000000000 --- a/test/files/neg/t1878-typer.scala +++ /dev/null @@ -1,6 +0,0 @@ -object Test extends App { - // illegal - bug #1764 - null match { - case

{ _* }

=> - } -} diff --git a/test/files/neg/t7185.check b/test/files/neg/t7185.check deleted file mode 100644 index 46f2cc797..000000000 --- a/test/files/neg/t7185.check +++ /dev/null @@ -1,7 +0,0 @@ -t7185.scala:2: error: overloaded method value apply with alternatives: - (f: scala.xml.Node => Boolean)scala.xml.NodeSeq - (i: Int)scala.xml.Node - cannot be applied to () - () - ^ -one error found diff --git a/test/files/neg/t7185.scala b/test/files/neg/t7185.scala deleted file mode 100644 index 2f9284bc5..000000000 --- a/test/files/neg/t7185.scala +++ /dev/null @@ -1,3 +0,0 @@ -object Test { - () -} From 9ef175b40e1689025b69ef194db40ee59e2c5e39 Mon Sep 17 00:00:00 2001 From: Adriaan Moors Date: Tue, 19 Nov 2013 10:20:07 -0800 Subject: [PATCH 033/789] Build cleanup --- .travis.yml | 11 ++++++----- build.sbt | 15 ++++++--------- 2 files changed, 12 insertions(+), 14 deletions(-) diff --git a/.travis.yml b/.travis.yml index 058d62b1c..589139d97 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,13 +1,14 @@ language: scala -script: - - sbt ++$TRAVIS_SCALA_VERSION 'set concurrentRestrictions in Global += Tags.limit(Tags.Compile, 2)' compile test:compile - - sbt ++$TRAVIS_SCALA_VERSION 'set concurrentRestrictions in Global += Tags.limit(Tags.Test, 1)' test +script: + - sbt ++$TRAVIS_SCALA_VERSION clean update compile test scala: - - 2.10.3 - 2.11.0-SNAPSHOT jdk: - oraclejdk6 - openjdk7 notifications: email: - - adriaan.moors@typesafe.com \ No newline at end of file + - adriaan.moors@typesafe.com + +# if we get weird timeouts, see https://github.com/spray/spray/pull/233 +# 'set concurrentRestrictions in Global += Tags.limit(Tags.Test, 1)' diff --git a/build.sbt b/build.sbt index e85ff6bed..93cf98f6f 100644 --- a/build.sbt +++ b/build.sbt @@ -5,24 +5,21 @@ name := "scala-xml" version := "1.0.0-SNAPSHOT" // standard stuff follows: -scalaVersion := "2.11.0-M6" - -// NOTE: not necessarily equal to scalaVersion -// (e.g., during PR validation, we override scalaVersion to validate, -// but don't rebuild scalacheck, so we don't want to rewire that dependency) -scalaBinaryVersion := "2.11.0-M6" +scalaVersion := "2.11.0-M7" // to allow compiling against snapshot versions of Scala resolvers += Resolver.sonatypeRepo("snapshots") -// don't use for doc scope, scaladoc warnings are not to be reckoned with -scalacOptions in compile ++= Seq("-optimize", "-Xfatal-warnings", "-feature", "-deprecation", "-unchecked", "-Xlint") - libraryDependencies ++= Seq( "org.scala-lang" % "scala-compiler" % scalaVersion.value % "test", // used in CompilerErrors test "junit" % "junit" % "4.11" % "test", "com.novocode" % "junit-interface" % "0.10" % "test") + +// don't use for doc scope, scaladoc warnings are not to be reckoned with +// TODO: turn on for nightlies, but don't enable for PR validation... "-Xfatal-warnings" +scalacOptions in compile ++= Seq("-optimize", "-feature", "-deprecation", "-unchecked", "-Xlint") + // Generate $name.properties to store our version as well as the scala version used to build resourceGenerators in Compile <+= Def.task { val props = new java.util.Properties From a5de947e12ddd3da25903b23ed22c3d2c17b5e20 Mon Sep 17 00:00:00 2001 From: Adriaan Moors Date: Tue, 19 Nov 2013 12:34:04 -0800 Subject: [PATCH 034/789] Use snapshotScalaBinaryVersion when building against -SNAPSHOT --- build.sbt | 10 +++++++++- project/keys.scala | 13 ++++++++----- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/build.sbt b/build.sbt index 93cf98f6f..2aba0cc98 100644 --- a/build.sbt +++ b/build.sbt @@ -1,15 +1,23 @@ +import VersionKeys.{snapshotScalaBinaryVersion,deriveBinaryVersion} + organization := "org.scala-lang.modules" name := "scala-xml" version := "1.0.0-SNAPSHOT" -// standard stuff follows: scalaVersion := "2.11.0-M7" +snapshotScalaBinaryVersion := "2.11.0-M7" + +// DOUBLETHINK YOUR WAY OUT OF EDITING BELOW (THERE IS NO BELOW) + +scalaBinaryVersion := deriveBinaryVersion(scalaVersion.value, snapshotScalaBinaryVersion.value) + // to allow compiling against snapshot versions of Scala resolvers += Resolver.sonatypeRepo("snapshots") + libraryDependencies ++= Seq( "org.scala-lang" % "scala-compiler" % scalaVersion.value % "test", // used in CompilerErrors test "junit" % "junit" % "4.11" % "test", diff --git a/project/keys.scala b/project/keys.scala index 07003822c..bdca0dda9 100644 --- a/project/keys.scala +++ b/project/keys.scala @@ -1,8 +1,11 @@ -object TestKeys { +object VersionKeys { import sbt.settingKey - // for testing with partest - val includeTestDependencies = settingKey[Boolean]("Doesn't declare test dependencies.") + val snapshotScalaBinaryVersion = settingKey[String]("The Scala binary version to use when building against Scala SNAPSHOT.") - val partestVersion = settingKey[String]("Partest version.") -} \ No newline at end of file + def deriveBinaryVersion(sv: String, snapshotScalaBinaryVersion: String) = sv match { + case snap_211 if snap_211.startsWith("2.11") && + snap_211.contains("-SNAPSHOT") => snapshotScalaBinaryVersion + case sv => sbt.CrossVersion.binaryScalaVersion(sv) + } +} From 2289f4df7a5fff8bf4cdeaf36615822a8d3bbaeb Mon Sep 17 00:00:00 2001 From: Adriaan Moors Date: Fri, 22 Nov 2013 15:53:49 -0800 Subject: [PATCH 035/789] Switch to openjdk6 --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 589139d97..d6a34d030 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,7 +4,7 @@ script: scala: - 2.11.0-SNAPSHOT jdk: - - oraclejdk6 + - openjdk6 - openjdk7 notifications: email: From 6eb9a23590991e5ed965e6f457eb3eef09472de4 Mon Sep 17 00:00:00 2001 From: Adriaan Moors Date: Fri, 24 Jan 2014 17:43:35 -0800 Subject: [PATCH 036/789] Switch to scala-module-plugin, sbt 0.13.1 --- build.sbt | 117 ++++----------------------------------- project/build.properties | 2 +- project/keys.scala | 11 ---- project/plugins.sbt | 2 +- 4 files changed, 13 insertions(+), 119 deletions(-) delete mode 100644 project/keys.scala diff --git a/build.sbt b/build.sbt index 2aba0cc98..b9213e0d6 100644 --- a/build.sbt +++ b/build.sbt @@ -1,116 +1,21 @@ -import VersionKeys.{snapshotScalaBinaryVersion,deriveBinaryVersion} +scalaModuleSettings -organization := "org.scala-lang.modules" +name := "scala-xml" -name := "scala-xml" +version := "1.0.0-SNAPSHOT" -version := "1.0.0-SNAPSHOT" +scalaVersion := "2.11.0-M8" -scalaVersion := "2.11.0-M7" +snapshotScalaBinaryVersion := "2.11.0-M8" -snapshotScalaBinaryVersion := "2.11.0-M7" - -// DOUBLETHINK YOUR WAY OUT OF EDITING BELOW (THERE IS NO BELOW) - -scalaBinaryVersion := deriveBinaryVersion(scalaVersion.value, snapshotScalaBinaryVersion.value) - -// to allow compiling against snapshot versions of Scala -resolvers += Resolver.sonatypeRepo("snapshots") - - -libraryDependencies ++= Seq( - "org.scala-lang" % "scala-compiler" % scalaVersion.value % "test", // used in CompilerErrors test - "junit" % "junit" % "4.11" % "test", - "com.novocode" % "junit-interface" % "0.10" % "test") - - -// don't use for doc scope, scaladoc warnings are not to be reckoned with -// TODO: turn on for nightlies, but don't enable for PR validation... "-Xfatal-warnings" -scalacOptions in compile ++= Seq("-optimize", "-feature", "-deprecation", "-unchecked", "-Xlint") - -// Generate $name.properties to store our version as well as the scala version used to build -resourceGenerators in Compile <+= Def.task { - val props = new java.util.Properties - props.put("version.number", version.value) - props.put("scala.version.number", scalaVersion.value) - props.put("scala.binary.version.number", scalaBinaryVersion.value) - val file = (resourceManaged in Compile).value / s"${name.value}.properties" - IO.write(props, null, file) - Seq(file) -} - -mappings in (Compile, packageBin) += { - (baseDirectory.value / s"${name.value}.properties") -> s"${name.value}.properties" -} - - -// maven publishing -publishTo := { - val nexus = "https://oss.sonatype.org/" - if (version.value.trim.endsWith("SNAPSHOT")) - Some("snapshots" at nexus + "content/repositories/snapshots") - else - Some("releases" at nexus + "service/local/staging/deploy/maven2") -} - -credentials += Credentials(Path.userHome / ".ivy2" / ".credentials") - -publishMavenStyle := true - -publishArtifact in Test := false - -pomIncludeRepository := { _ => false } - -pomExtra := ( - http://www.scala-lang.org/ - 2002 - - - repo - BSD 3-Clause - https://github.com/scala/{name.value}/blob/master/LICENSE.md - - - - scm:git:git://github.com/scala/{name.value}.git - https://github.com/scala/{name.value} - - - JIRA - https://issues.scala-lang.org/ - - - - epfl - EPFL - - - Typesafe - Typesafe, Inc. - - -) - -osgiSettings - -val osgiVersion = version(_.replace('-', '.')) - -OsgiKeys.bundleSymbolicName := s"${organization.value}.${name.value}" - -OsgiKeys.bundleVersion := osgiVersion.value +// important!! must come here (why?) +scalaModuleOsgiSettings OsgiKeys.exportPackage := Seq(s"scala.xml.*;version=${version.value}") -// Sources should also have a nice MANIFEST file -packageOptions in packageSrc := Seq(Package.ManifestAttributes( - ("Bundle-SymbolicName", s"${organization.value}.${name.value}.source"), - ("Bundle-Name", s"${name.value} sources"), - ("Bundle-Version", osgiVersion.value), - ("Eclipse-SourceBundle", s"""${organization.value}.${name.value};version="${osgiVersion.value}";roots:="."""") - )) +libraryDependencies += "junit" % "junit" % "4.11" % "test" +libraryDependencies += "com.novocode" % "junit-interface" % "0.10" % "test" -// TODO: mima -// import com.typesafe.tools.mima.plugin.MimaPlugin.mimaDefaultSettings -// import com.typesafe.tools.mima.plugin.MimaKeys.previousArtifact -// previousArtifact := Some(organization.value %% name.value % binaryReferenceVersion.value) +// used in CompilerErrors test +libraryDependencies += "org.scala-lang" % "scala-compiler" % scalaVersion.value % "test" diff --git a/project/build.properties b/project/build.properties index 8cbb5226c..37b489cb6 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version=0.13.0 \ No newline at end of file +sbt.version=0.13.1 diff --git a/project/keys.scala b/project/keys.scala deleted file mode 100644 index bdca0dda9..000000000 --- a/project/keys.scala +++ /dev/null @@ -1,11 +0,0 @@ -object VersionKeys { - import sbt.settingKey - - val snapshotScalaBinaryVersion = settingKey[String]("The Scala binary version to use when building against Scala SNAPSHOT.") - - def deriveBinaryVersion(sv: String, snapshotScalaBinaryVersion: String) = sv match { - case snap_211 if snap_211.startsWith("2.11") && - snap_211.contains("-SNAPSHOT") => snapshotScalaBinaryVersion - case sv => sbt.CrossVersion.binaryScalaVersion(sv) - } -} diff --git a/project/plugins.sbt b/project/plugins.sbt index c2f7976c3..d59d681bd 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1 +1 @@ -addSbtPlugin("com.typesafe.sbt" % "sbt-osgi" % "0.6.0") \ No newline at end of file +addSbtPlugin("org.scala-lang.modules" % "scala-module-plugin" % "1.0.1") \ No newline at end of file From f1cb6949a835779b5d383fb98a800855a464dbd8 Mon Sep 17 00:00:00 2001 From: Adriaan Moors Date: Fri, 28 Feb 2014 08:30:12 -0800 Subject: [PATCH 037/789] Fix #20: test locally built scala.xml classes not scala-compiler's scala-xml dependency... also put int a println to show the version we're testing to prevent regression --- build.sbt | 18 +++++++++++++++++- src/main/scala/scala/xml/XML.scala | 5 +++++ src/test/scala/scala/xml/CompilerErrors.scala | 5 +++++ 3 files changed, 27 insertions(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index b9213e0d6..d26c78694 100644 --- a/build.sbt +++ b/build.sbt @@ -17,5 +17,21 @@ libraryDependencies += "junit" % "junit" % "4.11" % "test" libraryDependencies += "com.novocode" % "junit-interface" % "0.10" % "test" +//// testing: // used in CompilerErrors test -libraryDependencies += "org.scala-lang" % "scala-compiler" % scalaVersion.value % "test" +libraryDependencies += ("org.scala-lang" % "scala-compiler" % scalaVersion.value % "test").exclude("org.scala-lang.modules", s"scala-xml*") + +// needed to fix classloader issues (see #20) +// alternatively, manage the scala instance as shown below (commented) +fork in Test := true + +// ALTERNATIVE: manage the Scala instance ourselves to exclude the published scala-xml (scala-compiler depends on it) +// since this dependency hides the classes we're testing +// managedScalaInstance := false +// +// ivyConfigurations += Configurations.ScalaTool +// +// libraryDependencies ++= Seq( +// "org.scala-lang" % "scala-library" % scalaVersion.value, +// ("org.scala-lang" % "scala-compiler" % scalaVersion.value % "scala-tool").exclude("org.scala-lang.modules", s"scala-xml_${scalaBinaryVersion.value}") +// ) diff --git a/src/main/scala/scala/xml/XML.scala b/src/main/scala/scala/xml/XML.scala index 034c7e5da..8b70eafd2 100755 --- a/src/main/scala/scala/xml/XML.scala +++ b/src/main/scala/scala/xml/XML.scala @@ -112,3 +112,8 @@ object XML extends XMLLoader[Elem] { w.write(Utility.serialize(node, minimizeTags = minimizeTags).toString) } } + +object Properties extends scala.util.PropertiesTrait { + protected def propCategory = "scala-xml" + protected def pickJarBasedOn = classOf[scala.xml.pull.XMLEventReader] +} diff --git a/src/test/scala/scala/xml/CompilerErrors.scala b/src/test/scala/scala/xml/CompilerErrors.scala index 285c99f71..6096e5a60 100644 --- a/src/test/scala/scala/xml/CompilerErrors.scala +++ b/src/test/scala/scala/xml/CompilerErrors.scala @@ -164,6 +164,11 @@ class CompilerErrors extends CompilerTesting { // TODO: factor out somewhere? class CompilerTesting { + // TODO: refine this; for now, just println -- the goal is to ensure we're testing the right version of scala-xml + // (it should print the same thing as the version in the sbt build) + // we used to always test the scala-xml jar that the compiler depends on, because it was part of the scala-tool ivy config + println(s"Testing scala-xml version ${Properties.versionNumberString}.") + def errorMessages(errorSnippet: String, compileOptions: String = "")(code: String): List[String] = { import scala.tools.reflect._ val m = scala.reflect.runtime.currentMirror From 3db48953d387e7ef4fe2101374e4b9ffcb5c41bc Mon Sep 17 00:00:00 2001 From: "crosson.david@gmail.com" Date: Sun, 2 Mar 2014 23:51:09 +0100 Subject: [PATCH 038/789] SI-4267 - fix to avoid XMLEventReader swallows IO/Parse exception, to avoid threads leak. --- .../scala/scala/xml/pull/XMLEventReader.scala | 10 +++++++++- .../scala/xml/pull/XMLEventReaderTest.scala | 20 ++++++++++++++++++- 2 files changed, 28 insertions(+), 2 deletions(-) diff --git a/src/main/scala/scala/xml/pull/XMLEventReader.scala b/src/main/scala/scala/xml/pull/XMLEventReader.scala index b26301466..60843ed33 100755 --- a/src/main/scala/scala/xml/pull/XMLEventReader.scala +++ b/src/main/scala/scala/xml/pull/XMLEventReader.scala @@ -92,12 +92,19 @@ class XMLEventReader(src: Source) override def run() { curInput = input - interruptibly { this.initialize.document() } + try { + interruptibly { this.initialize.document() } + } catch { + case e:Exception => setEvent(ExceptionEvent(e)) + } setEvent(POISON) } } } +// An internal class used to propagate exception from helper threads to API end users. +private case class ExceptionEvent(exception:Exception) extends XMLEvent + // An iterator designed for one or more producers to generate // elements, and a single consumer to iterate. Iteration will continue // until closeIterator() is called, after which point producers @@ -143,6 +150,7 @@ trait ProducerConsumerIterator[T >: Null] extends Iterator[T] { def next() = { if (eos()) throw new NoSuchElementException("ProducerConsumerIterator") if (buffer == null) fillBuffer() + if (buffer.isInstanceOf[ExceptionEvent]) throw buffer.asInstanceOf[ExceptionEvent].exception drainBuffer() } diff --git a/src/test/scala/scala/xml/pull/XMLEventReaderTest.scala b/src/test/scala/scala/xml/pull/XMLEventReaderTest.scala index 060276531..be55938ca 100644 --- a/src/test/scala/scala/xml/pull/XMLEventReaderTest.scala +++ b/src/test/scala/scala/xml/pull/XMLEventReaderTest.scala @@ -40,4 +40,22 @@ class XMLEventReaderTest { er.stop // allow thread to be garbage-collected } -} \ No newline at end of file + @Test(expected = classOf[Exception]) + def missingTagTest: Unit = { + val data= + """ + | + | + | + | + | + | + | + | + |""".stripMargin + + val er = new XMLEventReader(Source.fromString(data)) + while(er.hasNext) er.next() + er.stop() + } +} From 6b04109b3f396d60a7a1febf06adcb9c9ac20443 Mon Sep 17 00:00:00 2001 From: Adriaan Moors Date: Mon, 17 Mar 2014 15:46:20 -0700 Subject: [PATCH 039/789] bump versions --- build.sbt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/build.sbt b/build.sbt index d26c78694..171e1aa73 100644 --- a/build.sbt +++ b/build.sbt @@ -2,11 +2,11 @@ scalaModuleSettings name := "scala-xml" -version := "1.0.0-SNAPSHOT" +version := "1.0.1-SNAPSHOT" -scalaVersion := "2.11.0-M8" +scalaVersion := "2.11.0-RC1" -snapshotScalaBinaryVersion := "2.11.0-M8" +snapshotScalaBinaryVersion := "2.11.0-RC1" // important!! must come here (why?) scalaModuleOsgiSettings From efdab4daefbe6acc7a15e66e7c8eb73f077babe7 Mon Sep 17 00:00:00 2001 From: Adriaan Moors Date: Mon, 17 Mar 2014 16:15:57 -0700 Subject: [PATCH 040/789] Check binary compatibility with MiMa --- build.sbt | 12 ++++++++++++ project/plugins.sbt | 4 +++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index 171e1aa73..9f83275c5 100644 --- a/build.sbt +++ b/build.sbt @@ -1,3 +1,5 @@ +import com.typesafe.tools.mima.plugin.{MimaPlugin, MimaKeys} + scalaModuleSettings name := "scala-xml" @@ -25,6 +27,16 @@ libraryDependencies += ("org.scala-lang" % "scala-compiler" % scalaVersion.value // alternatively, manage the scala instance as shown below (commented) fork in Test := true +MimaPlugin.mimaDefaultSettings + +MimaKeys.previousArtifact := Some(organization.value % s"${name.value}_2.11.0-RC1" % "1.0.0") + +// run mima during tests +test in Test := { + MimaKeys.reportBinaryIssues.value + (test in Test).value +} + // ALTERNATIVE: manage the Scala instance ourselves to exclude the published scala-xml (scala-compiler depends on it) // since this dependency hides the classes we're testing // managedScalaInstance := false diff --git a/project/plugins.sbt b/project/plugins.sbt index d59d681bd..bc60ad6cf 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1 +1,3 @@ -addSbtPlugin("org.scala-lang.modules" % "scala-module-plugin" % "1.0.1") \ No newline at end of file +addSbtPlugin("org.scala-lang.modules" % "scala-module-plugin" % "1.0.2") + +addSbtPlugin("com.typesafe" % "sbt-mima-plugin" % "0.1.6") \ No newline at end of file From 2067ae9adb2b43c44879a8d7af4c29361ae0be99 Mon Sep 17 00:00:00 2001 From: Adriaan Moors Date: Mon, 17 Mar 2014 16:37:54 -0700 Subject: [PATCH 041/789] Fork in Test is done by modules plugin 1.0.2 --- build.sbt | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/build.sbt b/build.sbt index 9f83275c5..0e545917e 100644 --- a/build.sbt +++ b/build.sbt @@ -23,10 +23,6 @@ libraryDependencies += "com.novocode" % "junit-interface" % "0.10" % "test" // used in CompilerErrors test libraryDependencies += ("org.scala-lang" % "scala-compiler" % scalaVersion.value % "test").exclude("org.scala-lang.modules", s"scala-xml*") -// needed to fix classloader issues (see #20) -// alternatively, manage the scala instance as shown below (commented) -fork in Test := true - MimaPlugin.mimaDefaultSettings MimaKeys.previousArtifact := Some(organization.value % s"${name.value}_2.11.0-RC1" % "1.0.0") @@ -36,14 +32,3 @@ test in Test := { MimaKeys.reportBinaryIssues.value (test in Test).value } - -// ALTERNATIVE: manage the Scala instance ourselves to exclude the published scala-xml (scala-compiler depends on it) -// since this dependency hides the classes we're testing -// managedScalaInstance := false -// -// ivyConfigurations += Configurations.ScalaTool -// -// libraryDependencies ++= Seq( -// "org.scala-lang" % "scala-library" % scalaVersion.value, -// ("org.scala-lang" % "scala-compiler" % scalaVersion.value % "scala-tool").exclude("org.scala-lang.modules", s"scala-xml_${scalaBinaryVersion.value}") -// ) From cde10a947fc7e8076a933694c7ebc96e9c24f0f6 Mon Sep 17 00:00:00 2001 From: Adriaan Moors Date: Wed, 2 Apr 2014 11:38:56 -0700 Subject: [PATCH 042/789] Update version, remove documentation duplication --- README.md | 23 +++-------------------- 1 file changed, 3 insertions(+), 20 deletions(-) diff --git a/README.md b/README.md index a5711831f..701c38678 100644 --- a/README.md +++ b/README.md @@ -10,27 +10,10 @@ We're also looking forward to alternative implementations! To depend on scala-xml in SBT, add something like this to your build.sbt: ``` -libraryDependencies += "org.scala-lang.modules" %% "scala-xml" % "1.0.0-RC6" +libraryDependencies += "org.scala-lang.modules" %% "scala-xml" % "1.0.1" ``` (Assuming you're using a `scalaVersion` for which a scala-xml is published. -The first 2.11 milestone for which this is true is 2.11.0-M4. -The current milestone is 2.11.0-M6.) +The first 2.11 milestone for which this is true is 2.11.0-M4.) -To support multiple Scala versions: - - - SBT 0.12: -``` -libraryDependencies <++= (scalaVersion) { sVer => - if (sVer startsWith "2.11") Seq("org.scala-lang.modules" %% "scala-xml" % "1.0.0-RC6") - else Seq.empty -} -``` - - - SBT 0.13: -``` -libraryDependencies ++= ( - if (scalaVersion.value startsWith "2.11") Seq("org.scala-lang.modules" %% "scala-xml" % "1.0.0-RC6") - else Seq.empty -) -``` +To support multiple Scala versions, see the example in https://github.com/scala/scala-sbt-cross-compile. From 4eea05ee3420cce809e0ea159d24cd3a81a98564 Mon Sep 17 00:00:00 2001 From: Adriaan Moors Date: Wed, 2 Apr 2014 11:39:37 -0700 Subject: [PATCH 043/789] Correct url --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 701c38678..17a5e915c 100644 --- a/README.md +++ b/README.md @@ -16,4 +16,4 @@ libraryDependencies += "org.scala-lang.modules" %% "scala-xml" % "1.0.1" (Assuming you're using a `scalaVersion` for which a scala-xml is published. The first 2.11 milestone for which this is true is 2.11.0-M4.) -To support multiple Scala versions, see the example in https://github.com/scala/scala-sbt-cross-compile. +To support multiple Scala versions, see the example in https://github.com/scala/scala-module-dependency-sample. From 8540421c280101b3761cbd561ad235880b283542 Mon Sep 17 00:00:00 2001 From: Jason Zaugg Date: Wed, 7 May 2014 10:41:30 +0200 Subject: [PATCH 044/789] Version bumps - Update project version to 1.0.2-SNAPSHOT, give that 1.0.1 is already released - Use _2.11 as the snapshot binary version for 2.12.0-SNAPSHOT PR validation. - Use 1.0.1 as the MiMa baseline - Use Scala 2.11.0 for Travis CI builds --- .travis.yml | 2 +- build.sbt | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index d6a34d030..540159b44 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,7 +2,7 @@ language: scala script: - sbt ++$TRAVIS_SCALA_VERSION clean update compile test scala: - - 2.11.0-SNAPSHOT + - 2.11.0 jdk: - openjdk6 - openjdk7 diff --git a/build.sbt b/build.sbt index 0e545917e..cfd9c871a 100644 --- a/build.sbt +++ b/build.sbt @@ -4,11 +4,11 @@ scalaModuleSettings name := "scala-xml" -version := "1.0.1-SNAPSHOT" +version := "1.0.2-SNAPSHOT" -scalaVersion := "2.11.0-RC1" +scalaVersion := "2.11.0" -snapshotScalaBinaryVersion := "2.11.0-RC1" +snapshotScalaBinaryVersion := "2.11" // important!! must come here (why?) scalaModuleOsgiSettings @@ -25,7 +25,7 @@ libraryDependencies += ("org.scala-lang" % "scala-compiler" % scalaVersion.value MimaPlugin.mimaDefaultSettings -MimaKeys.previousArtifact := Some(organization.value % s"${name.value}_2.11.0-RC1" % "1.0.0") +MimaKeys.previousArtifact := Some(organization.value % s"${name.value}_2.11" % "1.0.1") // run mima during tests test in Test := { From 6ef07082696f60cccad97c0216f10d1a256ff75c Mon Sep 17 00:00:00 2001 From: Adriaan Moors Date: Mon, 19 May 2014 13:29:59 +0200 Subject: [PATCH 045/789] Bump version --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 17a5e915c..af670e415 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ We're also looking forward to alternative implementations! To depend on scala-xml in SBT, add something like this to your build.sbt: ``` -libraryDependencies += "org.scala-lang.modules" %% "scala-xml" % "1.0.1" +libraryDependencies += "org.scala-lang.modules" %% "scala-xml" % "1.0.2" ``` (Assuming you're using a `scalaVersion` for which a scala-xml is published. From b696beaa481a11a5276186b9e2bc2be3cb32a922 Mon Sep 17 00:00:00 2001 From: P T Withington Date: Fri, 19 Sep 2014 13:36:40 -0400 Subject: [PATCH 046/789] SI-8834 serialize, sequenceToXML pass all options serialize and sequenceToXML recursively call each other but were not passing all formatting options. Fix that. --- src/main/scala/scala/xml/Utility.scala | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/scala/scala/xml/Utility.scala b/src/main/scala/scala/xml/Utility.scala index aea4f45fc..e9aa88de6 100755 --- a/src/main/scala/scala/xml/Utility.scala +++ b/src/main/scala/scala/xml/Utility.scala @@ -219,7 +219,7 @@ object Utility extends AnyRef with parsing.TokenTests { case c: Comment if !stripComments => c buildString sb case s: SpecialNode => s buildString sb case g: Group => - for (c <- g.nodes) serialize(c, g.scope, sb, minimizeTags = minimizeTags); sb + for (c <- g.nodes) serialize(c, g.scope, sb, stripComments, decodeEntities, preserveWhitespace, minimizeTags); sb case el: Elem => // print tag with namespace declarations sb.append('<') @@ -234,7 +234,7 @@ object Utility extends AnyRef with parsing.TokenTests { } else { // children, so use long form: ... sb.append('>') - sequenceToXML(el.child, el.scope, sb, stripComments) + sequenceToXML(el.child, el.scope, sb, stripComments, decodeEntities, preserveWhitespace, minimizeTags) sb.append("') From ac48b6fe44489be1220bcb2c57c796fc8a2eb37b Mon Sep 17 00:00:00 2001 From: Adam Dingle Date: Thu, 6 Nov 2014 18:11:32 -0500 Subject: [PATCH 047/789] Add link to API documentation --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index af670e415..47c10b452 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,8 @@ The standard Scala XML library. As of Scala 2.11, this library is a separate jar that can be omitted from Scala projects that do not use XML. We're also looking forward to alternative implementations! +API documentation is available [here](http://www.scala-lang.org/api/current/scala-xml/). + ## Adding an SBT dependency To depend on scala-xml in SBT, add something like this to your build.sbt: From d78b728151403c338581f8d1ca686b4370bdc2d0 Mon Sep 17 00:00:00 2001 From: Bart Schuller Date: Fri, 21 Nov 2014 13:21:01 +0100 Subject: [PATCH 048/789] Fix PIs appearing before text nodes. The SAX handler that's used when you call loadXML didn't append the text buffer to the current node list before pushing a processing-instruction node. --- .../scala/xml/parsing/FactoryAdapter.scala | 1 + .../scala/xml/parsing/PiParsingTest.scala | 53 +++++++++++++++++++ 2 files changed, 54 insertions(+) create mode 100644 src/test/scala/scala/xml/parsing/PiParsingTest.scala diff --git a/src/main/scala/scala/xml/parsing/FactoryAdapter.scala b/src/main/scala/scala/xml/parsing/FactoryAdapter.scala index ba57434ab..c0d82dbda 100644 --- a/src/main/scala/scala/xml/parsing/FactoryAdapter.scala +++ b/src/main/scala/scala/xml/parsing/FactoryAdapter.scala @@ -189,6 +189,7 @@ abstract class FactoryAdapter extends DefaultHandler with factory.XMLLoader[Node * Processing instruction. */ override def processingInstruction(target: String, data: String) { + captureText() hStack pushAll createProcInstr(target, data) } } diff --git a/src/test/scala/scala/xml/parsing/PiParsingTest.scala b/src/test/scala/scala/xml/parsing/PiParsingTest.scala new file mode 100644 index 000000000..e9769d374 --- /dev/null +++ b/src/test/scala/scala/xml/parsing/PiParsingTest.scala @@ -0,0 +1,53 @@ +package scala.xml.parsing + +import org.junit.Test +import org.junit.Ignore +import org.junit.runner.RunWith +import org.junit.runners.JUnit4 +import scala.xml.JUnitAssertsForXML.assertEquals + +class PiParsingTest { + + + import scala.io.Source.fromString + import scala.xml.parsing.ConstructingParser.fromSource + import scala.xml.TopScope + private def parse(s:String) = fromSource(fromString(s), preserveWS = true).element(TopScope) + private def parseNoWS(s:String) = fromSource(fromString(s), preserveWS = false).element(TopScope) + + @Test + def piNoWSparse: Unit = { + val expected = "ab" + assertEquals(expected, parseNoWS("ab")) + } + + @Test + def piNoWSLiteral: Unit = { + val expected = "ab" + assertEquals(expected, ab) + } + + @Test + def piNoWSloadString: Unit = { + val expected = "ab" + assertEquals(expected, xml.XML.loadString("ab")) + } + + @Test + def piParse: Unit = { + val expected = " a b " + assertEquals(expected, parse(" a b ")) + } + + @Test + def piLoadString: Unit = { + val expected = " a b " + assertEquals(expected, xml.XML.loadString(" a b ")) + } + @Test + def piLiteral: Unit = { + val expected = " a b " + assertEquals(expected, a b ) + } + +} From 2a7892cb81d091cfe36c555d4c94f090f2065568 Mon Sep 17 00:00:00 2001 From: Jason Zaugg Date: Wed, 3 Dec 2014 22:10:05 +1000 Subject: [PATCH 049/789] SI-8253 Adjust test for namespace interpolation This test fails after we try to fix SI-8523 in the compiler. But the test is actually at fault here, as it was relying on the loose matching performed by the compiler's SymbolXMLBuilder. The fix for SI-8253 that triggered the failure: https://github.com/scala/scala/commit/8d175b907 The original commit that introduced this test: https://github.com/scala/scala/commit/e1ffc05b10be6 --- src/test/scala/scala/xml/XMLTest.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/scala/scala/xml/XMLTest.scala b/src/test/scala/scala/xml/XMLTest.scala index ae54f6da4..b86f2c9ef 100644 --- a/src/test/scala/scala/xml/XMLTest.scala +++ b/src/test/scala/scala/xml/XMLTest.scala @@ -601,7 +601,7 @@ expected closing tag of foo ; def wsdlTemplate3(serviceName: String): Node = - + ; def wsdlTemplate4(serviceName: String, targetNamespace: () => String): Node = From 61914e5ca4a8632ffa1946d4a9452d361cc328c6 Mon Sep 17 00:00:00 2001 From: Adriaan Moors Date: Wed, 3 Dec 2014 10:03:05 -0800 Subject: [PATCH 050/789] Fix #33 --- README.md | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/README.md b/README.md index 47c10b452..ebdaf7143 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,4 @@ To depend on scala-xml in SBT, add something like this to your build.sbt: libraryDependencies += "org.scala-lang.modules" %% "scala-xml" % "1.0.2" ``` -(Assuming you're using a `scalaVersion` for which a scala-xml is published. -The first 2.11 milestone for which this is true is 2.11.0-M4.) - -To support multiple Scala versions, see the example in https://github.com/scala/scala-module-dependency-sample. +Maven users, or sbt users looking to supportmultiple Scala versions, please see the more elaborate example in https://github.com/scala/scala-module-dependency-sample. From 41328fc97aac066e7fd40fc4543cfe1f8eab4af2 Mon Sep 17 00:00:00 2001 From: Adriaan Moors Date: Wed, 3 Dec 2014 10:03:14 -0800 Subject: [PATCH 051/789] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index ebdaf7143..176b486db 100644 --- a/README.md +++ b/README.md @@ -15,4 +15,4 @@ To depend on scala-xml in SBT, add something like this to your build.sbt: libraryDependencies += "org.scala-lang.modules" %% "scala-xml" % "1.0.2" ``` -Maven users, or sbt users looking to supportmultiple Scala versions, please see the more elaborate example in https://github.com/scala/scala-module-dependency-sample. +Maven users, or sbt users looking to support multiple Scala versions, please see the more elaborate example in https://github.com/scala/scala-module-dependency-sample. From f45ed5f23930c4053e9b70c91d1474cfd43a1eca Mon Sep 17 00:00:00 2001 From: Adriaan Moors Date: Wed, 3 Dec 2014 10:11:05 -0800 Subject: [PATCH 052/789] Clarify we're looking for a maintainer. --- README.md | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 176b486db..828c60eee 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,13 @@ scala-xml [](https://travis-ci.org/scala/scala-xml) ========= -The standard Scala XML library. +The standard Scala XML library. Not actively maintained. + +Would you like to maintain this project? (Please open an issue/send an email!) As of Scala 2.11, this library is a separate jar that can be omitted from Scala projects that do not use XML. -We're also looking forward to alternative implementations! + +The compiler was decoupled from this particular implementation using the same approach as for comprehensions (xml syntax is desugared into a set of method calls, which unfortunately is only defined by the implementation). Alternative implementations are welcome! API documentation is available [here](http://www.scala-lang.org/api/current/scala-xml/). From 1ece73c978702a5bb8c14d508e4600871796e44a Mon Sep 17 00:00:00 2001 From: Adriaan Moors Date: Wed, 3 Dec 2014 10:14:42 -0800 Subject: [PATCH 053/789] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 828c60eee..1d2b0c4fe 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ Would you like to maintain this project? (Please open an issue/send an email!) As of Scala 2.11, this library is a separate jar that can be omitted from Scala projects that do not use XML. -The compiler was decoupled from this particular implementation using the same approach as for comprehensions (xml syntax is desugared into a set of method calls, which unfortunately is only defined by the implementation). Alternative implementations are welcome! +The compiler was decoupled from this particular implementation using the same approach as for comprehensions (xml syntax is desugared into a set of method calls, which unfortunately is only defined by the [implementation](https://github.com/scala/scala/blob/2.11.x/src/compiler/scala/tools/nsc/ast/parser/SymbolicXMLBuilder.scala)). Alternative implementations are welcome! API documentation is available [here](http://www.scala-lang.org/api/current/scala-xml/). From d1f8feadc84a2ba4ae6c9c22901b0367b4493d42 Mon Sep 17 00:00:00 2001 From: Adriaan Moors Date: Wed, 3 Dec 2014 10:31:13 -0800 Subject: [PATCH 054/789] Update README.md --- README.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 1d2b0c4fe..40ba3236f 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,11 @@ +Maintainer wanted! +================== +Would you like to maintain this project? (Please open an issue/send an email!) + scala-xml [](https://travis-ci.org/scala/scala-xml) ========= -The standard Scala XML library. Not actively maintained. - -Would you like to maintain this project? (Please open an issue/send an email!) +The standard Scala XML library. Please file issues here instead of over at issues.scala-lang.org. As of Scala 2.11, this library is a separate jar that can be omitted from Scala projects that do not use XML. From 3edc6b2cf5a86e0baf6bbcf5e1ab74d6cc581e0c Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Fri, 12 Sep 2014 18:10:36 -0400 Subject: [PATCH 055/789] Unit test for #28 PrettyPrinter adds empty attribute with xmlns * src/test/scala/scala/xml/XMLTest.scala (issue28): New unit test --- src/test/scala/scala/xml/XMLTest.scala | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/test/scala/scala/xml/XMLTest.scala b/src/test/scala/scala/xml/XMLTest.scala index b86f2c9ef..01431baf1 100644 --- a/src/test/scala/scala/xml/XMLTest.scala +++ b/src/test/scala/scala/xml/XMLTest.scala @@ -824,4 +824,16 @@ expected closing tag of foo } } + @UnitTest + def issue28: Unit = { + val x = + // val ns = new NamespaceBinding("x", "gaga", sc) + // val x = Elem("x", "foo", e, ns) + val pp = new xml.PrettyPrinter(80, 2) + // This assertion passed + assertEquals("""""", x.toString) + // This was the bug, producing an errant xmlns attribute + assertEquals("""""", pp.format(x)) + } + } From a53d11c55bbf4dc60ebec28836276d46fbd1247a Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Wed, 3 Dec 2014 14:09:09 -0500 Subject: [PATCH 056/789] Fix #28 by using TopScope instead of null * src/main/scala/com/jonasboner/PrettyPrinter.scala (format): Modify namespace binding default argument to TopScope, was null. --- src/main/scala/scala/xml/PrettyPrinter.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/scala/scala/xml/PrettyPrinter.scala b/src/main/scala/scala/xml/PrettyPrinter.scala index 515c9c088..a175f1df2 100755 --- a/src/main/scala/scala/xml/PrettyPrinter.scala +++ b/src/main/scala/scala/xml/PrettyPrinter.scala @@ -244,7 +244,7 @@ class PrettyPrinter(width: Int, step: Int) { * @param pscope the namespace to prefix mapping * @return the formatted string */ - def format(n: Node, pscope: NamespaceBinding = null): String = + def format(n: Node, pscope: NamespaceBinding = TopScope): String = sbToString(format(n, pscope, _)) /** From 50c5c9f9e019bb40ee7a667984405c5dce73abbf Mon Sep 17 00:00:00 2001 From: Adriaan Moors Date: Wed, 3 Dec 2014 13:43:08 -0800 Subject: [PATCH 057/789] Validate against Scala 2.11.4 --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 540159b44..ede527c59 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,7 +2,7 @@ language: scala script: - sbt ++$TRAVIS_SCALA_VERSION clean update compile test scala: - - 2.11.0 + - 2.11.4 jdk: - openjdk6 - openjdk7 From 0154ff816890358c54156bfaad1aa118c856d0aa Mon Sep 17 00:00:00 2001 From: Adriaan Moors Date: Wed, 3 Dec 2014 18:08:49 -0800 Subject: [PATCH 058/789] Bump to sbt 0.13.7 --- project/build.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/build.properties b/project/build.properties index 37b489cb6..748703f77 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version=0.13.1 +sbt.version=0.13.7 From a959b128a582bdfea8091a7bba511e6f16d52f12 Mon Sep 17 00:00:00 2001 From: Adriaan Moors Date: Wed, 3 Dec 2014 18:08:32 -0800 Subject: [PATCH 059/789] Automatically publish version-tagged commits --- .travis.yml | 8 +++++++- admin/decrypt.sh | 2 ++ admin/encrypt.sh | 2 ++ admin/encryptAll.sh | 19 +++++++++++++++++++ admin/gpg.sbt | 21 +++++++++++++++++++++ admin/publishPrep.sh | 14 ++++++++++++++ admin/pubring.asc | 18 ++++++++++++++++++ admin/secring.asc.enc | 40 ++++++++++++++++++++++++++++++++++++++++ sensitive.sbt.enc | 7 +++++++ 9 files changed, 130 insertions(+), 1 deletion(-) create mode 100755 admin/decrypt.sh create mode 100755 admin/encrypt.sh create mode 100755 admin/encryptAll.sh create mode 100644 admin/gpg.sbt create mode 100755 admin/publishPrep.sh create mode 100644 admin/pubring.asc create mode 100644 admin/secring.asc.enc create mode 100644 sensitive.sbt.enc diff --git a/.travis.yml b/.travis.yml index ede527c59..3f3c0d2ab 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,12 @@ language: scala + +# Don't commit sensitive files, commit the encrypted version: admin/encrypt.sh $SENSITIVE # keep it secret, add $SENSITIVE.enc to the repo +# On travis: admin/decrypt.sh $SENSITIVE +env: + - secure: "whJQqI/7G+kUJoCCGQYbv3Y/T2Cx3EcBKfCyvMkZaVgo0wFEOUguh8I+4QqRyf9cC/uPmzwCzV9uwXsNDMcY78jouY05A+fCEnUol/9TuF5PWmXF6Yr/UmmYoCQe4pioXsbXa4uOy18kLzE0h2sOIrJ5A9NL8/58iVgl4E3pwvk=" script: - - sbt ++$TRAVIS_SCALA_VERSION clean update compile test + - admin/publishPrep.sh + - sbt ++$TRAVIS_SCALA_VERSION $publishVersion clean update compile test $extraTarget scala: - 2.11.4 jdk: diff --git a/admin/decrypt.sh b/admin/decrypt.sh new file mode 100755 index 000000000..3c3c602f0 --- /dev/null +++ b/admin/decrypt.sh @@ -0,0 +1,2 @@ +#!/bin/bash +openssl aes-256-cbc -pass "pass:$SECRET" -in $1.enc -out $1 -d -a \ No newline at end of file diff --git a/admin/encrypt.sh b/admin/encrypt.sh new file mode 100755 index 000000000..4bf6c9329 --- /dev/null +++ b/admin/encrypt.sh @@ -0,0 +1,2 @@ +#!/bin/bash +openssl aes-256-cbc -pass "pass:$SECRET" -in $1 -out $1.enc -a \ No newline at end of file diff --git a/admin/encryptAll.sh b/admin/encryptAll.sh new file mode 100755 index 000000000..510bfe3d5 --- /dev/null +++ b/admin/encryptAll.sh @@ -0,0 +1,19 @@ +#!/bin/bash + +# Based on https://gist.github.com/kzap/5819745: + +echo "This will encrypt the cleartext sensitive.sbt and admin/secring.asc, while making the encrypted versions available for decryption on Travis." +echo "Update your .travis.yml as directed, and delete the cleartext versions." +echo "Press enter to continue." +read + +# 1. create a secret, put it in an environment variable while encrypting files -- UNSET IT AFTER +export SECRET=$(cat /dev/urandom | head -c 10000 | openssl sha1) + +# 2. add the "secure: ..." line under the env section -- generate it with `` (install the travis gem first) +travis encrypt SECRET=$SECRET + +admin/encrypt.sh admin/secring.asc +admin/encrypt.sh sensitive.sbt + +# rm sensitive.sbt admin/secring.asc \ No newline at end of file diff --git a/admin/gpg.sbt b/admin/gpg.sbt new file mode 100644 index 000000000..6ec4213ea --- /dev/null +++ b/admin/gpg.sbt @@ -0,0 +1,21 @@ +// only added when publishing: +addSbtPlugin("com.typesafe.sbt" % "sbt-pgp" % "0.8.3") + +/* There's a companion sensitive.sbt, which was created like this: + +1. in an sbt shell when sbt-gpg is loaded, create pgp key in admin/: + + set pgpReadOnly := false + pgp-cmd gen-key // use $passPhrase + pgp-cmd send-key hkp://keyserver.ubuntu.com + +2. create sensitive.sbt with contents: + +pgpPassphrase := Some($passPhrase.toArray) + +pgpPublicRing := file("admin/pubring.asc") + +pgpSecretRing := file("admin/secring.asc") + +credentials += Credentials("Sonatype Nexus Repository Manager", "oss.sonatype.org", $sonaUser, $sonaPass) +*/ diff --git a/admin/publishPrep.sh b/admin/publishPrep.sh new file mode 100755 index 000000000..1914c60b7 --- /dev/null +++ b/admin/publishPrep.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +# prep environment for publish to sonatype staging if the HEAD commit is tagged + +headTag=$(git describe --exact-match ||:) + +if [[ "$headTag" =~ ^v[0-9]+\.[0-9]+\.[0-9]+(-[A-Za-z0-9-]+)? ]]; then + echo "HEAD is tagged as $headTag." + export publishVersion="set every version := \"$(echo $headTag | sed -e s/^v//)\"" + export extraTarget="publish-signed" + cat admin/gpg.sbt >> project/plugins.sbt + admin/decrypt.sh sensitive.sbt + (cd admin/ && ./decrypt.sh secring.asc) +fi diff --git a/admin/pubring.asc b/admin/pubring.asc new file mode 100644 index 000000000..61de5ecf0 --- /dev/null +++ b/admin/pubring.asc @@ -0,0 +1,18 @@ +-----BEGIN PGP PUBLIC KEY BLOCK----- +Version: BCPG v1.49 + +mQENBFR/wRIBCACgRrOC5zAzSuuhf35NVzAG3K6xADFcxSKtxyIKydvlzhgdTuH8 +MvqLaQvo0gOQ/32DEnBy0DbDu8WEDvpZzEM21eTz/VW9VDb0fbNEXoLODY+IYt+v +ohsw0NzQV6qSk2WQVYWVuZbfZXZBT3/JoDxHKRRl/IvZb8CQkRypxKVmsud/IOsu +t/hHRWzbgPtNJNUX0Uhrz96P0+LcKfwUt34TMBIyfSY9C3ZPzPYTlhuDqtJunKTj +NZljt9cbAMjJsuw0rSYNkAb5kGblguUn7BLp5Ngox6h7/MP7v1YM7WsXa3oMcHyX +0Rf3PPE8HELcfsbF+FAN3jCNWgaz15bCz3lhABEBAAG0LHNjYWxhLXhtbCA8c2Nh +bGEtaW50ZXJuYWxzQGdvb2dsZWdyb3Vwcy5jb20+iQEcBBMBAgAGBQJUf8ESAAoJ +EIbbEE4RFVfeHWgH/1B5U+UT/lx8Z/V3qK3EfsVVM5nbcJqy+jRC9mNsO4VSX7+G +rNuIn6oZ08SZKcmzWo71i9uqatgaFtVHhLbOJ9a72Ja8YoBSKerv6gpcFcAH4fDB +m5FyoxbM0K9vLwUvkbewNLLK8XbWwuCuHTmtEW2WPv2d/PmyOXuXoos/E1HiPTkU +iN5TIuJYpDvy7cxQL0qlaEcpWjzXHyy6+BFA1C8zlwoX+2iAx1rVGd3mPDHNgY+U +Z3MYArHxu5QC3BZs2wsD9/SkioanFhzH4g/MB1qaQlD2WGqXwoDK2/Bsnu5pJaPA +QhCuqobGMQ8Umupnejt8fIIQ/8A99sneBU+eEB8= +=450t +-----END PGP PUBLIC KEY BLOCK----- diff --git a/admin/secring.asc.enc b/admin/secring.asc.enc new file mode 100644 index 000000000..25ed5cc2d --- /dev/null +++ b/admin/secring.asc.enc @@ -0,0 +1,40 @@ +U2FsdGVkX1/9hpS9pNHRzznj4yQKe9noi3duTRAp0JhO2nHrJwtDWdRcEBZXeWto +7wbM7Ji+R4gqdNd3bb2UO8+NTcOtBE0/toioD/MV2fTTffzVVYwBvmknfknIcOdZ +9pyfMvpwcdrZ+KSSGkg0xowac2bjVaO7i54DECxA2mMs5sqev/SiatnmsD6i5I5h +Wif7bdaTqBOHIxJ70776iUc0Z+2auOc73by1MUPhR2ceh93KmavM6rkHk2JrzNj/ +wCwbgXLoC1NjQfgWM1tWIa1v7l1ZsvrU0ozz7ls3IR79EKGYvB0us+Qz0YUiv+Sn +f237bzy/7PRB5bQTIHe9VWOMNGKgML4vw4VAZ59EMkiBDOCzWRCpfa4xdZJvYkrw +K95/Lx4GhHI/i6/E6TGgzaJSwY5+24gmffLQBM4vyGTwJUOMjDkWaQLvhjbvTuYX +y7xX0/mbhLAQ5qPyOESfC2gx6ZSvaXNctGNuEa+BcV74+17XxLrA/BVd9qiVEZhs +peRFScKhz/mfVS6CBJ11arUtB0348em5ACIy/OEnXCSRP56TA0m1+OnZV9zUNJLX +7W9AenWvxTrsgH1SyyUz0vpP9ujfHusWRpMPNy7Ovlp4WP1ntAYnqmPVUZUGBEIy +0nWyTPAXNaPm4TsOCFWl3Ho0DYSyejJ2/nTTmpBXnDxIirba+MMPcu03tJydmBSC +TID4qSR7DCJoYbosj1/88WxQmyC8JwFNnXPAN+VoPd4LtnC+K8urtMEg5wSY7p9G +mQmqLKU2BhTkTn+d5l+7gzL1ILXWSuKEWUj5v813teZ784bMoYLM/q1vsHsjb2vk +tFIxos6tk/xIfFkeFB59gLqavrPZJWTNNW3QIAQPdkYu7GB8y/3de6ujYKiaRlqH +yuC87T5INBWSj+RBpyBLU50gMIIlEnJ56UYN2Lheaom/96ciqydalKJalQzhzpvR +dy5JYXiWn4v5b1Rkyiv0XGVG0OaB//qgsicRBLOFfPQNQ/WaFHaa/QDMpMJrutAw +QMztk5DlEbCOAzRYKjU7v3kCA3VVgXsgUr0dKy+bIUwFJ7jj9GN6PgHQiLIv9bNE +s4vEDp/2XJ7dWwBZo5bnUmgdA8NSuu5JNGD0Xm7de3+1ZBd75N4XrLgTAk4Y4k/O +VYDPeVyAUM2vfbu1sSXcT5hnTDjCuo9gZwPqCnwrDBqe3HjKRgQkf6ErlmcSOAXJ +CU2mjwfbzLvx796o/XCClCAqZPBZJ0KgtWv7TCB4K96G3KBt4h6BmgjhFJIyOIjp +MCBPHI1Nx+Kj+Pf81ItAh08OE1tJT53dGK37dSCCEkjoAAmKQFARvH8RKxGvq/j6 +o7YoQnzIb/fPGrLx8fzYL3t4YeuEdfTiudt1HHneffidQ6PTHlILeEzQ0c+51TJV +D9AT8raAvJjZlwNIyXr4MwVSiIHKW0IIkTrR4IIYshhj9DOfa6MzhrJWfiWRZjXc +4oKMv2mPzzfORi/Ct8JWfU2OKYy5jNsnZM5B/jo+z6MaXx8qZi5r+Lod2F1cQCnp +GoXIni5Ad2E2uhqycCgQ7kb69z7QeuJzpAkQwcHBFBDfNrHW+HfqzD2qQH8hapKI +k2y80EUnCwYjeP7NIY03+iJt02YUR52bVk8WX0AIoZoISwKfG9RA3F7Dsn7SgX3U +aADuVVgE8REAUgJMX9+Y/u5/s3RIjXCwyAf0U9wpT/FhWMEegrwXt86kgxoW4TBf ++2yJSFfgiaTxN4Hx7Xt3/4usyx+hr9K3I1Y0q1M6NGvHfP4w9nb66h/bv1AhgM1J +Tws+TDLS0POG4ZqbzMz6B3cr2NF45tD4zt8ZCoEnyjJKPfMqzsmSauvBHcsQTL7E +GB7Bw9e+UkGBSHCe2ByvYDoBnppS/8Ct4eWEq8FfMQbnrUv+FfIDzhvgsN2LS/iY +VW3mFcsOJKNT81Y2GIUlitU8P8ugF4GjCGHEb1ZHIjxiIb4V+8q5F6KoKMmpguAK +qYSQvlz/uqwRhYrziygIZHPFAhEFaQraRg9fXyH1nWQ2pPqbVnlwFU/7J7FebnpF +huE2rWuEdsNzPWuK/weTjYwEHs/jppirtfQtDtHts9tS8oAIGImVZRXrxvivRdpN +TTrHrgRUaoRnR56OYfTF1eSsjc7CH6nIEtGXIa7RC5WT4cAEH9WwIlis9zXEp/// +xduZMomtAdlhhqwHkpwW0UWETvK6HzyrW2VlDEYvP21WaIsZBnrmeqKFW/pNub9l +33f36uc3/t5vYP5QBsdZiTf2OGK3VZKzxjQL/whxlt9qAxOoHttyb4ZqtxNV/TNv +/EzmlwGSM3iSLuZD0Eckzyw5/3rqDSLqfqZlJDgIBCjCTPInVyMA70MVyryYdbe7 +ADDPRnRkvcny2ncQzlkYCgGJdOABmaaE4ILwh/BknxEC7RBU/4NhflEehSwAjh10 +NensOrg5RBBScZDTKhKZkPM4ixPXCk6enSmXFQKyH2r+lq8vMae1DOM6AeGMrnfE +u+aaGqFA/nDJrK3xwOOyEA== diff --git a/sensitive.sbt.enc b/sensitive.sbt.enc new file mode 100644 index 000000000..d3bf15775 --- /dev/null +++ b/sensitive.sbt.enc @@ -0,0 +1,7 @@ +U2FsdGVkX18gIxRNVlHPw4nCe2cnzM8eT6nuAX3tlZGkm1oWilS9WHMn51Xynkfu +u93EwxakV6ov0Nci2ZfrGQcNYQk+0r/36YfK10wV2BMRFC+xZuu90WjaGkfWrnCZ +Act4ID/vax/k0hHPTIAP7fbYvX0G+zQtyEtGrfuLvfb++BsX/o8Eyv2KaQkz/fYd +PG9iwXd1agN6T3xb7EMu+sKheLNj4erxFCkJqwY525ZqWzvHP9aiSsFSPA/ubUS8 +LeqEU5RvCOo1GoG7qEv/yny4KT/IB5EIeuo8x3uVm8MNMQW+XzEVJBGErMcAWwnF +v0eVpuAeMpTv/rU2VxBkwCE9I5TY3adYD8w9rxXaERGFaNzt48toOVEtY4Eju9AH +uuP2s4VxE/XZtdKSCXc2ZA== From d311980ef5ee86caee189b07714b6a182e9d4e41 Mon Sep 17 00:00:00 2001 From: Adriaan Moors Date: Wed, 3 Dec 2014 18:31:02 -0800 Subject: [PATCH 060/789] Use TRAVIS_TAG because tags are not fetched --- admin/publishPrep.sh | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/admin/publishPrep.sh b/admin/publishPrep.sh index 1914c60b7..e304cf5af 100755 --- a/admin/publishPrep.sh +++ b/admin/publishPrep.sh @@ -2,11 +2,12 @@ # prep environment for publish to sonatype staging if the HEAD commit is tagged -headTag=$(git describe --exact-match ||:) +# git on travis does not fetch tags, but we have TRAVIS_TAG +# headTag=$(git describe --exact-match ||:) -if [[ "$headTag" =~ ^v[0-9]+\.[0-9]+\.[0-9]+(-[A-Za-z0-9-]+)? ]]; then - echo "HEAD is tagged as $headTag." - export publishVersion="set every version := \"$(echo $headTag | sed -e s/^v//)\"" +if [[ "$TRAVIS_TAG" =~ ^v[0-9]+\.[0-9]+\.[0-9]+(-[A-Za-z0-9-]+)? ]]; then + echo "Going to release from tag $TRAVIS_TAG!" + export publishVersion="set every version := \"$(echo $TRAVIS_TAG | sed -e s/^v//)\"" export extraTarget="publish-signed" cat admin/gpg.sbt >> project/plugins.sbt admin/decrypt.sh sensitive.sbt From f3d4451ea57a07ce0fb120367ebb969e3f21e035 Mon Sep 17 00:00:00 2001 From: Adriaan Moors Date: Wed, 3 Dec 2014 18:47:18 -0800 Subject: [PATCH 061/789] Do build in one step: need environment vars --- .travis.yml | 3 +-- admin/{publishPrep.sh => build.sh} | 2 ++ 2 files changed, 3 insertions(+), 2 deletions(-) rename admin/{publishPrep.sh => build.sh} (87%) diff --git a/.travis.yml b/.travis.yml index 3f3c0d2ab..eef483521 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,8 +5,7 @@ language: scala env: - secure: "whJQqI/7G+kUJoCCGQYbv3Y/T2Cx3EcBKfCyvMkZaVgo0wFEOUguh8I+4QqRyf9cC/uPmzwCzV9uwXsNDMcY78jouY05A+fCEnUol/9TuF5PWmXF6Yr/UmmYoCQe4pioXsbXa4uOy18kLzE0h2sOIrJ5A9NL8/58iVgl4E3pwvk=" script: - - admin/publishPrep.sh - - sbt ++$TRAVIS_SCALA_VERSION $publishVersion clean update compile test $extraTarget + - admin/build.sh scala: - 2.11.4 jdk: diff --git a/admin/publishPrep.sh b/admin/build.sh similarity index 87% rename from admin/publishPrep.sh rename to admin/build.sh index e304cf5af..d2794f06a 100755 --- a/admin/publishPrep.sh +++ b/admin/build.sh @@ -13,3 +13,5 @@ if [[ "$TRAVIS_TAG" =~ ^v[0-9]+\.[0-9]+\.[0-9]+(-[A-Za-z0-9-]+)? ]]; then admin/decrypt.sh sensitive.sbt (cd admin/ && ./decrypt.sh secring.asc) fi + +sbt ++$TRAVIS_SCALA_VERSION $publishVersion clean update compile test $extraTarget \ No newline at end of file From d3d1d4ed2bb8910f7c6da254feeed2b55865899d Mon Sep 17 00:00:00 2001 From: Adriaan Moors Date: Wed, 3 Dec 2014 18:52:43 -0800 Subject: [PATCH 062/789] Bash is awesome... --- admin/build.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/admin/build.sh b/admin/build.sh index d2794f06a..221efebf1 100755 --- a/admin/build.sh +++ b/admin/build.sh @@ -7,11 +7,12 @@ if [[ "$TRAVIS_TAG" =~ ^v[0-9]+\.[0-9]+\.[0-9]+(-[A-Za-z0-9-]+)? ]]; then echo "Going to release from tag $TRAVIS_TAG!" - export publishVersion="set every version := \"$(echo $TRAVIS_TAG | sed -e s/^v//)\"" + myVer=$(echo $TRAVIS_TAG | sed -e s/^v//) + export publishVersion='set every scalaVersion := "'$myVer'"' export extraTarget="publish-signed" cat admin/gpg.sbt >> project/plugins.sbt admin/decrypt.sh sensitive.sbt (cd admin/ && ./decrypt.sh secring.asc) fi -sbt ++$TRAVIS_SCALA_VERSION $publishVersion clean update compile test $extraTarget \ No newline at end of file +sbt ++$TRAVIS_SCALA_VERSION "$publishVersion" clean update compile test $extraTarget \ No newline at end of file From 8af41c184afeca7c540344ef56c18aeac827b988 Mon Sep 17 00:00:00 2001 From: Adriaan Moors Date: Wed, 3 Dec 2014 18:56:56 -0800 Subject: [PATCH 063/789] Set version, not scalaVersion. Argh. --- admin/build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/admin/build.sh b/admin/build.sh index 221efebf1..ff665c5e9 100755 --- a/admin/build.sh +++ b/admin/build.sh @@ -8,7 +8,7 @@ if [[ "$TRAVIS_TAG" =~ ^v[0-9]+\.[0-9]+\.[0-9]+(-[A-Za-z0-9-]+)? ]]; then echo "Going to release from tag $TRAVIS_TAG!" myVer=$(echo $TRAVIS_TAG | sed -e s/^v//) - export publishVersion='set every scalaVersion := "'$myVer'"' + export publishVersion='set every version := "'$myVer'"' export extraTarget="publish-signed" cat admin/gpg.sbt >> project/plugins.sbt admin/decrypt.sh sensitive.sbt From 9e674f1f36c07902dc5ee4ee93c3a0e451fbc2af Mon Sep 17 00:00:00 2001 From: Adriaan Moors Date: Thu, 4 Dec 2014 10:39:21 -0800 Subject: [PATCH 064/789] Support for tag-driven publishing on Travis. Modify travis build to derive the project version from TRAVIS_TAG (when set). as well as to have sbt run the `publish-signed` task if the environment is right. The tag must match the semver regex `^v[0-9]+\.[0-9]+\.[0-9]+(-[A-Za-z0-9-]+)?`, and the jdk we're running on must match PUBLISH_JDK (set in .travis.yml). For every repo, you must create the following files (not included here) according to the instructions in admin/gpg.sbt: - admin/pubring.asc (commit) - admin/secring.asc (DO NOT COMMIT) - sensitive.sbt (DO NOT COMMIT) - passphrase for secring.asc - api token for staging to sonatype Generate these using `admin/encryptAll.sh`: - admin/secring.asc.enc (commit) - sensitive.sbt.enc (commit) Note that `encryptAll.sh` spits out a "- secure .... " line, that you need to add to `.travis.yml`'s `env` section, so that travis can supply the SECRET env variable, which is used to decrypt the sensitive files above. --- .travis.yml | 11 ++++++++++- admin/build.sh | 19 +++++++++++++++++++ admin/decrypt.sh | 2 ++ admin/encrypt.sh | 2 ++ admin/encryptAll.sh | 19 +++++++++++++++++++ admin/gpg.sbt | 21 +++++++++++++++++++++ 6 files changed, 73 insertions(+), 1 deletion(-) create mode 100755 admin/build.sh create mode 100755 admin/decrypt.sh create mode 100755 admin/encrypt.sh create mode 100755 admin/encryptAll.sh create mode 100644 admin/gpg.sbt diff --git a/.travis.yml b/.travis.yml index ede527c59..e530d5873 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,15 @@ language: scala + +env: + global: + - PUBLISH_JDK=openjdk6 # admin/build.sh only publishes when running on this jdk +# Don't commit sensitive files, instead commit a version encrypted with $SECRET, +# this environment variable is encrypted with this repo's private key and stored below: +# (See http://docs.travis-ci.com/user/environment-variables/#Secure-Variables.) +# - secure: + script: - - sbt ++$TRAVIS_SCALA_VERSION clean update compile test + - admin/build.sh scala: - 2.11.4 jdk: diff --git a/admin/build.sh b/admin/build.sh new file mode 100755 index 000000000..3c7f4b6c8 --- /dev/null +++ b/admin/build.sh @@ -0,0 +1,19 @@ +#!/bin/bash + +# prep environment for publish to sonatype staging if the HEAD commit is tagged + +# git on travis does not fetch tags, but we have TRAVIS_TAG +# headTag=$(git describe --exact-match ||:) + +if [ "$TRAVIS_JDK_VERSION" == "$PUBLISH_JDK" ] && [[ "$TRAVIS_TAG" =~ ^v[0-9]+\.[0-9]+\.[0-9]+(-[A-Za-z0-9-]+)? ]]; then + echo "Going to release from tag $TRAVIS_TAG!" + myVer=$(echo $TRAVIS_TAG | sed -e s/^v//) + publishVersion='set every version := "'$myVer'"' + extraTarget="publish-signed" + + cat admin/gpg.sbt >> project/plugins.sbt + admin/decrypt.sh sensitive.sbt + (cd admin/ && ./decrypt.sh secring.asc) +fi + +sbt ++$TRAVIS_SCALA_VERSION "$publishVersion" clean update compile test $extraTarget \ No newline at end of file diff --git a/admin/decrypt.sh b/admin/decrypt.sh new file mode 100755 index 000000000..3c3c602f0 --- /dev/null +++ b/admin/decrypt.sh @@ -0,0 +1,2 @@ +#!/bin/bash +openssl aes-256-cbc -pass "pass:$SECRET" -in $1.enc -out $1 -d -a \ No newline at end of file diff --git a/admin/encrypt.sh b/admin/encrypt.sh new file mode 100755 index 000000000..4bf6c9329 --- /dev/null +++ b/admin/encrypt.sh @@ -0,0 +1,2 @@ +#!/bin/bash +openssl aes-256-cbc -pass "pass:$SECRET" -in $1 -out $1.enc -a \ No newline at end of file diff --git a/admin/encryptAll.sh b/admin/encryptAll.sh new file mode 100755 index 000000000..de7016b75 --- /dev/null +++ b/admin/encryptAll.sh @@ -0,0 +1,19 @@ +#!/bin/bash + +# Based on https://gist.github.com/kzap/5819745: + +echo "This will encrypt the cleartext sensitive.sbt and admin/secring.asc, while making the encrypted versions available for decryption on Travis." +echo "Update your .travis.yml as directed, and delete the cleartext versions." +echo "Press enter to continue." +read + +# 1. create a secret, put it in an environment variable while encrypting files -- UNSET IT AFTER +export SECRET=$(cat /dev/urandom | head -c 10000 | openssl sha1) + +# 2. add the "secure: ..." line under the env section -- generate it with `` (install the travis gem first) +travis encrypt SECRET=$SECRET + +admin/encrypt.sh admin/secring.asc +admin/encrypt.sh sensitive.sbt + +echo "Remember to rm sensitive.sbt admin/secring.asc -- once you do, they cannot be recovered (except on Travis)!" \ No newline at end of file diff --git a/admin/gpg.sbt b/admin/gpg.sbt new file mode 100644 index 000000000..6ec4213ea --- /dev/null +++ b/admin/gpg.sbt @@ -0,0 +1,21 @@ +// only added when publishing: +addSbtPlugin("com.typesafe.sbt" % "sbt-pgp" % "0.8.3") + +/* There's a companion sensitive.sbt, which was created like this: + +1. in an sbt shell when sbt-gpg is loaded, create pgp key in admin/: + + set pgpReadOnly := false + pgp-cmd gen-key // use $passPhrase + pgp-cmd send-key hkp://keyserver.ubuntu.com + +2. create sensitive.sbt with contents: + +pgpPassphrase := Some($passPhrase.toArray) + +pgpPublicRing := file("admin/pubring.asc") + +pgpSecretRing := file("admin/secring.asc") + +credentials += Credentials("Sonatype Nexus Repository Manager", "oss.sonatype.org", $sonaUser, $sonaPass) +*/ From b68e4497e07dfa0f8473b37ee8897c99bb823bc4 Mon Sep 17 00:00:00 2001 From: Adriaan Moors Date: Thu, 4 Dec 2014 11:20:33 -0800 Subject: [PATCH 065/789] Secure config for publishing this repo. --- .travis.yml | 2 +- admin/pubring.asc | 18 ++++++++++++++++++ admin/secring.asc.enc | 40 ++++++++++++++++++++++++++++++++++++++++ sensitive.sbt.enc | 7 +++++++ 4 files changed, 66 insertions(+), 1 deletion(-) create mode 100644 admin/pubring.asc create mode 100644 admin/secring.asc.enc create mode 100644 sensitive.sbt.enc diff --git a/.travis.yml b/.travis.yml index e530d5873..33c33702f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,7 +6,7 @@ env: # Don't commit sensitive files, instead commit a version encrypted with $SECRET, # this environment variable is encrypted with this repo's private key and stored below: # (See http://docs.travis-ci.com/user/environment-variables/#Secure-Variables.) -# - secure: + - secure: "whJQqI/7G+kUJoCCGQYbv3Y/T2Cx3EcBKfCyvMkZaVgo0wFEOUguh8I+4QqRyf9cC/uPmzwCzV9uwXsNDMcY78jouY05A+fCEnUol/9TuF5PWmXF6Yr/UmmYoCQe4pioXsbXa4uOy18kLzE0h2sOIrJ5A9NL8/58iVgl4E3pwvk=" script: - admin/build.sh diff --git a/admin/pubring.asc b/admin/pubring.asc new file mode 100644 index 000000000..61de5ecf0 --- /dev/null +++ b/admin/pubring.asc @@ -0,0 +1,18 @@ +-----BEGIN PGP PUBLIC KEY BLOCK----- +Version: BCPG v1.49 + +mQENBFR/wRIBCACgRrOC5zAzSuuhf35NVzAG3K6xADFcxSKtxyIKydvlzhgdTuH8 +MvqLaQvo0gOQ/32DEnBy0DbDu8WEDvpZzEM21eTz/VW9VDb0fbNEXoLODY+IYt+v +ohsw0NzQV6qSk2WQVYWVuZbfZXZBT3/JoDxHKRRl/IvZb8CQkRypxKVmsud/IOsu +t/hHRWzbgPtNJNUX0Uhrz96P0+LcKfwUt34TMBIyfSY9C3ZPzPYTlhuDqtJunKTj +NZljt9cbAMjJsuw0rSYNkAb5kGblguUn7BLp5Ngox6h7/MP7v1YM7WsXa3oMcHyX +0Rf3PPE8HELcfsbF+FAN3jCNWgaz15bCz3lhABEBAAG0LHNjYWxhLXhtbCA8c2Nh +bGEtaW50ZXJuYWxzQGdvb2dsZWdyb3Vwcy5jb20+iQEcBBMBAgAGBQJUf8ESAAoJ +EIbbEE4RFVfeHWgH/1B5U+UT/lx8Z/V3qK3EfsVVM5nbcJqy+jRC9mNsO4VSX7+G +rNuIn6oZ08SZKcmzWo71i9uqatgaFtVHhLbOJ9a72Ja8YoBSKerv6gpcFcAH4fDB +m5FyoxbM0K9vLwUvkbewNLLK8XbWwuCuHTmtEW2WPv2d/PmyOXuXoos/E1HiPTkU +iN5TIuJYpDvy7cxQL0qlaEcpWjzXHyy6+BFA1C8zlwoX+2iAx1rVGd3mPDHNgY+U +Z3MYArHxu5QC3BZs2wsD9/SkioanFhzH4g/MB1qaQlD2WGqXwoDK2/Bsnu5pJaPA +QhCuqobGMQ8Umupnejt8fIIQ/8A99sneBU+eEB8= +=450t +-----END PGP PUBLIC KEY BLOCK----- diff --git a/admin/secring.asc.enc b/admin/secring.asc.enc new file mode 100644 index 000000000..25ed5cc2d --- /dev/null +++ b/admin/secring.asc.enc @@ -0,0 +1,40 @@ +U2FsdGVkX1/9hpS9pNHRzznj4yQKe9noi3duTRAp0JhO2nHrJwtDWdRcEBZXeWto +7wbM7Ji+R4gqdNd3bb2UO8+NTcOtBE0/toioD/MV2fTTffzVVYwBvmknfknIcOdZ +9pyfMvpwcdrZ+KSSGkg0xowac2bjVaO7i54DECxA2mMs5sqev/SiatnmsD6i5I5h +Wif7bdaTqBOHIxJ70776iUc0Z+2auOc73by1MUPhR2ceh93KmavM6rkHk2JrzNj/ +wCwbgXLoC1NjQfgWM1tWIa1v7l1ZsvrU0ozz7ls3IR79EKGYvB0us+Qz0YUiv+Sn +f237bzy/7PRB5bQTIHe9VWOMNGKgML4vw4VAZ59EMkiBDOCzWRCpfa4xdZJvYkrw +K95/Lx4GhHI/i6/E6TGgzaJSwY5+24gmffLQBM4vyGTwJUOMjDkWaQLvhjbvTuYX +y7xX0/mbhLAQ5qPyOESfC2gx6ZSvaXNctGNuEa+BcV74+17XxLrA/BVd9qiVEZhs +peRFScKhz/mfVS6CBJ11arUtB0348em5ACIy/OEnXCSRP56TA0m1+OnZV9zUNJLX +7W9AenWvxTrsgH1SyyUz0vpP9ujfHusWRpMPNy7Ovlp4WP1ntAYnqmPVUZUGBEIy +0nWyTPAXNaPm4TsOCFWl3Ho0DYSyejJ2/nTTmpBXnDxIirba+MMPcu03tJydmBSC +TID4qSR7DCJoYbosj1/88WxQmyC8JwFNnXPAN+VoPd4LtnC+K8urtMEg5wSY7p9G +mQmqLKU2BhTkTn+d5l+7gzL1ILXWSuKEWUj5v813teZ784bMoYLM/q1vsHsjb2vk +tFIxos6tk/xIfFkeFB59gLqavrPZJWTNNW3QIAQPdkYu7GB8y/3de6ujYKiaRlqH +yuC87T5INBWSj+RBpyBLU50gMIIlEnJ56UYN2Lheaom/96ciqydalKJalQzhzpvR +dy5JYXiWn4v5b1Rkyiv0XGVG0OaB//qgsicRBLOFfPQNQ/WaFHaa/QDMpMJrutAw +QMztk5DlEbCOAzRYKjU7v3kCA3VVgXsgUr0dKy+bIUwFJ7jj9GN6PgHQiLIv9bNE +s4vEDp/2XJ7dWwBZo5bnUmgdA8NSuu5JNGD0Xm7de3+1ZBd75N4XrLgTAk4Y4k/O +VYDPeVyAUM2vfbu1sSXcT5hnTDjCuo9gZwPqCnwrDBqe3HjKRgQkf6ErlmcSOAXJ +CU2mjwfbzLvx796o/XCClCAqZPBZJ0KgtWv7TCB4K96G3KBt4h6BmgjhFJIyOIjp +MCBPHI1Nx+Kj+Pf81ItAh08OE1tJT53dGK37dSCCEkjoAAmKQFARvH8RKxGvq/j6 +o7YoQnzIb/fPGrLx8fzYL3t4YeuEdfTiudt1HHneffidQ6PTHlILeEzQ0c+51TJV +D9AT8raAvJjZlwNIyXr4MwVSiIHKW0IIkTrR4IIYshhj9DOfa6MzhrJWfiWRZjXc +4oKMv2mPzzfORi/Ct8JWfU2OKYy5jNsnZM5B/jo+z6MaXx8qZi5r+Lod2F1cQCnp +GoXIni5Ad2E2uhqycCgQ7kb69z7QeuJzpAkQwcHBFBDfNrHW+HfqzD2qQH8hapKI +k2y80EUnCwYjeP7NIY03+iJt02YUR52bVk8WX0AIoZoISwKfG9RA3F7Dsn7SgX3U +aADuVVgE8REAUgJMX9+Y/u5/s3RIjXCwyAf0U9wpT/FhWMEegrwXt86kgxoW4TBf ++2yJSFfgiaTxN4Hx7Xt3/4usyx+hr9K3I1Y0q1M6NGvHfP4w9nb66h/bv1AhgM1J +Tws+TDLS0POG4ZqbzMz6B3cr2NF45tD4zt8ZCoEnyjJKPfMqzsmSauvBHcsQTL7E +GB7Bw9e+UkGBSHCe2ByvYDoBnppS/8Ct4eWEq8FfMQbnrUv+FfIDzhvgsN2LS/iY +VW3mFcsOJKNT81Y2GIUlitU8P8ugF4GjCGHEb1ZHIjxiIb4V+8q5F6KoKMmpguAK +qYSQvlz/uqwRhYrziygIZHPFAhEFaQraRg9fXyH1nWQ2pPqbVnlwFU/7J7FebnpF +huE2rWuEdsNzPWuK/weTjYwEHs/jppirtfQtDtHts9tS8oAIGImVZRXrxvivRdpN +TTrHrgRUaoRnR56OYfTF1eSsjc7CH6nIEtGXIa7RC5WT4cAEH9WwIlis9zXEp/// +xduZMomtAdlhhqwHkpwW0UWETvK6HzyrW2VlDEYvP21WaIsZBnrmeqKFW/pNub9l +33f36uc3/t5vYP5QBsdZiTf2OGK3VZKzxjQL/whxlt9qAxOoHttyb4ZqtxNV/TNv +/EzmlwGSM3iSLuZD0Eckzyw5/3rqDSLqfqZlJDgIBCjCTPInVyMA70MVyryYdbe7 +ADDPRnRkvcny2ncQzlkYCgGJdOABmaaE4ILwh/BknxEC7RBU/4NhflEehSwAjh10 +NensOrg5RBBScZDTKhKZkPM4ixPXCk6enSmXFQKyH2r+lq8vMae1DOM6AeGMrnfE +u+aaGqFA/nDJrK3xwOOyEA== diff --git a/sensitive.sbt.enc b/sensitive.sbt.enc new file mode 100644 index 000000000..d3bf15775 --- /dev/null +++ b/sensitive.sbt.enc @@ -0,0 +1,7 @@ +U2FsdGVkX18gIxRNVlHPw4nCe2cnzM8eT6nuAX3tlZGkm1oWilS9WHMn51Xynkfu +u93EwxakV6ov0Nci2ZfrGQcNYQk+0r/36YfK10wV2BMRFC+xZuu90WjaGkfWrnCZ +Act4ID/vax/k0hHPTIAP7fbYvX0G+zQtyEtGrfuLvfb++BsX/o8Eyv2KaQkz/fYd +PG9iwXd1agN6T3xb7EMu+sKheLNj4erxFCkJqwY525ZqWzvHP9aiSsFSPA/ubUS8 +LeqEU5RvCOo1GoG7qEv/yny4KT/IB5EIeuo8x3uVm8MNMQW+XzEVJBGErMcAWwnF +v0eVpuAeMpTv/rU2VxBkwCE9I5TY3adYD8w9rxXaERGFaNzt48toOVEtY4Eju9AH +uuP2s4VxE/XZtdKSCXc2ZA== From 9980137e58f21c1ce48463d88bb7fce5bfb769d8 Mon Sep 17 00:00:00 2001 From: Adriaan Moors Date: Thu, 4 Dec 2014 11:29:36 -0800 Subject: [PATCH 066/789] Version bump. --- build.sbt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build.sbt b/build.sbt index cfd9c871a..81f5dce08 100644 --- a/build.sbt +++ b/build.sbt @@ -4,9 +4,9 @@ scalaModuleSettings name := "scala-xml" -version := "1.0.2-SNAPSHOT" +version := "1.0.3-SNAPSHOT" -scalaVersion := "2.11.0" +scalaVersion := "2.11.4" snapshotScalaBinaryVersion := "2.11" From 7dbdd39c7fe0a86b6eb66d9ec71ebed008615c3c Mon Sep 17 00:00:00 2001 From: kenji yoshida <6b656e6a69@gmail.com> Date: Sun, 14 Dec 2014 14:35:10 +0900 Subject: [PATCH 067/789] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 40ba3236f..1b9e79747 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ API documentation is available [here](http://www.scala-lang.org/api/current/scal To depend on scala-xml in SBT, add something like this to your build.sbt: ``` -libraryDependencies += "org.scala-lang.modules" %% "scala-xml" % "1.0.2" +libraryDependencies += "org.scala-lang.modules" %% "scala-xml" % "1.0.3" ``` Maven users, or sbt users looking to support multiple Scala versions, please see the more elaborate example in https://github.com/scala/scala-module-dependency-sample. From a34336b94083dd19efe8103814c3c151f82bb2f9 Mon Sep 17 00:00:00 2001 From: Adriaan Moors Date: Mon, 16 Mar 2015 15:58:06 -0700 Subject: [PATCH 068/789] Added link to secure parsing best practice --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index 1b9e79747..44ead2c76 100644 --- a/README.md +++ b/README.md @@ -13,6 +13,9 @@ The compiler was decoupled from this particular implementation using the same ap API documentation is available [here](http://www.scala-lang.org/api/current/scala-xml/). +## Security best practices +The XML spec has some features that are best turned off, to avoid unsavory things like file system access, DoS attacks,... Issue [#17](https://github.com/scala/scala-xml/issues/17) tracks the recommended way of configuring the xml parser used by scala-xml to avoid these. This is by no means an exhaustive list. We'll be happy to incorporate your suggestions -- just comment on the ticket! + ## Adding an SBT dependency To depend on scala-xml in SBT, add something like this to your build.sbt: From 4c3b8a2181dc52462d9c8a492505e85a4fbdddab Mon Sep 17 00:00:00 2001 From: Chris Loy Date: Sat, 11 Apr 2015 11:41:01 +0100 Subject: [PATCH 069/789] Default to TopScope when formatting multiple nodes --- src/main/scala/scala/xml/PrettyPrinter.scala | 2 +- src/test/scala/scala/xml/XMLTest.scala | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/main/scala/scala/xml/PrettyPrinter.scala b/src/main/scala/scala/xml/PrettyPrinter.scala index a175f1df2..99a0e4a36 100755 --- a/src/main/scala/scala/xml/PrettyPrinter.scala +++ b/src/main/scala/scala/xml/PrettyPrinter.scala @@ -253,7 +253,7 @@ class PrettyPrinter(width: Int, step: Int) { * @param nodes the sequence of nodes to be serialized * @param pscope the namespace to prefix mapping */ - def formatNodes(nodes: Seq[Node], pscope: NamespaceBinding = null): String = + def formatNodes(nodes: Seq[Node], pscope: NamespaceBinding = TopScope): String = sbToString(formatNodes(nodes, pscope, _)) /** diff --git a/src/test/scala/scala/xml/XMLTest.scala b/src/test/scala/scala/xml/XMLTest.scala index 01431baf1..380a39dbf 100644 --- a/src/test/scala/scala/xml/XMLTest.scala +++ b/src/test/scala/scala/xml/XMLTest.scala @@ -836,4 +836,14 @@ expected closing tag of foo assertEquals("""""", pp.format(x)) } + @UnitTest + def nodeSeqNs: Unit = { + val x = { + + } + val pp = new PrettyPrinter(80, 2) + val expected = """""" + assertEquals(expected, pp.formatNodes(x)) + } + } From 7243aa08f590d52efaf80ab2313e3cbc443e45bb Mon Sep 17 00:00:00 2001 From: Chris Loy Date: Mon, 13 Apr 2015 23:29:54 +0100 Subject: [PATCH 070/789] Default to TopScope if printing with StringBuilder --- src/main/scala/scala/xml/PrettyPrinter.scala | 2 +- src/test/scala/scala/xml/XMLTest.scala | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/main/scala/scala/xml/PrettyPrinter.scala b/src/main/scala/scala/xml/PrettyPrinter.scala index 99a0e4a36..4f1024e1a 100755 --- a/src/main/scala/scala/xml/PrettyPrinter.scala +++ b/src/main/scala/scala/xml/PrettyPrinter.scala @@ -203,7 +203,7 @@ class PrettyPrinter(width: Int, step: Int) { * @param sb the stringbuffer to append to */ def format(n: Node, sb: StringBuilder) { // entry point - format(n, null, sb) + format(n, TopScope, sb) } def format(n: Node, pscope: NamespaceBinding, sb: StringBuilder) { // entry point diff --git a/src/test/scala/scala/xml/XMLTest.scala b/src/test/scala/scala/xml/XMLTest.scala index 380a39dbf..23c143396 100644 --- a/src/test/scala/scala/xml/XMLTest.scala +++ b/src/test/scala/scala/xml/XMLTest.scala @@ -846,4 +846,15 @@ expected closing tag of foo assertEquals(expected, pp.formatNodes(x)) } + @UnitTest + def nodeStringBuilder: Unit = { + val x = { + + } + val pp = new PrettyPrinter(80, 2) + val expected = """""" + val sb = new StringBuilder + pp.format(x, sb) + assertEquals(expected, sb.toString) + } } From b7b2deb88cfbe155ac7e81dfcfe9104612b274b9 Mon Sep 17 00:00:00 2001 From: Lukas Rytz Date: Thu, 30 Apr 2015 12:17:31 +0200 Subject: [PATCH 071/789] Update the scala-modules plugin to 1.0.3 Also update version to 1.0.4-SNAPSHOT, since 1.0.3 is out. --- build.sbt | 14 ++------------ project/build.properties | 2 +- project/plugins.sbt | 4 +--- 3 files changed, 4 insertions(+), 16 deletions(-) diff --git a/build.sbt b/build.sbt index 81f5dce08..eac2ad1bc 100644 --- a/build.sbt +++ b/build.sbt @@ -4,12 +4,10 @@ scalaModuleSettings name := "scala-xml" -version := "1.0.3-SNAPSHOT" +version := "1.0.4-SNAPSHOT" scalaVersion := "2.11.4" -snapshotScalaBinaryVersion := "2.11" - // important!! must come here (why?) scalaModuleOsgiSettings @@ -23,12 +21,4 @@ libraryDependencies += "com.novocode" % "junit-interface" % "0.10" % "test" // used in CompilerErrors test libraryDependencies += ("org.scala-lang" % "scala-compiler" % scalaVersion.value % "test").exclude("org.scala-lang.modules", s"scala-xml*") -MimaPlugin.mimaDefaultSettings - -MimaKeys.previousArtifact := Some(organization.value % s"${name.value}_2.11" % "1.0.1") - -// run mima during tests -test in Test := { - MimaKeys.reportBinaryIssues.value - (test in Test).value -} +mimaPreviousVersion := Some("1.0.1") diff --git a/project/build.properties b/project/build.properties index 748703f77..a6e117b61 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version=0.13.7 +sbt.version=0.13.8 diff --git a/project/plugins.sbt b/project/plugins.sbt index bc60ad6cf..25f337310 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,3 +1 @@ -addSbtPlugin("org.scala-lang.modules" % "scala-module-plugin" % "1.0.2") - -addSbtPlugin("com.typesafe" % "sbt-mima-plugin" % "0.1.6") \ No newline at end of file +addSbtPlugin("org.scala-lang.modules" % "scala-module-plugin" % "1.0.3") From 829903b769ffbfca2d1bc6dae31cd9de2f3e9393 Mon Sep 17 00:00:00 2001 From: Lukas Rytz Date: Thu, 30 Apr 2015 13:10:52 +0200 Subject: [PATCH 072/789] update version numbers for v1.0.4 --- README.md | 2 +- build.sbt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 44ead2c76..f9b54629f 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ The XML spec has some features that are best turned off, to avoid unsavory thing To depend on scala-xml in SBT, add something like this to your build.sbt: ``` -libraryDependencies += "org.scala-lang.modules" %% "scala-xml" % "1.0.3" +libraryDependencies += "org.scala-lang.modules" %% "scala-xml" % "1.0.4" ``` Maven users, or sbt users looking to support multiple Scala versions, please see the more elaborate example in https://github.com/scala/scala-module-dependency-sample. diff --git a/build.sbt b/build.sbt index eac2ad1bc..b97e13faf 100644 --- a/build.sbt +++ b/build.sbt @@ -4,7 +4,7 @@ scalaModuleSettings name := "scala-xml" -version := "1.0.4-SNAPSHOT" +version := "1.0.5-SNAPSHOT" scalaVersion := "2.11.4" From 5e1a15181a652fe3070c917ca017a16a553e0477 Mon Sep 17 00:00:00 2001 From: Lukas Rytz Date: Tue, 5 May 2015 10:18:05 +0200 Subject: [PATCH 073/789] Update README.md --- README.md | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index f9b54629f..3e8402ebc 100644 --- a/README.md +++ b/README.md @@ -2,12 +2,13 @@ Maintainer wanted! ================== Would you like to maintain this project? (Please open an issue/send an email!) -scala-xml [](https://travis-ci.org/scala/scala-xml) +scala-xml [](https://travis-ci.org/scala/scala-xml) [](http://search.maven.org/#search%7Cga%7C1%7Cg%3Aorg.scala-lang.modules%20a%3Ascala-xml_2.11) [](http://search.maven.org/#search%7Cga%7C1%7Cg%3Aorg.scala-lang.modules%20a%3Ascala-xml_2.12*) ========= The standard Scala XML library. Please file issues here instead of over at issues.scala-lang.org. As of Scala 2.11, this library is a separate jar that can be omitted from Scala projects that do not use XML. +If you are cross-building a project that uses scala-xml with Scala 2.10 and Scala 2.11, take a look [this example](https://github.com/scala/scala-module-dependency-sample). The compiler was decoupled from this particular implementation using the same approach as for comprehensions (xml syntax is desugared into a set of method calls, which unfortunately is only defined by the [implementation](https://github.com/scala/scala/blob/2.11.x/src/compiler/scala/tools/nsc/ast/parser/SymbolicXMLBuilder.scala)). Alternative implementations are welcome! @@ -15,12 +16,3 @@ API documentation is available [here](http://www.scala-lang.org/api/current/scal ## Security best practices The XML spec has some features that are best turned off, to avoid unsavory things like file system access, DoS attacks,... Issue [#17](https://github.com/scala/scala-xml/issues/17) tracks the recommended way of configuring the xml parser used by scala-xml to avoid these. This is by no means an exhaustive list. We'll be happy to incorporate your suggestions -- just comment on the ticket! - -## Adding an SBT dependency -To depend on scala-xml in SBT, add something like this to your build.sbt: - -``` -libraryDependencies += "org.scala-lang.modules" %% "scala-xml" % "1.0.4" -``` - -Maven users, or sbt users looking to support multiple Scala versions, please see the more elaborate example in https://github.com/scala/scala-module-dependency-sample. From 6b479d74a1c8d86d3581afe875383c897f05dd7c Mon Sep 17 00:00:00 2001 From: Lukas Rytz Date: Mon, 11 May 2015 14:34:00 +0200 Subject: [PATCH 074/789] Remove current travis publishing infrastructure --- .travis.yml | 19 ++----------------- admin/build.sh | 19 ------------------- admin/decrypt.sh | 2 -- admin/encrypt.sh | 2 -- admin/encryptAll.sh | 19 ------------------- admin/gpg.sbt | 21 --------------------- admin/pubring.asc | 18 ------------------ admin/secring.asc.enc | 40 ---------------------------------------- 8 files changed, 2 insertions(+), 138 deletions(-) delete mode 100755 admin/build.sh delete mode 100755 admin/decrypt.sh delete mode 100755 admin/encrypt.sh delete mode 100755 admin/encryptAll.sh delete mode 100644 admin/gpg.sbt delete mode 100644 admin/pubring.asc delete mode 100644 admin/secring.asc.enc diff --git a/.travis.yml b/.travis.yml index 33c33702f..f35a75d08 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,23 +1,8 @@ language: scala -env: - global: - - PUBLISH_JDK=openjdk6 # admin/build.sh only publishes when running on this jdk -# Don't commit sensitive files, instead commit a version encrypted with $SECRET, -# this environment variable is encrypted with this repo's private key and stored below: -# (See http://docs.travis-ci.com/user/environment-variables/#Secure-Variables.) - - secure: "whJQqI/7G+kUJoCCGQYbv3Y/T2Cx3EcBKfCyvMkZaVgo0wFEOUguh8I+4QqRyf9cC/uPmzwCzV9uwXsNDMcY78jouY05A+fCEnUol/9TuF5PWmXF6Yr/UmmYoCQe4pioXsbXa4uOy18kLzE0h2sOIrJ5A9NL8/58iVgl4E3pwvk=" - -script: - - admin/build.sh -scala: - - 2.11.4 +script: sbt clean update test publishLocal jdk: - openjdk6 - openjdk7 notifications: - email: - - adriaan.moors@typesafe.com - -# if we get weird timeouts, see https://github.com/spray/spray/pull/233 -# 'set concurrentRestrictions in Global += Tags.limit(Tags.Test, 1)' + email: adriaan.moors@typesafe.com diff --git a/admin/build.sh b/admin/build.sh deleted file mode 100755 index 3c7f4b6c8..000000000 --- a/admin/build.sh +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/bash - -# prep environment for publish to sonatype staging if the HEAD commit is tagged - -# git on travis does not fetch tags, but we have TRAVIS_TAG -# headTag=$(git describe --exact-match ||:) - -if [ "$TRAVIS_JDK_VERSION" == "$PUBLISH_JDK" ] && [[ "$TRAVIS_TAG" =~ ^v[0-9]+\.[0-9]+\.[0-9]+(-[A-Za-z0-9-]+)? ]]; then - echo "Going to release from tag $TRAVIS_TAG!" - myVer=$(echo $TRAVIS_TAG | sed -e s/^v//) - publishVersion='set every version := "'$myVer'"' - extraTarget="publish-signed" - - cat admin/gpg.sbt >> project/plugins.sbt - admin/decrypt.sh sensitive.sbt - (cd admin/ && ./decrypt.sh secring.asc) -fi - -sbt ++$TRAVIS_SCALA_VERSION "$publishVersion" clean update compile test $extraTarget \ No newline at end of file diff --git a/admin/decrypt.sh b/admin/decrypt.sh deleted file mode 100755 index 3c3c602f0..000000000 --- a/admin/decrypt.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/bash -openssl aes-256-cbc -pass "pass:$SECRET" -in $1.enc -out $1 -d -a \ No newline at end of file diff --git a/admin/encrypt.sh b/admin/encrypt.sh deleted file mode 100755 index 4bf6c9329..000000000 --- a/admin/encrypt.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/bash -openssl aes-256-cbc -pass "pass:$SECRET" -in $1 -out $1.enc -a \ No newline at end of file diff --git a/admin/encryptAll.sh b/admin/encryptAll.sh deleted file mode 100755 index de7016b75..000000000 --- a/admin/encryptAll.sh +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/bash - -# Based on https://gist.github.com/kzap/5819745: - -echo "This will encrypt the cleartext sensitive.sbt and admin/secring.asc, while making the encrypted versions available for decryption on Travis." -echo "Update your .travis.yml as directed, and delete the cleartext versions." -echo "Press enter to continue." -read - -# 1. create a secret, put it in an environment variable while encrypting files -- UNSET IT AFTER -export SECRET=$(cat /dev/urandom | head -c 10000 | openssl sha1) - -# 2. add the "secure: ..." line under the env section -- generate it with `` (install the travis gem first) -travis encrypt SECRET=$SECRET - -admin/encrypt.sh admin/secring.asc -admin/encrypt.sh sensitive.sbt - -echo "Remember to rm sensitive.sbt admin/secring.asc -- once you do, they cannot be recovered (except on Travis)!" \ No newline at end of file diff --git a/admin/gpg.sbt b/admin/gpg.sbt deleted file mode 100644 index 6ec4213ea..000000000 --- a/admin/gpg.sbt +++ /dev/null @@ -1,21 +0,0 @@ -// only added when publishing: -addSbtPlugin("com.typesafe.sbt" % "sbt-pgp" % "0.8.3") - -/* There's a companion sensitive.sbt, which was created like this: - -1. in an sbt shell when sbt-gpg is loaded, create pgp key in admin/: - - set pgpReadOnly := false - pgp-cmd gen-key // use $passPhrase - pgp-cmd send-key hkp://keyserver.ubuntu.com - -2. create sensitive.sbt with contents: - -pgpPassphrase := Some($passPhrase.toArray) - -pgpPublicRing := file("admin/pubring.asc") - -pgpSecretRing := file("admin/secring.asc") - -credentials += Credentials("Sonatype Nexus Repository Manager", "oss.sonatype.org", $sonaUser, $sonaPass) -*/ diff --git a/admin/pubring.asc b/admin/pubring.asc deleted file mode 100644 index 61de5ecf0..000000000 --- a/admin/pubring.asc +++ /dev/null @@ -1,18 +0,0 @@ ------BEGIN PGP PUBLIC KEY BLOCK----- -Version: BCPG v1.49 - -mQENBFR/wRIBCACgRrOC5zAzSuuhf35NVzAG3K6xADFcxSKtxyIKydvlzhgdTuH8 -MvqLaQvo0gOQ/32DEnBy0DbDu8WEDvpZzEM21eTz/VW9VDb0fbNEXoLODY+IYt+v -ohsw0NzQV6qSk2WQVYWVuZbfZXZBT3/JoDxHKRRl/IvZb8CQkRypxKVmsud/IOsu -t/hHRWzbgPtNJNUX0Uhrz96P0+LcKfwUt34TMBIyfSY9C3ZPzPYTlhuDqtJunKTj -NZljt9cbAMjJsuw0rSYNkAb5kGblguUn7BLp5Ngox6h7/MP7v1YM7WsXa3oMcHyX -0Rf3PPE8HELcfsbF+FAN3jCNWgaz15bCz3lhABEBAAG0LHNjYWxhLXhtbCA8c2Nh -bGEtaW50ZXJuYWxzQGdvb2dsZWdyb3Vwcy5jb20+iQEcBBMBAgAGBQJUf8ESAAoJ -EIbbEE4RFVfeHWgH/1B5U+UT/lx8Z/V3qK3EfsVVM5nbcJqy+jRC9mNsO4VSX7+G -rNuIn6oZ08SZKcmzWo71i9uqatgaFtVHhLbOJ9a72Ja8YoBSKerv6gpcFcAH4fDB -m5FyoxbM0K9vLwUvkbewNLLK8XbWwuCuHTmtEW2WPv2d/PmyOXuXoos/E1HiPTkU -iN5TIuJYpDvy7cxQL0qlaEcpWjzXHyy6+BFA1C8zlwoX+2iAx1rVGd3mPDHNgY+U -Z3MYArHxu5QC3BZs2wsD9/SkioanFhzH4g/MB1qaQlD2WGqXwoDK2/Bsnu5pJaPA -QhCuqobGMQ8Umupnejt8fIIQ/8A99sneBU+eEB8= -=450t ------END PGP PUBLIC KEY BLOCK----- diff --git a/admin/secring.asc.enc b/admin/secring.asc.enc deleted file mode 100644 index 25ed5cc2d..000000000 --- a/admin/secring.asc.enc +++ /dev/null @@ -1,40 +0,0 @@ -U2FsdGVkX1/9hpS9pNHRzznj4yQKe9noi3duTRAp0JhO2nHrJwtDWdRcEBZXeWto -7wbM7Ji+R4gqdNd3bb2UO8+NTcOtBE0/toioD/MV2fTTffzVVYwBvmknfknIcOdZ -9pyfMvpwcdrZ+KSSGkg0xowac2bjVaO7i54DECxA2mMs5sqev/SiatnmsD6i5I5h -Wif7bdaTqBOHIxJ70776iUc0Z+2auOc73by1MUPhR2ceh93KmavM6rkHk2JrzNj/ -wCwbgXLoC1NjQfgWM1tWIa1v7l1ZsvrU0ozz7ls3IR79EKGYvB0us+Qz0YUiv+Sn -f237bzy/7PRB5bQTIHe9VWOMNGKgML4vw4VAZ59EMkiBDOCzWRCpfa4xdZJvYkrw -K95/Lx4GhHI/i6/E6TGgzaJSwY5+24gmffLQBM4vyGTwJUOMjDkWaQLvhjbvTuYX -y7xX0/mbhLAQ5qPyOESfC2gx6ZSvaXNctGNuEa+BcV74+17XxLrA/BVd9qiVEZhs -peRFScKhz/mfVS6CBJ11arUtB0348em5ACIy/OEnXCSRP56TA0m1+OnZV9zUNJLX -7W9AenWvxTrsgH1SyyUz0vpP9ujfHusWRpMPNy7Ovlp4WP1ntAYnqmPVUZUGBEIy -0nWyTPAXNaPm4TsOCFWl3Ho0DYSyejJ2/nTTmpBXnDxIirba+MMPcu03tJydmBSC -TID4qSR7DCJoYbosj1/88WxQmyC8JwFNnXPAN+VoPd4LtnC+K8urtMEg5wSY7p9G -mQmqLKU2BhTkTn+d5l+7gzL1ILXWSuKEWUj5v813teZ784bMoYLM/q1vsHsjb2vk -tFIxos6tk/xIfFkeFB59gLqavrPZJWTNNW3QIAQPdkYu7GB8y/3de6ujYKiaRlqH -yuC87T5INBWSj+RBpyBLU50gMIIlEnJ56UYN2Lheaom/96ciqydalKJalQzhzpvR -dy5JYXiWn4v5b1Rkyiv0XGVG0OaB//qgsicRBLOFfPQNQ/WaFHaa/QDMpMJrutAw -QMztk5DlEbCOAzRYKjU7v3kCA3VVgXsgUr0dKy+bIUwFJ7jj9GN6PgHQiLIv9bNE -s4vEDp/2XJ7dWwBZo5bnUmgdA8NSuu5JNGD0Xm7de3+1ZBd75N4XrLgTAk4Y4k/O -VYDPeVyAUM2vfbu1sSXcT5hnTDjCuo9gZwPqCnwrDBqe3HjKRgQkf6ErlmcSOAXJ -CU2mjwfbzLvx796o/XCClCAqZPBZJ0KgtWv7TCB4K96G3KBt4h6BmgjhFJIyOIjp -MCBPHI1Nx+Kj+Pf81ItAh08OE1tJT53dGK37dSCCEkjoAAmKQFARvH8RKxGvq/j6 -o7YoQnzIb/fPGrLx8fzYL3t4YeuEdfTiudt1HHneffidQ6PTHlILeEzQ0c+51TJV -D9AT8raAvJjZlwNIyXr4MwVSiIHKW0IIkTrR4IIYshhj9DOfa6MzhrJWfiWRZjXc -4oKMv2mPzzfORi/Ct8JWfU2OKYy5jNsnZM5B/jo+z6MaXx8qZi5r+Lod2F1cQCnp -GoXIni5Ad2E2uhqycCgQ7kb69z7QeuJzpAkQwcHBFBDfNrHW+HfqzD2qQH8hapKI -k2y80EUnCwYjeP7NIY03+iJt02YUR52bVk8WX0AIoZoISwKfG9RA3F7Dsn7SgX3U -aADuVVgE8REAUgJMX9+Y/u5/s3RIjXCwyAf0U9wpT/FhWMEegrwXt86kgxoW4TBf -+2yJSFfgiaTxN4Hx7Xt3/4usyx+hr9K3I1Y0q1M6NGvHfP4w9nb66h/bv1AhgM1J -Tws+TDLS0POG4ZqbzMz6B3cr2NF45tD4zt8ZCoEnyjJKPfMqzsmSauvBHcsQTL7E -GB7Bw9e+UkGBSHCe2ByvYDoBnppS/8Ct4eWEq8FfMQbnrUv+FfIDzhvgsN2LS/iY -VW3mFcsOJKNT81Y2GIUlitU8P8ugF4GjCGHEb1ZHIjxiIb4V+8q5F6KoKMmpguAK -qYSQvlz/uqwRhYrziygIZHPFAhEFaQraRg9fXyH1nWQ2pPqbVnlwFU/7J7FebnpF -huE2rWuEdsNzPWuK/weTjYwEHs/jppirtfQtDtHts9tS8oAIGImVZRXrxvivRdpN -TTrHrgRUaoRnR56OYfTF1eSsjc7CH6nIEtGXIa7RC5WT4cAEH9WwIlis9zXEp/// -xduZMomtAdlhhqwHkpwW0UWETvK6HzyrW2VlDEYvP21WaIsZBnrmeqKFW/pNub9l -33f36uc3/t5vYP5QBsdZiTf2OGK3VZKzxjQL/whxlt9qAxOoHttyb4ZqtxNV/TNv -/EzmlwGSM3iSLuZD0Eckzyw5/3rqDSLqfqZlJDgIBCjCTPInVyMA70MVyryYdbe7 -ADDPRnRkvcny2ncQzlkYCgGJdOABmaaE4ILwh/BknxEC7RBU/4NhflEehSwAjh10 -NensOrg5RBBScZDTKhKZkPM4ixPXCk6enSmXFQKyH2r+lq8vMae1DOM6AeGMrnfE -u+aaGqFA/nDJrK3xwOOyEA== From d2900a440e3534ff3544e76149fa1fd3e1cf8331 Mon Sep 17 00:00:00 2001 From: Lukas Rytz Date: Mon, 11 May 2015 14:34:14 +0200 Subject: [PATCH 075/789] cross-build with 2.11 and 2.12 --- .travis.yml | 2 +- build.sbt | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index f35a75d08..205f2b594 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,6 @@ language: scala -script: sbt clean update test publishLocal +script: sbt clean update +test +publishLocal jdk: - openjdk6 - openjdk7 diff --git a/build.sbt b/build.sbt index b97e13faf..f38d0da04 100644 --- a/build.sbt +++ b/build.sbt @@ -6,7 +6,9 @@ name := "scala-xml" version := "1.0.5-SNAPSHOT" -scalaVersion := "2.11.4" +scalaVersion := crossScalaVersions.value.head + +crossScalaVersions := Seq("2.11.6", "2.12.0-M1") // important!! must come here (why?) scalaModuleOsgiSettings From 070afefeadcebdf5fc909d3491a1091e6bae4b54 Mon Sep 17 00:00:00 2001 From: Lukas Rytz Date: Mon, 11 May 2015 14:46:53 +0200 Subject: [PATCH 076/789] Tag-driven publishing, v2 Scripts taken from here: https://github.com/scala/scala-java8-compat/commit/4a6cfc97cd95227b86650410e1b632e5ff79335b New keys generated as described in the README. --- .travis.yml | 14 ++++++++- admin/README.md | 61 +++++++++++++++++++++++++++++++++++++ admin/build.sh | 25 +++++++++++++++ admin/encryptEnvVars.sh | 11 +++++++ admin/genKeyPair.sh | 41 +++++++++++++++++++++++++ admin/gpg.sbt | 2 ++ admin/publish-settings.sbt | 9 ++++++ admin/pubring.asc | 18 +++++++++++ admin/secring.asc.enc | Bin 0 -> 1872 bytes 9 files changed, 180 insertions(+), 1 deletion(-) create mode 100644 admin/README.md create mode 100755 admin/build.sh create mode 100755 admin/encryptEnvVars.sh create mode 100755 admin/genKeyPair.sh create mode 100644 admin/gpg.sbt create mode 100644 admin/publish-settings.sbt create mode 100644 admin/pubring.asc create mode 100644 admin/secring.asc.enc diff --git a/.travis.yml b/.travis.yml index 205f2b594..9a80fe916 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,8 +1,20 @@ language: scala -script: sbt clean update +test +publishLocal +env: + global: + - PUBLISH_JDK=openjdk6 + # PGP_PASSPHRASE + - secure: "BYC1kEnHjNrINrHYWPGEuTTJ2V340/0ByzqeihLecjoZ75yrjWdsh6MI1JEUWgv5kb+58vLzib21JfnjsPK6Yb2bSXuCFCsEtJNh6RJKgxkWlCOzfTSh5I2wl7PCjRClRL6gseX2uTSvFjL4Z//pmxwxeXlLp7voQe4QAUq1+sE=" + # SONA_USER + - secure: "OpBwPc1GNvauageYOH3RscAa7wpZxgpmqDz15aigIKLNWzAhAtVUx0MleZ8rQeoqml6nrAvlnzuVHjKL2lVcjMPpjUis7bcQ5UAGK7tZK8x+qZNQxXmpXu8+pENwQA2yFaqt/xy7K5jFOrHJHTRxcPnyVG1yKakPWz53PPYUwbc=" + # SONA_PASS + - secure: "Xw7rI/qlML1nD2e2XwlakkhKAWNGZKqqE+Q3ntTvFpfHryl7KLCvVzJ4LIavnL6kGJaWOgy9vlSoEWn5g9nqHSfE31C/k5pY5nTMAKiwiJzfAS+r0asKXW2gmKhwtcTBkqyLVOZLCJSPVlFRQyfBJHY+Fs0L3KWcnMQgtBlyDhU=" + +script: admin/build.sh + jdk: - openjdk6 - openjdk7 + notifications: email: adriaan.moors@typesafe.com diff --git a/admin/README.md b/admin/README.md new file mode 100644 index 000000000..55ae9c8ae --- /dev/null +++ b/admin/README.md @@ -0,0 +1,61 @@ +## Tag Driven Releasing + +Copied from https://github.com/scala/scala-java8-compat/commit/4a6cfc97cd95227b86650410e1b632e5ff79335b. + +### Background Reading + + - http://docs.travis-ci.com/user/environment-variables/ + - http://docs.travis-ci.com/user/encryption-keys/ + - http://docs.travis-ci.com/user/encrypting-files/ + +### Initial setup for the repository + +To configure tag driven releases from Travis CI. + + 1. Generate a key pair for this repository with `./admin/genKeyPair.sh`. + Edit `.travis.yml` and `admin/build.sh` as prompted. + 2. Publish the public key to https://pgp.mit.edu + 3. Store other secrets as encrypted environment variables with `admin/encryptEnvVars.sh`. + Edit `.travis.yml` as prompted. + 4. Edit `.travis.yml` to use `./admin/build.sh` as the build script, + and edit that script to use the tasks required for this project. + 5. Edit `.travis.yml` to select which JDK will be used for publishing. + +It is important to add comments in .travis.yml to identify the name +of each environment variable encoded in a `:secure` section. + +After all of these steps, your .travis.yml should contain config of the +form: + + language: scala + env: + global: + - PUBLISH_JDK=openjdk6 + # PGP_PASSPHRASE + - secure: "XXXXXX" + # SONA_USER + - secure: "XXXXXX" + # SONA_PASS + - secure: "XXXXXX" + script: admin/build.sh + +If Sonatype credentials change in the future, step 3 can be repeated +without generating a new key. + +Be sure to use SBT 0.13.7 or higher to avoid [#1430](https://github.com/sbt/sbt/issues/1430)! + +### Testing + + 1. Follow the release process below to create a dummy release (e.g. 0.1.0-TEST1). + Confirm that the release was staged to Sonatype but do not release it to Maven + central. Instead, drop the staging repository. + +### Performing a release + + 1. Create a GitHub "Release" (with a corresponding tag) via the GitHub + web interface. + 2. Travis CI will schedule a build for this release. Review the build logs. + 3. Log into https://oss.sonatype.org/ and identify the staging repository. + 4. Sanity check its contents + 5. Release staging repository to Maven and send out release announcement. + diff --git a/admin/build.sh b/admin/build.sh new file mode 100755 index 000000000..34f5ccda1 --- /dev/null +++ b/admin/build.sh @@ -0,0 +1,25 @@ +#!/bin/bash + +set -e + +# prep environment for publish to sonatype staging if the HEAD commit is tagged + +# git on travis does not fetch tags, but we have TRAVIS_TAG +# headTag=$(git describe --exact-match ||:) + +if [ "$TRAVIS_JDK_VERSION" == "$PUBLISH_JDK" ] && [[ "$TRAVIS_TAG" =~ ^v[0-9]+\.[0-9]+\.[0-9]+(-[A-Za-z0-9-]+)? ]]; then + echo "Going to release from tag $TRAVIS_TAG!" + myVer=$(echo $TRAVIS_TAG | sed -e s/^v//) + publishVersion='set every version := "'$myVer'"' + extraTarget="+publish-signed" + cat admin/gpg.sbt >> project/plugins.sbt + cp admin/publish-settings.sbt . + + # Copied from the output of genKeyPair.sh + K=$encrypted_6b8d67feaab7_key + IV=$encrypted_6b8d67feaab7_iv + + openssl aes-256-cbc -K $K -iv $IV -in admin/secring.asc.enc -out admin/secring.asc -d +fi + +sbt "$publishVersion" clean update +test +publishLocal $extraTarget diff --git a/admin/encryptEnvVars.sh b/admin/encryptEnvVars.sh new file mode 100755 index 000000000..b62566798 --- /dev/null +++ b/admin/encryptEnvVars.sh @@ -0,0 +1,11 @@ +#!/bin/bash +# +# Encrypt sonatype credentials so that they can be +# decrypted in trusted builds on Travis CI. +# +set -e + +read -s -p 'SONA_USER: ' SONA_USER +travis encrypt SONA_USER="$SONA_USER" +read -s -p 'SONA_PASS: ' SONA_PASS +travis encrypt SONA_PASS="$SONA_PASS" diff --git a/admin/genKeyPair.sh b/admin/genKeyPair.sh new file mode 100755 index 000000000..17db3f39b --- /dev/null +++ b/admin/genKeyPair.sh @@ -0,0 +1,41 @@ +#!/bin/bash +# +# Generates a key pair for this repository to sign artifacts. +# Encrypt the private key and its passphrase in trusted builds +# on Travis CI. +# +set -e + +# Based on https://gist.github.com/kzap/5819745: +function promptDelete() { + if [[ -f "$1" ]]; then + echo About to delete $1, Enter for okay / CTRL-C to cancel + read + rm "$1" + fi +} +for f in admin/secring.asc.enc admin/secring.asc admin/pubring.asc; do promptDelete "$f"; done + +echo Generating key pair. Please enter 1. repo name 2. scala-internals@googlegroups.com, 3. a new passphrase +echo Be careful when using special characters in the passphrase, see http://docs.travis-ci.com/user/encryption-keys/#Note-on-escaping-certain-symbols +cp admin/gpg.sbt project +sbt 'set pgpReadOnly := false' \ + 'set pgpPublicRing := file("admin/pubring.asc")' \ + 'set pgpSecretRing := file("admin/secring.asc")' \ + 'pgp-cmd gen-key' +rm project/gpg.sbt + +echo ============================================================================================ +echo Encrypting admin/secring.asc. Update K and IV variables in admin/build.sh accordingly. +echo ============================================================================================ +travis encrypt-file admin/secring.asc +rm admin/secring.asc +mv secring.asc.enc admin + +echo ============================================================================================ +echo Encrypting environment variables. Add each to a line in .travis.yml. Include a comment +echo with the name of the corresponding variable +echo ============================================================================================ +read -s -p 'PGP_PASSPHRASE: ' PGP_PASSPHRASE +travis encrypt PGP_PASSPHRASE="$PGP_PASSPHRASE" + diff --git a/admin/gpg.sbt b/admin/gpg.sbt new file mode 100644 index 000000000..68ae46411 --- /dev/null +++ b/admin/gpg.sbt @@ -0,0 +1,2 @@ + +addSbtPlugin("com.typesafe.sbt" % "sbt-pgp" % "0.8.3") // only added when publishing, see build.sh diff --git a/admin/publish-settings.sbt b/admin/publish-settings.sbt new file mode 100644 index 000000000..f763ea06c --- /dev/null +++ b/admin/publish-settings.sbt @@ -0,0 +1,9 @@ +def env(key: String) = Option(System.getenv(key)).getOrElse("") + +pgpPassphrase := Some(env("PGP_PASSPHRASE").toArray) + +pgpPublicRing := file("admin/pubring.asc") + +pgpSecretRing := file("admin/secring.asc") + +credentials += Credentials("Sonatype Nexus Repository Manager", "oss.sonatype.org", env("SONA_USER"), env("SONA_PASS")) diff --git a/admin/pubring.asc b/admin/pubring.asc new file mode 100644 index 000000000..df4501ad6 --- /dev/null +++ b/admin/pubring.asc @@ -0,0 +1,18 @@ +-----BEGIN PGP PUBLIC KEY BLOCK----- +Version: BCPG v1.49 + +mQENBFVQohwBCACi9Hupi/27JFgcRypkruHZNKXa4+QO380B5hp0UFUzJHBqEvUd +p9niOq30yCgfByLiPv2qr7g1lAg2DltH9WyN5zhp3MzOt/m1w66IwZqgCS364gtD +56udK2R6YCFMfiJxGXFsSbStfIoD8N5S++NJGv0GuFc2m3sSuTunRFoRWN4Dce0g +a16nyVR2dPfqOkL7LLzMR4Tl8VQFb36WPrFBmJKzZWxt0r2pQhEDMwItuZeKrBhm +K/RZWtNqiBO61JCBHfWZdpduUcTjlr5cW+jkRtw8La0qgglJcSN/sErQamAtU6vo +sdTZ2aQQZnYyVBt00yrLV+9Dq/dBS6cfV9NHABEBAAG0LHNjYWxhLXhtbCA8c2Nh +bGEtaW50ZXJuYWxzQGdvb2dsZWdyb3Vwcy5jb20+iQEcBBMBAgAGBQJVUKIcAAoJ +EO/sfqhmzEOuHtkH/25VVvDzMo85E8KlCtsnkD5Alb83zV1XF6+mZaRHikzKkQRz +phZEGaU6ee3V6CH5qXsmKTU2B1WaOYIdPkuBjwdpRPJbaX0zzrWUCCv1vLKDb+z2 +nlcg0AehMUM3UinbGR6QCh06p3O/tBokJvZM+Ng3pkXtLOS4HphRfindpy7+u1Y/ +szcIQS88AH1g5xPt8nwrh9VQbrYD04K20mLckGIWnjSzgFB9hntMF5arAP9Q1RkS +52xiOZB8RTZZCkFeHIdMKjjmoM9Vn/3JZzsy8Om4FWYa/l2fEExxKWFupvQetjFk +VTTOG+T7/WwVPQQ0xQLROgWL7z5UgxHly64WClA= +=/6/b +-----END PGP PUBLIC KEY BLOCK----- diff --git a/admin/secring.asc.enc b/admin/secring.asc.enc new file mode 100644 index 0000000000000000000000000000000000000000..626ff5d10725214624e7c797a9eb74864127bd10 GIT binary patch literal 1872 zcmV-W2e0@fqpgw+LsRd7u2o)%di3Y_9iX0wgGZTvHLMnHOVRsifjxLtWxXi~jtiA- z#bq1(7NwM*VTQi!XlB8CsKd6Vb?RVs+LcSU9mzPJDW))Y09x4*M_jRHK)t!Hd4Q#^ zO`Scgult5G8x2H&A-0j`lh54Vrp6$rFgVxY6$uvk(})PKqp0haRYw=fux{Ig7Qu6A-9wVubfVV=|G z{{Z;GKKc2I{ka&)nadAV;*EN7&jC)0u}wYPd-5ljH#csr$>A#+8jUmzjBLne>Avff z3?1)>MJ>&-io7mY8FL`pIy-Tn{kTvT#`k}16tuGOF17oD2ZHATYgY;uhAK@rXf}kl zp607sR*Jd2LOK)9pPiB$@4#{4Og(yRHtXuAgTfzmJfJ>*A*eiD8lDSvP8#G$4s3iU zEJ0eveZ&S;+l1zzAc|x=O;DYO_d%VY>1R#%xUm11l13?Pr)58ok6V{A3B{AcPLeOz zHN1P;pm_lsgMQ@gBZ?|Nj&C5`;se!}aM{k)@St|b6>!b>j_Gap>MY?wgi>JVOeq>3y7QnnjZl0{hi zXWt-ZUv$bfpY_hP(%^1SH&F@i{xP{l@P$l5w5ahNHyHWmdMPdNoOEQ-D6Ot~G%!jH z8C=WK?{W(e-#}y}pQxUqRjM6MGWqRnZ2U$a%q|N-F#aCrUA)O#e=F22p06Mx=91=! zp0ee_ zinPL)?)@Q>7zfvkXg+(zjt39zCpg3QfsKSX_EYNI!k`N%2xL~a2oBK(_|TU4E> z-?=Wv{0)yf&29)J#J>mMwR$UB%fxSFDsgPQrN8H@+G7z3$ESL+$b{3%4*?8Sm6E)y zikukNt?wZvD^SgpDH7IMkb|92-dGZ`k3j7$;76!SM{(W!CWcno+}w z2oehz#zkCAYaip?YJds7E}L5Y2C@b~5fW76^s`B>=D4pZ$2-435i0wq0NNeBNvctx zmDF@(NO0g8drhqd5;C4vd5666m(VH0j-$jyZaptkAYq zZUMD=c9deNngez7wj9wG2}4S zY~0z1gifa^iboBmjK8RC0+btk0<64If91L05m61O{WXtiQfE|0n?YUqCHI!b=~S?m zoA_vx?*xLiq$|1`5QNMP6Ex^a&Ys#DiTk>Ch5T@$ekg90Q{+n$?8(el+Ez#ZKV??yD^UK>7g^QMT!iq_w8~%Ft z;e=?o3MaHmjV%^%U8ghL_1v%U4YBdm^hZF}5P-W=XC%;{FCh+tl#$+Kmx?H{USO`4 z3~G!xl?T?kK$Mp8t;mj7)FJgZw`IHv*~N!`3QR`FG-?t^pb>w8+^j9Jk2VKk3k2`x z^Z>-mIhY*18?LHpvCkIoxfJI>8{3KWu_U~3J;jq_{)~myM;Oh zrVpt^YOu3jtsmU`FY>-1AkO4qi4B>Rlp-9&NiC_Cma+CWnu~X?FgLGa(n>9Hnwd)M z7o9CM_iWSfdrm%(X%^6z&p8t$RhU-8a^v0HVA0ZJ@3VcmJy@UZvr4b*@)4%7(C*e# KL)moSr4dnNG@(HN literal 0 HcmV?d00001 From 99c62cb4a02b4fcf49657ffb4b948489fd8e01e2 Mon Sep 17 00:00:00 2001 From: Lukas Rytz Date: Mon, 11 May 2015 16:39:42 +0200 Subject: [PATCH 077/789] Remove stale file Forgot to remove it in 6b479d7. --- sensitive.sbt.enc | 7 ------- 1 file changed, 7 deletions(-) delete mode 100644 sensitive.sbt.enc diff --git a/sensitive.sbt.enc b/sensitive.sbt.enc deleted file mode 100644 index d3bf15775..000000000 --- a/sensitive.sbt.enc +++ /dev/null @@ -1,7 +0,0 @@ -U2FsdGVkX18gIxRNVlHPw4nCe2cnzM8eT6nuAX3tlZGkm1oWilS9WHMn51Xynkfu -u93EwxakV6ov0Nci2ZfrGQcNYQk+0r/36YfK10wV2BMRFC+xZuu90WjaGkfWrnCZ -Act4ID/vax/k0hHPTIAP7fbYvX0G+zQtyEtGrfuLvfb++BsX/o8Eyv2KaQkz/fYd -PG9iwXd1agN6T3xb7EMu+sKheLNj4erxFCkJqwY525ZqWzvHP9aiSsFSPA/ubUS8 -LeqEU5RvCOo1GoG7qEv/yny4KT/IB5EIeuo8x3uVm8MNMQW+XzEVJBGErMcAWwnF -v0eVpuAeMpTv/rU2VxBkwCE9I5TY3adYD8w9rxXaERGFaNzt48toOVEtY4Eju9AH -uuP2s4VxE/XZtdKSCXc2ZA== From 6fd8694b377f86c9a9bc04a5cde66bc5c307dd56 Mon Sep 17 00:00:00 2001 From: Adriaan Moors Date: Thu, 2 Jul 2015 16:09:47 -0700 Subject: [PATCH 078/789] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 3e8402ebc..7869b8d65 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ Maintainer wanted! ================== -Would you like to maintain this project? (Please open an issue/send an email!) +Would you like to maintain this project? (Please [get in touch](https://github.com/scala/scala#get-in-touch) with someone from the scala/scala core team!) scala-xml [](https://travis-ci.org/scala/scala-xml) [](http://search.maven.org/#search%7Cga%7C1%7Cg%3Aorg.scala-lang.modules%20a%3Ascala-xml_2.11) [](http://search.maven.org/#search%7Cga%7C1%7Cg%3Aorg.scala-lang.modules%20a%3Ascala-xml_2.12*) ========= From b74645256ed43b605a171d37d1f0a9ad5e4ff673 Mon Sep 17 00:00:00 2001 From: Som Snytt Date: Thu, 9 Jul 2015 22:18:35 -0700 Subject: [PATCH 079/789] Fix #51 Test compat for -Xxml:coalescing Rather than maintain a test to compile under multiple regimes, just build under `-Xxml:coalescing`. A few other flags are supplied. Deprecation is not yet possible because of `WordExp` et al. Renamed test classes `A` and `B` because sometimes it's nice to have a type parameter called `A` or `B`. --- build.sbt | 5 +++- .../scala/scala/xml/dtd/ContentModel.scala | 23 ++++++++++++++----- .../scala/xml/dtd/impl/WordBerrySethi.scala | 1 + .../scala/scala/xml/pull/XMLEventReader.scala | 2 +- src/test/scala/scala/xml/ShouldCompile.scala | 6 ++--- src/test/scala/scala/xml/XMLTest.scala | 2 ++ 6 files changed, 28 insertions(+), 11 deletions(-) diff --git a/build.sbt b/build.sbt index f38d0da04..97a1ae4b7 100644 --- a/build.sbt +++ b/build.sbt @@ -8,7 +8,10 @@ version := "1.0.5-SNAPSHOT" scalaVersion := crossScalaVersions.value.head -crossScalaVersions := Seq("2.11.6", "2.12.0-M1") +crossScalaVersions := Seq("2.11.7", "2.12.0-M1") + +//scalacOptions ++= "-deprecation:false -feature -Xlint:-stars-align,-nullary-unit,_ -Xfatal-warnings -Xxml:coalescing".split("\\s+").to[Seq] +scalacOptions ++= "-deprecation:false -feature -Xlint:-stars-align,-nullary-unit,_ -Xxml:coalescing".split("\\s+").to[Seq] // important!! must come here (why?) scalaModuleOsgiSettings diff --git a/src/main/scala/scala/xml/dtd/ContentModel.scala b/src/main/scala/scala/xml/dtd/ContentModel.scala index 73dcb8fc2..afd47ed8e 100644 --- a/src/main/scala/scala/xml/dtd/ContentModel.scala +++ b/src/main/scala/scala/xml/dtd/ContentModel.scala @@ -14,11 +14,21 @@ import scala.xml.dtd.impl._ import scala.xml.Utility.sbToString import PartialFunction._ +/* +@deprecated("Avoidance", since="2.10") +trait ContentModelLaundry extends WordExp +object ContentModelLaundry extends ContentModelLaundry { +} +*/ + object ContentModel extends WordExp { + type _labelT = ElemName type _regexpT = RegExp - object Translator extends WordBerrySethi { + @deprecated("Avoidance", since="2.10") + trait Translator extends WordBerrySethi + object Translator extends Translator { override val lang: ContentModel.this.type = ContentModel.this } @@ -72,7 +82,6 @@ object ContentModel extends WordExp { case Letter(ElemName(name)) => sb.append(name) } - } sealed abstract class ContentModel { @@ -80,6 +89,8 @@ sealed abstract class ContentModel { def buildString(sb: StringBuilder): StringBuilder } +import ContentModel.RegExp + case object PCDATA extends ContentModel { override def buildString(sb: StringBuilder): StringBuilder = sb.append("(#PCDATA)") } @@ -91,7 +102,7 @@ case object ANY extends ContentModel { } sealed abstract class DFAContentModel extends ContentModel { import ContentModel.{ ElemName, Translator } - def r: ContentModel.RegExp + def r: RegExp lazy val dfa: DetWordAutom[ElemName] = { val nfa = Translator.automatonFrom(r, 1) @@ -99,8 +110,8 @@ sealed abstract class DFAContentModel extends ContentModel { } } -case class MIXED(r: ContentModel.RegExp) extends DFAContentModel { - import ContentModel.{ Alt, RegExp } +case class MIXED(r: RegExp) extends DFAContentModel { + import ContentModel.Alt override def buildString(sb: StringBuilder): StringBuilder = { val newAlt = r match { case Alt(rs@_*) => Alt(rs drop 1: _*) } @@ -111,7 +122,7 @@ case class MIXED(r: ContentModel.RegExp) extends DFAContentModel { } } -case class ELEMENTS(r: ContentModel.RegExp) extends DFAContentModel { +case class ELEMENTS(r: RegExp) extends DFAContentModel { override def buildString(sb: StringBuilder): StringBuilder = ContentModel.buildString(r, sb) } diff --git a/src/main/scala/scala/xml/dtd/impl/WordBerrySethi.scala b/src/main/scala/scala/xml/dtd/impl/WordBerrySethi.scala index 3acc06435..2a5a5ce30 100644 --- a/src/main/scala/scala/xml/dtd/impl/WordBerrySethi.scala +++ b/src/main/scala/scala/xml/dtd/impl/WordBerrySethi.scala @@ -19,6 +19,7 @@ import scala.collection.{ immutable, mutable } * @version 1.0 */ // TODO: still used in ContentModel -- @deprecated("This class will be removed", "2.10.0") +@deprecated("This class will be removed", "2.10.0") private[dtd] abstract class WordBerrySethi extends BaseBerrySethi { override val lang: WordExp diff --git a/src/main/scala/scala/xml/pull/XMLEventReader.scala b/src/main/scala/scala/xml/pull/XMLEventReader.scala index 60843ed33..a2c266276 100755 --- a/src/main/scala/scala/xml/pull/XMLEventReader.scala +++ b/src/main/scala/scala/xml/pull/XMLEventReader.scala @@ -122,7 +122,7 @@ trait ProducerConsumerIterator[T >: Null] extends Iterator[T] { // defaults to unbounded - override to positive Int if desired val MaxQueueSize = -1 - def interruptibly[T](body: => T): Option[T] = try Some(body) catch { + def interruptibly[A](body: => A): Option[A] = try Some(body) catch { case _: InterruptedException => Thread.currentThread.interrupt(); None case _: ClosedChannelException => None diff --git a/src/test/scala/scala/xml/ShouldCompile.scala b/src/test/scala/scala/xml/ShouldCompile.scala index f2ddffce5..c05bdc503 100644 --- a/src/test/scala/scala/xml/ShouldCompile.scala +++ b/src/test/scala/scala/xml/ShouldCompile.scala @@ -22,11 +22,11 @@ class Foo { } // t2281 -class A { +class t2281A { def f(x: Boolean) = if (x)

else
} -class B { +class t2281B { def splitSentences(text: String): ArrayBuffer[String] = { val outarr = new ArrayBuffer[String] var outstr = new StringBuffer @@ -92,4 +92,4 @@ object shouldCompile { case 1 => case 2 =>

} -} \ No newline at end of file +} diff --git a/src/test/scala/scala/xml/XMLTest.scala b/src/test/scala/scala/xml/XMLTest.scala index 23c143396..6ab741390 100644 --- a/src/test/scala/scala/xml/XMLTest.scala +++ b/src/test/scala/scala/xml/XMLTest.scala @@ -1,5 +1,7 @@ package scala.xml +import language.postfixOps + import org.junit.{Test => UnitTest} import org.junit.Ignore import org.junit.runner.RunWith From b2eef1f4152503179ad3266001c1c066f59a5eea Mon Sep 17 00:00:00 2001 From: biswanath Date: Wed, 1 Jul 2015 02:25:31 +0530 Subject: [PATCH 080/789] Fix #58 (SI-4528) BasicTransformer has no longer exponential complexity. --- .../xml/transform/BasicTransformer.scala | 9 +- src/test/scala/scala/xml/ReuseNodesTest.scala | 106 ++++++++++++++++++ 2 files changed, 110 insertions(+), 5 deletions(-) create mode 100644 src/test/scala/scala/xml/ReuseNodesTest.scala diff --git a/src/main/scala/scala/xml/transform/BasicTransformer.scala b/src/main/scala/scala/xml/transform/BasicTransformer.scala index 8cad1ef22..ce7441ef8 100644 --- a/src/main/scala/scala/xml/transform/BasicTransformer.scala +++ b/src/main/scala/scala/xml/transform/BasicTransformer.scala @@ -32,11 +32,10 @@ abstract class BasicTransformer extends Function1[Node, Node] { * otherwise a new sequence of concatenated results. */ def transform(ns: Seq[Node]): Seq[Node] = { - val (xs1, xs2) = ns span (n => unchanged(n, transform(n))) - - if (xs2.isEmpty) ns - else xs1 ++ transform(xs2.head) ++ transform(xs2.tail) - } + val changed = ns flatMap transform + if (changed.length != ns.length || (changed, ns).zipped.exists(_ != _)) changed + else ns +} def transform(n: Node): Seq[Node] = { if (n.doTransform) n match { diff --git a/src/test/scala/scala/xml/ReuseNodesTest.scala b/src/test/scala/scala/xml/ReuseNodesTest.scala new file mode 100644 index 000000000..5c61d0e3f --- /dev/null +++ b/src/test/scala/scala/xml/ReuseNodesTest.scala @@ -0,0 +1,106 @@ +package scala.xml + +import scala.xml.transform._ +import org.junit.Test +import org.junit.Assert.assertTrue +import org.junit.Assert.assertEquals +import org.junit.experimental.theories.Theories +import org.junit.experimental.theories.Theory +import org.junit.experimental.theories.DataPoints +import org.junit.runner.RunWith +/** + * This test verify that after the tranform, the resultant xml node + * uses as many old nodes as possible. + * + * Three transformers class for case - + * One for orginal, one for modified, and one proposed which shows + * all are equivalent when it comes to reusing as many nodes as possible + */ +object ReuseNodesTest { + + class OriginalTranformr(rules: RewriteRule*) extends RuleTransformer(rules:_*) { + override def transform(ns: Seq[Node]): Seq[Node] = { + val xs = ns.toStream map transform + val (xs1, xs2) = xs zip ns span { case (x, n) => unchanged(n, x) } + + if (xs2.isEmpty) ns + else (xs1 map (_._2)) ++ xs2.head._1 ++ transform(ns drop (xs1.length + 1)) + } + override def transform(n:Node): Seq[Node] = super.transform(n) + } + + class ModifiedTranformr(rules: RewriteRule*) extends RuleTransformer(rules:_*) { + override def transform(ns: Seq[Node]): Seq[Node] = { + val changed = ns flatMap transform + + if (changed.length != ns.length || (changed, ns).zipped.exists(_ != _)) changed + else ns + } + override def transform(n:Node): Seq[Node] = super.transform(n) + } + + class AlternateTranformr(rules: RewriteRule*) extends RuleTransformer(rules:_*) { + override def transform(ns: Seq[Node]): Seq[Node] = { + val xs = ns.toStream map transform + val (xs1, xs2) = xs zip ns span { case (x, n) => unchanged(n, x) } + + if (xs2.isEmpty) ns + else (xs1 map (_._2)) ++ xs2.head._1 ++ transform(ns drop (xs1.length + 1)) + } + override def transform(n:Node): Seq[Node] = super.transform(n) + } + + def rewriteRule = new RewriteRule { + override def transform(n: Node): NodeSeq = n match { + case n if n.label == "change" => Elem( + n.prefix, "changed", n.attributes, n.scope, n.child.isEmpty, n.child : _*) + case _ => n + } + } + + @DataPoints + def tranformers() = Array( + new OriginalTranformr(rewriteRule), + new ModifiedTranformr(rewriteRule), + new AlternateTranformr(rewriteRule)) +} + +@RunWith(classOf[Theories]) +class ReuseNodesTest { + + @Theory + def transformReferentialEquality(rt:RuleTransformer) = { + val original =

+ val tranformed = rt.transform(original) + assertTrue(original eq tranformed) + } + + @Theory + def transformReferentialEqualityOnly(rt:RuleTransformer) = { + val original =
+ val transformed = rt.transform(original) + recursiveAssert(original,transformed) + } + + def recursiveAssert(original:Seq[Node], transformed:Seq[Node]):Unit = { + (original.toList,transformed.toList) match { + case (Nil, Nil) => {} + case (x::xs,y::ys) => { + recursiveAssert(x,y) + recursiveAssert(xs,ys) + } + } + } + + def recursiveAssert(original:Node, transformed:Node):Unit = { + transformed.label match { + case "changed" => // do nothing expect this node to be changed + recursiveAssert(original.child,transformed.child) + case _ => { + assertTrue(original eq transformed) + // No need to check for childrens, node being immuatable + // childs can't be differnt if parents are refertially equal + } + } + } +} \ No newline at end of file From 5fae850bebf4f404d957d6fd888c9adc78caf4da Mon Sep 17 00:00:00 2001 From: Seth Tisue Date: Tue, 21 Jul 2015 16:57:49 -0400 Subject: [PATCH 081/789] build for 2.12.0-M2 --- build.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index 97a1ae4b7..e33592798 100644 --- a/build.sbt +++ b/build.sbt @@ -8,7 +8,7 @@ version := "1.0.5-SNAPSHOT" scalaVersion := crossScalaVersions.value.head -crossScalaVersions := Seq("2.11.7", "2.12.0-M1") +crossScalaVersions := Seq("2.11.7", "2.12.0-M2") //scalacOptions ++= "-deprecation:false -feature -Xlint:-stars-align,-nullary-unit,_ -Xfatal-warnings -Xxml:coalescing".split("\\s+").to[Seq] scalacOptions ++= "-deprecation:false -feature -Xlint:-stars-align,-nullary-unit,_ -Xxml:coalescing".split("\\s+").to[Seq] From bc859b1b046baac19c474d325c500d7bf3d8f9d2 Mon Sep 17 00:00:00 2001 From: Seth Tisue Date: Tue, 21 Jul 2015 17:09:37 -0400 Subject: [PATCH 082/789] better to confine -Xxml:coalescing to `in Test` --- build.sbt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index e33592798..ee6011de4 100644 --- a/build.sbt +++ b/build.sbt @@ -11,7 +11,9 @@ scalaVersion := crossScalaVersions.value.head crossScalaVersions := Seq("2.11.7", "2.12.0-M2") //scalacOptions ++= "-deprecation:false -feature -Xlint:-stars-align,-nullary-unit,_ -Xfatal-warnings -Xxml:coalescing".split("\\s+").to[Seq] -scalacOptions ++= "-deprecation:false -feature -Xlint:-stars-align,-nullary-unit,_ -Xxml:coalescing".split("\\s+").to[Seq] +scalacOptions ++= "-deprecation:false -feature -Xlint:-stars-align,-nullary-unit,_".split("\\s+").to[Seq] + +scalacOptions in Test += "-Xxml:coalescing" // important!! must come here (why?) scalaModuleOsgiSettings From 38fbbbeeff6bc97c4438e3e37041894c93538e46 Mon Sep 17 00:00:00 2001 From: Seth Tisue Date: Tue, 21 Jul 2015 17:16:09 -0400 Subject: [PATCH 083/789] redo how crossScalaVersions works the old scheme was: run tests on openjdk7 too, but only publish (for all Scala versions) from openjdk6 this is no longer appropriate now that Scala 2.12.0-M2 requires Java 8. now we want to publish for older Scala versions using JDK 6, but newer versions (M2 and above) using JDK 8. this commit does that. currently Travis doesn't offer OpenJDK 8, so we use Oracle. leaving our JDK 6 setting as "openjdk6" since that's what it's historically been so why rock the boat. what happened to running tests on JDK 7? well, neither Lukas nor I knows why it was even doing that. --- .travis.yml | 3 +-- admin/README.md | 5 ++--- admin/build.sh | 2 +- build.sbt | 14 +++++++++++--- 4 files changed, 15 insertions(+), 9 deletions(-) diff --git a/.travis.yml b/.travis.yml index 9a80fe916..80dde716f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,7 +2,6 @@ language: scala env: global: - - PUBLISH_JDK=openjdk6 # PGP_PASSPHRASE - secure: "BYC1kEnHjNrINrHYWPGEuTTJ2V340/0ByzqeihLecjoZ75yrjWdsh6MI1JEUWgv5kb+58vLzib21JfnjsPK6Yb2bSXuCFCsEtJNh6RJKgxkWlCOzfTSh5I2wl7PCjRClRL6gseX2uTSvFjL4Z//pmxwxeXlLp7voQe4QAUq1+sE=" # SONA_USER @@ -14,7 +13,7 @@ script: admin/build.sh jdk: - openjdk6 - - openjdk7 + - oraclejdk8 notifications: email: adriaan.moors@typesafe.com diff --git a/admin/README.md b/admin/README.md index 55ae9c8ae..d84727a74 100644 --- a/admin/README.md +++ b/admin/README.md @@ -19,7 +19,8 @@ To configure tag driven releases from Travis CI. Edit `.travis.yml` as prompted. 4. Edit `.travis.yml` to use `./admin/build.sh` as the build script, and edit that script to use the tasks required for this project. - 5. Edit `.travis.yml` to select which JDK will be used for publishing. + 5. Edit `build.sbt` to select which JDK will be used for publishing + for which Scala versions. It is important to add comments in .travis.yml to identify the name of each environment variable encoded in a `:secure` section. @@ -30,7 +31,6 @@ form: language: scala env: global: - - PUBLISH_JDK=openjdk6 # PGP_PASSPHRASE - secure: "XXXXXX" # SONA_USER @@ -58,4 +58,3 @@ Be sure to use SBT 0.13.7 or higher to avoid [#1430](https://github.com/sbt/sbt/ 3. Log into https://oss.sonatype.org/ and identify the staging repository. 4. Sanity check its contents 5. Release staging repository to Maven and send out release announcement. - diff --git a/admin/build.sh b/admin/build.sh index 34f5ccda1..bdd8490de 100755 --- a/admin/build.sh +++ b/admin/build.sh @@ -7,7 +7,7 @@ set -e # git on travis does not fetch tags, but we have TRAVIS_TAG # headTag=$(git describe --exact-match ||:) -if [ "$TRAVIS_JDK_VERSION" == "$PUBLISH_JDK" ] && [[ "$TRAVIS_TAG" =~ ^v[0-9]+\.[0-9]+\.[0-9]+(-[A-Za-z0-9-]+)? ]]; then +if [[ "$TRAVIS_TAG" =~ ^v[0-9]+\.[0-9]+\.[0-9]+(-[A-Za-z0-9-]+)? ]]; then echo "Going to release from tag $TRAVIS_TAG!" myVer=$(echo $TRAVIS_TAG | sed -e s/^v//) publishVersion='set every version := "'$myVer'"' diff --git a/build.sbt b/build.sbt index ee6011de4..dc924849d 100644 --- a/build.sbt +++ b/build.sbt @@ -8,9 +8,17 @@ version := "1.0.5-SNAPSHOT" scalaVersion := crossScalaVersions.value.head -crossScalaVersions := Seq("2.11.7", "2.12.0-M2") - -//scalacOptions ++= "-deprecation:false -feature -Xlint:-stars-align,-nullary-unit,_ -Xfatal-warnings -Xxml:coalescing".split("\\s+").to[Seq] +crossScalaVersions := { + val java = System.getProperty("java.version") + if (java.startsWith("1.6.")) + Seq("2.11.7", "2.12.0-M1") + else if (java.startsWith("1.8.")) + Seq("2.12.0-M2") + else + sys.error(s"don't know what Scala versions to build on $java") +} + +//reenable -Xfatal-warnings? scalacOptions ++= "-deprecation:false -feature -Xlint:-stars-align,-nullary-unit,_".split("\\s+").to[Seq] scalacOptions in Test += "-Xxml:coalescing" From c09fc072a77354bd3fe5073da4e53abeb2d11e8c Mon Sep 17 00:00:00 2001 From: Seth Tisue Date: Fri, 24 Jul 2015 15:42:40 -0400 Subject: [PATCH 084/789] 1.0.5 was released. 1.0.6 is next --- build.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index dc924849d..10cfe06d3 100644 --- a/build.sbt +++ b/build.sbt @@ -4,7 +4,7 @@ scalaModuleSettings name := "scala-xml" -version := "1.0.5-SNAPSHOT" +version := "1.0.6-SNAPSHOT" scalaVersion := crossScalaVersions.value.head From 2d1d87581716ac5576155e64d7386f5f91a2faa5 Mon Sep 17 00:00:00 2001 From: Seth Tisue Date: Fri, 24 Jul 2015 16:21:14 -0400 Subject: [PATCH 085/789] opt-in to Travis's newer/faster container-based infrastructure --- .travis.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.travis.yml b/.travis.yml index 80dde716f..51e8e9977 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,3 +1,6 @@ +# opt-in to Travis's newer/faster container-based infrastructure +sudo: false + language: scala env: From 01b4f86e8073368771f34c20fb43cdefb62a20ff Mon Sep 17 00:00:00 2001 From: The Gitter Badger Date: Mon, 27 Jul 2015 19:47:52 +0000 Subject: [PATCH 086/789] Added Gitter badge --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 7869b8d65..68e555b88 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ Maintainer wanted! ================== + +[![Join the chat at https://gitter.im/scala/scala-xml](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/scala/scala-xml?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) Would you like to maintain this project? (Please [get in touch](https://github.com/scala/scala#get-in-touch) with someone from the scala/scala core team!) scala-xml [](https://travis-ci.org/scala/scala-xml) [](http://search.maven.org/#search%7Cga%7C1%7Cg%3Aorg.scala-lang.modules%20a%3Ascala-xml_2.11) [](http://search.maven.org/#search%7Cga%7C1%7Cg%3Aorg.scala-lang.modules%20a%3Ascala-xml_2.12*) From 8f4450dc0c0c66b565a7b79600619d017d00dd76 Mon Sep 17 00:00:00 2001 From: biswanaths Date: Tue, 28 Jul 2015 01:36:00 +0530 Subject: [PATCH 087/789] Moving the gitter to right place --- README.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/README.md b/README.md index 68e555b88..39d5229f0 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,9 @@ Maintainer wanted! ================== -[![Join the chat at https://gitter.im/scala/scala-xml](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/scala/scala-xml?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) Would you like to maintain this project? (Please [get in touch](https://github.com/scala/scala#get-in-touch) with someone from the scala/scala core team!) -scala-xml [](https://travis-ci.org/scala/scala-xml) [](http://search.maven.org/#search%7Cga%7C1%7Cg%3Aorg.scala-lang.modules%20a%3Ascala-xml_2.11) [](http://search.maven.org/#search%7Cga%7C1%7Cg%3Aorg.scala-lang.modules%20a%3Ascala-xml_2.12*) +scala-xml [](https://travis-ci.org/scala/scala-xml) [](http://search.maven.org/#search%7Cga%7C1%7Cg%3Aorg.scala-lang.modules%20a%3Ascala-xml_2.11) [](http://search.maven.org/#search%7Cga%7C1%7Cg%3Aorg.scala-lang.modules%20a%3Ascala-xml_2.12*) [![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/scala/scala-xml) ========= The standard Scala XML library. Please file issues here instead of over at issues.scala-lang.org. From 8a054318a8ef7256a5e0db7b7739f0dbe560cf36 Mon Sep 17 00:00:00 2001 From: biswanath Date: Tue, 28 Jul 2015 01:52:06 +0530 Subject: [PATCH 088/789] moving the gitter link to the right place --- README.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/README.md b/README.md index 68e555b88..39d5229f0 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,9 @@ Maintainer wanted! ================== -[![Join the chat at https://gitter.im/scala/scala-xml](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/scala/scala-xml?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) Would you like to maintain this project? (Please [get in touch](https://github.com/scala/scala#get-in-touch) with someone from the scala/scala core team!) -scala-xml [](https://travis-ci.org/scala/scala-xml) [](http://search.maven.org/#search%7Cga%7C1%7Cg%3Aorg.scala-lang.modules%20a%3Ascala-xml_2.11) [](http://search.maven.org/#search%7Cga%7C1%7Cg%3Aorg.scala-lang.modules%20a%3Ascala-xml_2.12*) +scala-xml [](https://travis-ci.org/scala/scala-xml) [](http://search.maven.org/#search%7Cga%7C1%7Cg%3Aorg.scala-lang.modules%20a%3Ascala-xml_2.11) [](http://search.maven.org/#search%7Cga%7C1%7Cg%3Aorg.scala-lang.modules%20a%3Ascala-xml_2.12*) [![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/scala/scala-xml) ========= The standard Scala XML library. Please file issues here instead of over at issues.scala-lang.org. From 72b11f64e6ca285a830e8a7b56f34d7110f8ed53 Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Tue, 4 Aug 2015 00:58:05 -0400 Subject: [PATCH 089/789] Add more XML attribute unit tests for SI-9047 --- src/test/scala/scala/xml/AttributeTest.scala | 71 +++++++++++++++++++- 1 file changed, 70 insertions(+), 1 deletion(-) diff --git a/src/test/scala/scala/xml/AttributeTest.scala b/src/test/scala/scala/xml/AttributeTest.scala index 13aa7bfc6..0018e0ee3 100644 --- a/src/test/scala/scala/xml/AttributeTest.scala +++ b/src/test/scala/scala/xml/AttributeTest.scala @@ -65,4 +65,73 @@ class AttributeTest { assertEquals("apple", xml \@ "bar") } -} \ No newline at end of file + @Test + def attributePathRootNoAttribute: Unit = { + val xml = + assertEquals(NodeSeq.Empty, xml \ "@bar") + } + + @Test(expected=classOf[IllegalArgumentException]) + def attributePathIllegalEmptyAttribute: Unit = { + val xml = + xml \ "@" + } + + @Test + def attributePathRootWithOneAttribute: Unit = { + val xml = + assertEquals(Group(Text("apple")), xml \ "@bar") + // assertEquals(NodeSeq.fromSeq(Seq(Text("apple"))), xml \ "@bar") + } + + @Test + def attributePathRootWithMissingAttributes: Unit = { + val xml = + assertEquals(NodeSeq.Empty, xml \ "@oops") + } + + @Test + def attributePathDuplicateAttribute: Unit = { + val xml = Elem(null, "foo", + Attribute("bar", Text("apple"), + Attribute("bar", Text("orange"), Null)), TopScope) + assertEquals(Group(Text("apple")), xml \ "@bar") + } + + @Test + def attributePathDescendantAttributes: Unit = { + val xml = + assertEquals(NodeSeq.fromSeq(Seq(Text("1"), Text("2"))), (xml \\ "@bar")) + } + + @Test(expected=classOf[IllegalArgumentException]) + def attributePathDescendantIllegalEmptyAttribute: Unit = { + val xml = + xml \\ "@" + } + + @Test + def attributePathNoDescendantAttributes: Unit = { + val xml = + assertEquals(NodeSeq.Empty, (xml \\ "@oops")) + } + + @Test + def attributePathOneChildWithAttributes: Unit = { + val xml = > + assertEquals(Group(Seq(Text("1"))), (xml \ "b" \ "@bar")) + } + + @Test + def attributePathTwoChildrenWithAttributes: Unit = { + val xml = + val b = xml \ "b" + assertEquals(2, b.length) + assertEquals(NodeSeq.fromSeq(Seq(, )), b) + val barFail = b \ "@bar" + val barList = b.map(_ \ "@bar") + assertEquals(NodeSeq.Empty, barFail) + assertEquals(List(Group(Seq(Text("1"))), Group(Seq(Text("2")))), barList) + } + +} From d5609e3b6b71b661303976ecf01c4611b81efdda Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Sun, 9 Aug 2015 23:35:47 -0400 Subject: [PATCH 090/789] Add descendant XML attribute unit tests --- src/test/scala/scala/xml/AttributeTest.scala | 24 ++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/test/scala/scala/xml/AttributeTest.scala b/src/test/scala/scala/xml/AttributeTest.scala index 0018e0ee3..67b289748 100644 --- a/src/test/scala/scala/xml/AttributeTest.scala +++ b/src/test/scala/scala/xml/AttributeTest.scala @@ -104,6 +104,30 @@ class AttributeTest { assertEquals(NodeSeq.fromSeq(Seq(Text("1"), Text("2"))), (xml \\ "@bar")) } + @Test + def attributeDescendantPathChildAttributes: Unit = { + val xml = + assertEquals(NodeSeq.fromSeq(Seq(Text("1"), Text("2"))), (xml \ "b" \\ "@bar")) + } + + @Test + def attributeDescendantPathDescendantAttributes: Unit = { + val xml = + assertEquals(NodeSeq.fromSeq(Seq(Text("1"), Text("2"))), (xml \\ "b" \\ "@bar")) + } + + @Test + def attributeChildDescendantPathDescendantAttributes: Unit = { + val xml = + assertEquals(NodeSeq.fromSeq(Seq(Text("1"), Text("2"))), (xml \ "a" \\ "@bar")) + } + + @Test + def attributeDescendantDescendantPathDescendantAttributes: Unit = { + val xml = + assertEquals(NodeSeq.fromSeq(Seq(Text("1"), Text("2"))), (xml \\ "b" \\ "@bar")) + } + @Test(expected=classOf[IllegalArgumentException]) def attributePathDescendantIllegalEmptyAttribute: Unit = { val xml = From b1102e6cfa55d72085d126d0fdf4430fe39f185c Mon Sep 17 00:00:00 2001 From: Seth Tisue Date: Sat, 5 Sep 2015 22:02:13 -0400 Subject: [PATCH 091/789] update readme now that we have a maintainer --- README.md | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 39d5229f0..454991678 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,3 @@ -Maintainer wanted! -================== - -Would you like to maintain this project? (Please [get in touch](https://github.com/scala/scala#get-in-touch) with someone from the scala/scala core team!) - scala-xml [](https://travis-ci.org/scala/scala-xml) [](http://search.maven.org/#search%7Cga%7C1%7Cg%3Aorg.scala-lang.modules%20a%3Ascala-xml_2.11) [](http://search.maven.org/#search%7Cga%7C1%7Cg%3Aorg.scala-lang.modules%20a%3Ascala-xml_2.12*) [![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/scala/scala-xml) ========= @@ -15,5 +10,8 @@ The compiler was decoupled from this particular implementation using the same ap API documentation is available [here](http://www.scala-lang.org/api/current/scala-xml/). +## Maintenance status +This library is community-maintained. The lead maintainer is [@biswanaths](https://github.com/biswanaths). + ## Security best practices The XML spec has some features that are best turned off, to avoid unsavory things like file system access, DoS attacks,... Issue [#17](https://github.com/scala/scala-xml/issues/17) tracks the recommended way of configuring the xml parser used by scala-xml to avoid these. This is by no means an exhaustive list. We'll be happy to incorporate your suggestions -- just comment on the ticket! From b74cf5118ee4670821588b72d83a468be10e4982 Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Mon, 14 Sep 2015 13:51:31 -0400 Subject: [PATCH 092/789] Use NodeSeq.fromSeq instead of new NodeSeq { val theSeq = ... } --- src/main/scala/scala/xml/parsing/MarkupParser.scala | 2 +- src/test/scala/scala/xml/PatternMatching.scala | 4 ++-- src/test/scala/scala/xml/XMLTest.scala | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main/scala/scala/xml/parsing/MarkupParser.scala b/src/main/scala/scala/xml/parsing/MarkupParser.scala index 612cc88e3..04e665023 100755 --- a/src/main/scala/scala/xml/parsing/MarkupParser.scala +++ b/src/main/scala/scala/xml/parsing/MarkupParser.scala @@ -443,7 +443,7 @@ trait MarkupParser extends MarkupParserCommon with TokenTests { val ts = new NodeBuffer var exit = eof // todo: optimize seq repr. - def done = new NodeSeq { val theSeq = ts.toList } + def done = NodeSeq.fromSeq(ts.toList) while (!exit) { tmppos = pos diff --git a/src/test/scala/scala/xml/PatternMatching.scala b/src/test/scala/scala/xml/PatternMatching.scala index 05ec06268..c9d7c7e10 100644 --- a/src/test/scala/scala/xml/PatternMatching.scala +++ b/src/test/scala/scala/xml/PatternMatching.scala @@ -74,7 +74,7 @@ class PatternMatching extends { Baaaaaaalabla
; - assertTrue(new NodeSeq { val theSeq = books.child } match { + assertTrue(NodeSeq.fromSeq(books.child) match { case t @ Seq(Blabla) => false case _ => true }) @@ -110,4 +110,4 @@ class PatternMatching extends { case (ser: Serializable, "foo") => false }) } -} \ No newline at end of file +} diff --git a/src/test/scala/scala/xml/XMLTest.scala b/src/test/scala/scala/xml/XMLTest.scala index 6ab741390..57ebf2b68 100644 --- a/src/test/scala/scala/xml/XMLTest.scala +++ b/src/test/scala/scala/xml/XMLTest.scala @@ -37,7 +37,7 @@ class XMLTest { Text(x.attributes("value").toString + y.attributes("bazValue").toString + "!") }; - val pelems_2 = new NodeSeq { val theSeq = List(Text("38!"), Text("58!")) }; + val pelems_2 = NodeSeq.fromSeq(List(Text("38!"), Text("58!"))); assertTrue(pelems_1 sameElements pelems_2) assertTrue(Text("8") sameElements (p \\ "@bazValue")) } @@ -94,7 +94,7 @@ class XMLTest { assertEquals(results1Expected, results1) { - val actual = for (t @ Blabla <- new NodeSeq { val theSeq = books.child }.toList) + val actual = for (t @ Blabla <- NodeSeq.fromSeq(books.child).toList) yield t val expected = List(Blabla) assertEquals(expected, actual) @@ -312,7 +312,7 @@ class XMLTest { (parsedxml2 \\ "book") { n: Node => (n \ "title") xml_== "Data on ze web" } toString) assertTrue( - ((new NodeSeq { val theSeq = List(parsedxml2) }) \\ "_") sameElements List( + ((NodeSeq.fromSeq(List(parsedxml2))) \\ "_") sameElements List( Elem(null, "bib", e, sc, Elem(null, "book", e, sc, Elem(null, "author", e, sc, Text("Peter Buneman")), From 74348e5e452fb033ec635a5290b7477bbb9ffd1b Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Thu, 17 Sep 2015 10:58:37 -0400 Subject: [PATCH 093/789] Remove final keyword from scala.xml.MetaData per note --- src/main/scala/scala/xml/MetaData.scala | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/scala/scala/xml/MetaData.scala b/src/main/scala/scala/xml/MetaData.scala index cda29f801..ad413013c 100644 --- a/src/main/scala/scala/xml/MetaData.scala +++ b/src/main/scala/scala/xml/MetaData.scala @@ -26,8 +26,8 @@ object MetaData { * * Duplicates can be removed with `normalize`. */ - @tailrec // temporarily marked final so it will compile under -Xexperimental - final def concatenate(attribs: MetaData, new_tail: MetaData): MetaData = + @tailrec + def concatenate(attribs: MetaData, new_tail: MetaData): MetaData = if (attribs eq Null) new_tail else concatenate(attribs.next, attribs copy new_tail) From ab36ca0c11afb3cd0096b60d6e3cf875d9d8bd6e Mon Sep 17 00:00:00 2001 From: biswanaths Date: Fri, 23 Oct 2015 18:08:08 +0530 Subject: [PATCH 094/789] Enabling builds for java 1.7 and 1.9 --- build.sbt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build.sbt b/build.sbt index 10cfe06d3..95705fe74 100644 --- a/build.sbt +++ b/build.sbt @@ -10,9 +10,9 @@ scalaVersion := crossScalaVersions.value.head crossScalaVersions := { val java = System.getProperty("java.version") - if (java.startsWith("1.6.")) + if (java.startsWith("1.6.") || java.startsWith("1.7.")) Seq("2.11.7", "2.12.0-M1") - else if (java.startsWith("1.8.")) + else if (java.startsWith("1.8.") || java.startsWith("1.9.")) Seq("2.12.0-M2") else sys.error(s"don't know what Scala versions to build on $java") From 5fb415a49d8539ec57953e09a420e6088ff5fa75 Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Tue, 13 Oct 2015 11:34:42 -0400 Subject: [PATCH 095/789] Unit test for verifying complexity of basic transformer --- src/test/scala/scala/xml/Transformers.scala | 23 ++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/src/test/scala/scala/xml/Transformers.scala b/src/test/scala/scala/xml/Transformers.scala index 575883254..e02d0d6a6 100644 --- a/src/test/scala/scala/xml/Transformers.scala +++ b/src/test/scala/scala/xml/Transformers.scala @@ -56,4 +56,25 @@ class Transformers { ) } -} \ No newline at end of file + + @Test + def preserveReferentialComplexityInLinearComplexity = { // SI-4528 + var i = 0 + + val xmlNode =

Hello Example

+ + new RuleTransformer(new RewriteRule { + override def transform(n: Node): Seq[Node] = { + n match { + case t: Text if !t.text.trim.isEmpty => { + i += 1 + Text(t.text + "!") + } + case _ => n + } + } + }).transform(xmlNode) + + assertEquals(1, i) + } +} From ab0781856db8bbcc25fce1dffabc83b5dfeb4320 Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Tue, 27 Jan 2015 22:08:01 -0500 Subject: [PATCH 096/789] Nested XML adds empty xmlns attribute #45 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * src/test/scala/scala/xml/XMLTest.scala (namespacesWithNestedXmls): Modified test case by Muntis Grūbe. * src/main/scala/scala/xml/NamespaceBinding.scala (doBuildString): Add TopScope as a value to avoid building the namespace attribute string. --- src/main/scala/scala/xml/NamespaceBinding.scala | 2 +- src/test/scala/scala/xml/XMLTest.scala | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/main/scala/scala/xml/NamespaceBinding.scala b/src/main/scala/scala/xml/NamespaceBinding.scala index 8409c41e1..cb97c1d06 100644 --- a/src/main/scala/scala/xml/NamespaceBinding.scala +++ b/src/main/scala/scala/xml/NamespaceBinding.scala @@ -73,7 +73,7 @@ case class NamespaceBinding(prefix: String, uri: String, parent: NamespaceBindin } private def doBuildString(sb: StringBuilder, stop: NamespaceBinding) { - if ((this == null) || (this eq stop)) return // contains? + if (List(null, stop, TopScope).contains(this)) return val s = " xmlns%s=\"%s\"".format( (if (prefix != null) ":" + prefix else ""), diff --git a/src/test/scala/scala/xml/XMLTest.scala b/src/test/scala/scala/xml/XMLTest.scala index 57ebf2b68..5397b3e1c 100644 --- a/src/test/scala/scala/xml/XMLTest.scala +++ b/src/test/scala/scala/xml/XMLTest.scala @@ -164,6 +164,15 @@ class XMLTest { } } + @UnitTest + def namespacesWithNestedXmls: Unit = { + val foo = + val bar = {foo} + val expected = """""" + val actual = bar.toString + assertEquals(expected, actual) + } + @UnitTest def validationOfElements: Unit = { val vtor = new scala.xml.dtd.ElementValidator(); From 23e9b67836ecc049c1b9904b449f33c4e1068308 Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Mon, 15 Feb 2016 13:09:00 -0500 Subject: [PATCH 097/789] Unit tests for #35 OOM on malformed input * src/test/scala/scala/xml/XMLTest.scala (issue35): New test. * src/test/scala/scala/xml/pull/XMLEventReaderTest.scala (issue35): New test. --- src/test/scala/scala/xml/XMLTest.scala | 6 ++++++ .../scala/scala/xml/pull/XMLEventReaderTest.scala | 14 +++++++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/src/test/scala/scala/xml/XMLTest.scala b/src/test/scala/scala/xml/XMLTest.scala index 5397b3e1c..c86184ffd 100644 --- a/src/test/scala/scala/xml/XMLTest.scala +++ b/src/test/scala/scala/xml/XMLTest.scala @@ -847,6 +847,12 @@ expected closing tag of foo assertEquals("""""", pp.format(x)) } + @UnitTest( expected = classOf[scala.xml.SAXParseException] ) + def issue35: Unit = { + val broken = " Date: Mon, 22 Dec 2014 23:34:21 -0800 Subject: [PATCH 098/789] Fix #35 OOM on malformed input * src/main/scala/scala/xml/parsing/MarkupParserCommon.scala (xAttributeValue): Check for eof in while loop. --- src/main/scala/scala/xml/parsing/MarkupParserCommon.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/scala/scala/xml/parsing/MarkupParserCommon.scala b/src/main/scala/scala/xml/parsing/MarkupParserCommon.scala index 31d81d343..2e0568d12 100644 --- a/src/main/scala/scala/xml/parsing/MarkupParserCommon.scala +++ b/src/main/scala/scala/xml/parsing/MarkupParserCommon.scala @@ -63,7 +63,7 @@ private[scala] trait MarkupParserCommon extends TokenTests { */ def xAttributeValue(endCh: Char): String = { val buf = new StringBuilder - while (ch != endCh) { + while (ch != endCh && !eof) { // well-formedness constraint if (ch == '<') return errorAndResult("'<' not allowed in attrib value", "") else if (ch == SU) truncatedError("") From ea92325f90a7a94174df60eb3103da8d48a33caf Mon Sep 17 00:00:00 2001 From: shimamoto Date: Wed, 27 Apr 2016 12:10:30 +0900 Subject: [PATCH 099/789] Fix OOM on malformed input. This commit make up for the lack of #35. Specifically, CDATA sections, comment, DTD. --- .../scala/xml/parsing/MarkupParser.scala | 18 +-- .../xml/parsing/MarkupParserCommon.scala | 2 +- .../scala/xml/pull/XMLEventReaderTest.scala | 129 +++++++++++++++--- 3 files changed, 121 insertions(+), 28 deletions(-) diff --git a/src/main/scala/scala/xml/parsing/MarkupParser.scala b/src/main/scala/scala/xml/parsing/MarkupParser.scala index 04e665023..d9a61b393 100755 --- a/src/main/scala/scala/xml/parsing/MarkupParser.scala +++ b/src/main/scala/scala/xml/parsing/MarkupParser.scala @@ -265,7 +265,7 @@ trait MarkupParser extends MarkupParserCommon with TokenTests { } if (1 != elemCount) { reportSyntaxError("document must contain exactly one element") - Console.println(children.toList) + //Console.println(children.toList) } doc.children = children @@ -389,7 +389,7 @@ trait MarkupParser extends MarkupParserCommon with TokenTests { def xComment: NodeSeq = { val sb: StringBuilder = new StringBuilder() xToken("--") - while (true) { + while (!eof) { if (ch == '-' && { sb.append(ch); nextch(); ch == '-' }) { sb.length = sb.length - 1 nextch() @@ -398,7 +398,7 @@ trait MarkupParser extends MarkupParserCommon with TokenTests { } else sb.append(ch) nextch() } - throw FatalError("this cannot happen") + throw truncatedError("broken comment") } /* todo: move this into the NodeBuilder class */ @@ -678,10 +678,10 @@ trait MarkupParser extends MarkupParserCommon with TokenTests { def markupDecl1() = { def doInclude() = { - xToken('['); while (']' != ch) markupDecl(); nextch() // ']' + xToken('['); while (']' != ch && !eof) markupDecl(); nextch() // ']' } def doIgnore() = { - xToken('['); while (']' != ch) nextch(); nextch() // ']' + xToken('['); while (']' != ch && !eof) nextch(); nextch() // ']' } if ('?' == ch) { nextch() @@ -747,7 +747,7 @@ trait MarkupParser extends MarkupParserCommon with TokenTests { case _ => curInput.reportError(pos, "unexpected character '" + ch + "', expected some markupdecl") - while (ch != '>') + while (ch != '>' && !eof) nextch() } } @@ -780,7 +780,7 @@ trait MarkupParser extends MarkupParserCommon with TokenTests { def intSubset() { //Console.println("(DEBUG) intSubset()") xSpace() - while (']' != ch) + while (']' != ch && !eof) markupDecl() } @@ -792,7 +792,7 @@ trait MarkupParser extends MarkupParserCommon with TokenTests { xSpace() val n = xName xSpace() - while ('>' != ch) { + while ('>' != ch && !eof) { //Console.println("["+ch+"]") putChar(ch) nextch() @@ -817,7 +817,7 @@ trait MarkupParser extends MarkupParserCommon with TokenTests { var attList: List[AttrDecl] = Nil // later: find the elemDecl for n - while ('>' != ch) { + while ('>' != ch && !eof) { val aname = xName xSpace() // could be enumeration (foo,bar) parse this later :-/ diff --git a/src/main/scala/scala/xml/parsing/MarkupParserCommon.scala b/src/main/scala/scala/xml/parsing/MarkupParserCommon.scala index 2e0568d12..72d669f21 100644 --- a/src/main/scala/scala/xml/parsing/MarkupParserCommon.scala +++ b/src/main/scala/scala/xml/parsing/MarkupParserCommon.scala @@ -247,7 +247,7 @@ private[scala] trait MarkupParserCommon extends TokenTests { while (true) { if (ch == head && peek(rest)) return handler(positioner(), sb.toString) - else if (ch == SU) + else if (ch == SU || eof) truncatedError("") // throws TruncatedXMLControl in compiler sb append ch diff --git a/src/test/scala/scala/xml/pull/XMLEventReaderTest.scala b/src/test/scala/scala/xml/pull/XMLEventReaderTest.scala index cf5b2504a..b45cd605d 100644 --- a/src/test/scala/scala/xml/pull/XMLEventReaderTest.scala +++ b/src/test/scala/scala/xml/pull/XMLEventReaderTest.scala @@ -2,12 +2,7 @@ package scala.xml package pull import org.junit.Test -import org.junit.Ignore -import org.junit.runner.RunWith -import org.junit.runners.JUnit4 -import org.junit.Assert.assertTrue -import org.junit.Assert.assertFalse -import org.junit.Assert.assertEquals +import org.junit.Assert.{assertFalse, assertTrue} import scala.io.Source @@ -15,6 +10,11 @@ class XMLEventReaderTest { val src = Source.fromString("!") + private def toSource(s: String) = new Source { + val iter = s.iterator + override def reportError(pos: Int, msg: String, out: java.io.PrintStream = Console.err) {} + } + @Test def pull: Unit = { val er = new XMLEventReader(src) @@ -44,17 +44,110 @@ class XMLEventReaderTest { @Test def issue35: Unit = { val broken = " + | + | | | @@ -66,8 +159,8 @@ class XMLEventReaderTest { | |""".stripMargin - val er = new XMLEventReader(Source.fromString(data)) - while(er.hasNext) er.next() - er.stop() - } + val er = new XMLEventReader(toSource(data)) + while(er.hasNext) er.next() + er.stop() + } } From ca3e8ceb09a338d7e1917a7fcee4089a35f32778 Mon Sep 17 00:00:00 2001 From: shimamoto Date: Mon, 2 May 2016 12:30:46 +0900 Subject: [PATCH 100/789] Fix unit tests on malformed input. Verify to throw FatalError at a broken CDATA section and comment. --- .../scala/xml/pull/XMLEventReaderTest.scala | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/src/test/scala/scala/xml/pull/XMLEventReaderTest.scala b/src/test/scala/scala/xml/pull/XMLEventReaderTest.scala index b45cd605d..6b66326da 100644 --- a/src/test/scala/scala/xml/pull/XMLEventReaderTest.scala +++ b/src/test/scala/scala/xml/pull/XMLEventReaderTest.scala @@ -5,6 +5,7 @@ import org.junit.Test import org.junit.Assert.{assertFalse, assertTrue} import scala.io.Source +import scala.xml.parsing.FatalError class XMLEventReaderTest { @@ -49,28 +50,32 @@ class XMLEventReaderTest { assertTrue(r.next.isInstanceOf[EvElemStart]) } - @Test + @Test(expected = classOf[FatalError]) def malformedCDATA: Unit = { val data = "", toString) + + @UnitTest + def weirdElem = + assertEquals("", toString) + + @UnitTest + def escape = + assertEquals(""" + "Come, come again, whoever you are, come! +Heathen, fire worshipper or idolatrous, come! +Come even if you broke your penitence a hundred times, +Ours is the portal of hope, come as you are." + Mevlana Celaleddin Rumi""", toString) // this guy will escaped, and rightly so + + @UnitTest + def unparsed2 = { + object myBreak extends scala.xml.Unparsed("
") + assertEquals("
", { myBreak } toString) // shows use of unparsed + } + + @UnitTest + def justDontFail = { + match { + case scala.xml.QNode("gaga", "foo", md, child @ _*) => + } + + match { + case scala.xml.Node("foo", md, child @ _*) => + } + } + + def f(s: String) = { + + { + for (item <- s split ',') yield { item } + } + + } + + @UnitTest + def nodeBuffer = + assertEquals( + """ + abc + """, f("a,b,c") toString) + + // t-486 + def wsdlTemplate1(serviceName: String): Node = + + ; + + def wsdlTemplate2(serviceName: String, targetNamespace: String): Node = + + ; + + def wsdlTemplate3(serviceName: String): Node = + + ; + + def wsdlTemplate4(serviceName: String, targetNamespace: () => String): Node = + + ; + + @UnitTest + def wsdl = { + assertEquals(""" + """, wsdlTemplate1("service1") toString) + assertEquals(""" + """, wsdlTemplate2("service2", "target2") toString) + assertEquals(""" + """, wsdlTemplate3("service3") toString) + assertEquals(""" + """, wsdlTemplate4("service4", () => "target4") toString) + } + + @UnitTest + def t1079 = assertFalse( == ) + + import dtd.{ DocType, PublicID } + + @UnitTest + def t1620 = { + val dt = DocType("foo", PublicID("-//Foo Corp//DTD 1.0//EN", "foo.dtd"), Seq()) + var pw = new StringWriter() + XML.write(pw, , "utf-8", true, dt) + pw.flush() + assertEquals(""" + +""", pw.toString) + + pw = new StringWriter() + val dt2 = DocType("foo", PublicID("-//Foo Corp//DTD 1.0//EN", null), Seq()) + XML.write(pw, , "utf-8", true, dt2) + pw.flush() + assertEquals(""" + +""", pw.toString) + } + + @UnitTest + def t1773 = { + val xs = List( + , + , + { xml.NodeSeq.Empty }, + { "" }, + { if (true) "" else "I like turtles" }) + + for (x1 <- xs; x2 <- xs) assertTrue(x1 xml_== x2) + } + + @UnitTest + def t3886 = { + assertTrue( == ) + assertTrue( != ) + assertTrue( != ) + + assertTrue( != ) + assertTrue( != ) + assertTrue( != ) + } + + @UnitTest + def t5052 { + assertTrue( xml_== ) + assertTrue( xml_== ) + assertTrue( xml_== ) + assertTrue( xml_== ) + } + + @UnitTest + def t5115 = { + def assertHonorsIterableContract(i: Iterable[_]) = assertEquals(i.size, i.iterator.size) + + assertHonorsIterableContract(.attributes) + assertHonorsIterableContract(.attributes) + assertHonorsIterableContract(.attributes) + assertHonorsIterableContract(.attributes) + assertHonorsIterableContract(.attributes) + assertHonorsIterableContract(.attributes) + assertHonorsIterableContract(.attributes) + assertHonorsIterableContract(.attributes) + } + + @UnitTest + def t5843 { + val foo = scala.xml.Attribute(null, "foo", "1", scala.xml.Null) + val bar = scala.xml.Attribute(null, "bar", "2", foo) + val ns = scala.xml.NamespaceBinding(null, "uri", scala.xml.TopScope) + + assertEquals(""" foo="1"""", foo toString) + assertEquals(null, scala.xml.TopScope.getURI(foo.pre)) + assertEquals(""" bar="2"""", bar remove "foo" toString) + assertEquals(""" foo="1"""", bar remove "bar" toString) + assertEquals(""" bar="2"""", bar remove (null, scala.xml.TopScope, "foo") toString) + assertEquals(""" foo="1"""", bar remove (null, scala.xml.TopScope, "bar") toString) + assertEquals(""" bar="2" foo="1"""", bar toString) + assertEquals(""" bar="2" foo="1"""", bar remove (null, ns, "foo") toString) + assertEquals(""" bar="2" foo="1"""", bar remove (null, ns, "bar") toString) + } + + @UnitTest + def t7074 { + assertEquals("""""", sort() toString) + assertEquals("""""", sort() toString) + assertEquals("""""", sort() toString) + assertEquals("""""", sort() toString) + assertEquals("""""", sort() toString) + assertEquals("""""", sort() toString) + assertEquals("""""", sort() toString) + assertEquals("""""", sort() toString) + assertEquals("""""", sort() toString) + } + + @UnitTest + def attributes = { + val noAttr = + val attrNull = + val attrNone = + val preAttrNull = + val preAttrNone = + assertEquals(noAttr, attrNull) + assertEquals(noAttr, attrNone) + assertEquals(noAttr, preAttrNull) + assertEquals(noAttr, preAttrNone) + + val xml1 = + val xml2 = + val xml3 = + assertEquals(xml1, xml2) + assertEquals(xml1, xml3) + + assertEquals("""""", noAttr toString) + assertEquals("""""", attrNull toString) + assertEquals("""""", attrNone toString) + assertEquals("""""", preAttrNull toString) + assertEquals("""""", preAttrNone toString) + assertEquals("""""", xml1 toString) + assertEquals("""""", xml2 toString) + assertEquals("""""", xml3 toString) + + // Check if attribute order is retained + assertEquals("""""", toString) + assertEquals("""""", toString) + assertEquals("""""", toString) + assertEquals("""""", toString) + } + + @UnitTest + def issue28: Unit = { + val x = + // val ns = new NamespaceBinding("x", "gaga", sc) + // val x = Elem("x", "foo", e, ns) + val pp = new xml.PrettyPrinter(80, 2) + // This assertion passed + assertEquals("""""", x.toString) + // This was the bug, producing an errant xmlns attribute + assertEquals("""""", pp.format(x)) + } + + @UnitTest + def nodeSeqNs: Unit = { + val x = { + + } + val pp = new PrettyPrinter(80, 2) + val expected = """""" + assertEquals(expected, pp.formatNodes(x)) + } + + @UnitTest + def nodeStringBuilder: Unit = { + val x = { + + } + val pp = new PrettyPrinter(80, 2) + val expected = """""" + val sb = new StringBuilder + pp.format(x, sb) + assertEquals(expected, sb.toString) + } +} diff --git a/js/src/test/scala/scala/xml/parsing/PiParsingTest.scala b/js/src/test/scala/scala/xml/parsing/PiParsingTest.scala new file mode 100644 index 000000000..fedf38dc5 --- /dev/null +++ b/js/src/test/scala/scala/xml/parsing/PiParsingTest.scala @@ -0,0 +1,28 @@ +package scala.xml.parsing + +import org.junit.Test +import org.junit.Ignore +import org.junit.runner.RunWith +import org.junit.runners.JUnit4 +import scala.xml.JUnitAssertsForXML.assertEquals + +class PiParsingTest { + + + import scala.io.Source.fromString + import scala.xml.TopScope + + @Test + def piNoWSLiteral: Unit = { + val expected = "ab" + assertEquals(expected, ab) + } + + + @Test + def piLiteral: Unit = { + val expected = " a b " + assertEquals(expected, a b ) + } + +} diff --git a/js/src/test/scala/scala/xml/parsing/Ticket0632Test.scala b/js/src/test/scala/scala/xml/parsing/Ticket0632Test.scala new file mode 100644 index 000000000..8b939118a --- /dev/null +++ b/js/src/test/scala/scala/xml/parsing/Ticket0632Test.scala @@ -0,0 +1,35 @@ +package scala.xml.parsing + +import org.junit.Test +import org.junit.Ignore +import org.junit.runner.RunWith +import org.junit.runners.JUnit4 +import scala.xml.JUnitAssertsForXML.assertEquals + +class Ticket0632Test { + + import scala.io.Source.fromString + import scala.xml.{NodeSeq, TopScope} + + @Test + def singleAmp: Unit = { + val expected = "" + assertEquals(expected, ) + assertEquals(expected, ) + } + + @Test + def oneAndHalfAmp: Unit = { + val expected = "" + assertEquals(expected, ) + assertEquals(expected, ) + } + + @Test + def doubleAmp: Unit = { + val expected = "" + assertEquals(expected, ) + assertEquals(expected, ) + } + +} diff --git a/js/src/test/scala/scala/xml/pull/XMLEventReaderTest.scala b/js/src/test/scala/scala/xml/pull/XMLEventReaderTest.scala new file mode 100644 index 000000000..6cfd4e872 --- /dev/null +++ b/js/src/test/scala/scala/xml/pull/XMLEventReaderTest.scala @@ -0,0 +1,19 @@ +package scala.xml +package pull + +import org.junit.Test +import org.junit.Assert.{assertFalse, assertTrue} + +import scala.io.Source +import scala.xml.parsing.FatalError + +class XMLEventReaderTest { + + val src = Source.fromString("!") + + private def toSource(s: String) = new Source { + val iter = s.iterator + override def reportError(pos: Int, msg: String, out: java.io.PrintStream = Console.err) {} + } + +} From c9130c3c46f938a740107a53abacbeda0668b241 Mon Sep 17 00:00:00 2001 From: Seth Tisue Date: Sat, 17 Dec 2016 17:32:58 -0800 Subject: [PATCH 113/789] Typesafe -> Lightbend --- .travis.yml | 2 +- LICENSE.md | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 51e8e9977..50fb3fb36 100644 --- a/.travis.yml +++ b/.travis.yml @@ -19,4 +19,4 @@ jdk: - oraclejdk8 notifications: - email: adriaan.moors@typesafe.com + email: adriaan.moors@lightbend.com diff --git a/LICENSE.md b/LICENSE.md index c9f2ca8a7..ab370cc81 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -1,5 +1,5 @@ -Copyright (c) 2002-2013 EPFL -Copyright (c) 2011-2013 Typesafe, Inc. +Copyright (c) 2002-2016 EPFL +Copyright (c) 2011-2016 Lightbend, Inc. All rights reserved. @@ -25,4 +25,4 @@ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. \ No newline at end of file +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. From 0975a624fb933e128fbfa7dbfb19c49f59a78a7f Mon Sep 17 00:00:00 2001 From: Seth Tisue Date: Sat, 17 Dec 2016 17:33:13 -0800 Subject: [PATCH 114/789] very minor README tweaks --- README.md | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 454991678..ac0d527f5 100644 --- a/README.md +++ b/README.md @@ -3,15 +3,17 @@ scala-xml [](https The standard Scala XML library. Please file issues here instead of over at issues.scala-lang.org. -As of Scala 2.11, this library is a separate jar that can be omitted from Scala projects that do not use XML. -If you are cross-building a project that uses scala-xml with Scala 2.10 and Scala 2.11, take a look [this example](https://github.com/scala/scala-module-dependency-sample). +Since Scala 2.11, this library is a separate jar that can be omitted from Scala projects that do not use XML. +If you are cross-building a project that uses scala-xml with both Scala 2.10 and later Scala versions, take a look [this example](https://github.com/scala/scala-module-dependency-sample). -The compiler was decoupled from this particular implementation using the same approach as for comprehensions (xml syntax is desugared into a set of method calls, which unfortunately is only defined by the [implementation](https://github.com/scala/scala/blob/2.11.x/src/compiler/scala/tools/nsc/ast/parser/SymbolicXMLBuilder.scala)). Alternative implementations are welcome! +The compiler was decoupled from this particular implementation using the same approach as for comprehensions (XML syntax is desugared into a set of method calls, which unfortunately is only defined by the [implementation](https://github.com/scala/scala/blob/2.11.x/src/compiler/scala/tools/nsc/ast/parser/SymbolicXMLBuilder.scala)). Alternative implementations are welcome! API documentation is available [here](http://www.scala-lang.org/api/current/scala-xml/). ## Maintenance status + This library is community-maintained. The lead maintainer is [@biswanaths](https://github.com/biswanaths). ## Security best practices -The XML spec has some features that are best turned off, to avoid unsavory things like file system access, DoS attacks,... Issue [#17](https://github.com/scala/scala-xml/issues/17) tracks the recommended way of configuring the xml parser used by scala-xml to avoid these. This is by no means an exhaustive list. We'll be happy to incorporate your suggestions -- just comment on the ticket! + +The XML spec has some features that are best turned off, to avoid unsavory things like file system access, DoS attacks,... Issue [#17](https://github.com/scala/scala-xml/issues/17) tracks the recommended way of configuring the XML parser used by scala-xml to avoid these. This is by no means an exhaustive list. We'll be happy to incorporate your suggestions -- just comment on the ticket! From a437bcf0a493efa89140e0bfaf9031b0a6281e7c Mon Sep 17 00:00:00 2001 From: Seth Tisue Date: Sat, 17 Dec 2016 17:33:33 -0800 Subject: [PATCH 115/789] use latest Scala in sbt build --- build.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index cb27cd845..1020608f0 100644 --- a/build.sbt +++ b/build.sbt @@ -13,7 +13,7 @@ crossScalaVersions := { if (java.startsWith("1.6.") || java.startsWith("1.7.")) Seq("2.11.8") else if (java.startsWith("1.8.") || java.startsWith("1.9.")) - Seq("2.12.0-RC1") + Seq("2.12.1") else sys.error(s"don't know what Scala versions to build on $java") } From 6e58d6afc323f0628df6ab9450fb977653238179 Mon Sep 17 00:00:00 2001 From: Seth Tisue Date: Sat, 4 Feb 2017 09:04:37 -0700 Subject: [PATCH 116/789] use latest Scala.js this is required to fix Travis failures after #109 was merged --- project/plugins.sbt | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/project/plugins.sbt b/project/plugins.sbt index 02f25173e..03dbd0511 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,4 +1,3 @@ addSbtPlugin("org.scala-lang.modules" % "scala-module-plugin" % "1.0.4") -addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.12") - +addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.14") From 0f98c9630af60a5d849da235398818fceff9cfcd Mon Sep 17 00:00:00 2001 From: Seth Tisue Date: Sat, 4 Feb 2017 09:13:01 -0700 Subject: [PATCH 117/789] speed up Travis builds using caching feature --- .travis.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.travis.yml b/.travis.yml index 50fb3fb36..0493fb4cc 100644 --- a/.travis.yml +++ b/.travis.yml @@ -20,3 +20,12 @@ jdk: notifications: email: adriaan.moors@lightbend.com + +before_cache: + - find $HOME/.sbt -name "*.lock" | xargs rm + - find $HOME/.ivy2/cache -name "ivydata-*.properties" | xargs rm +cache: + directories: + - $HOME/.ivy2/cache + - $HOME/.sbt/boot + - $HOME/.sbt/launchers From 3187670ae8fa4a22fb52180afabfe308d8daf365 Mon Sep 17 00:00:00 2001 From: Olivier Blanvillain Date: Sat, 4 Feb 2017 21:36:18 +0100 Subject: [PATCH 118/789] Move js tests to shared --- {js => shared}/src/test/scala/scala/xml/ReuseNodesTest.scala | 0 {js => shared}/src/test/scala/scala/xml/XMLSyntaxTest.scala | 0 {js => shared}/src/test/scala/scala/xml/XMLTest.scala | 0 .../src/test/scala/scala/xml/parsing/PiParsingTest.scala | 0 .../src/test/scala/scala/xml/parsing/Ticket0632Test.scala | 0 .../src/test/scala/scala/xml/pull/XMLEventReaderTest.scala | 0 6 files changed, 0 insertions(+), 0 deletions(-) rename {js => shared}/src/test/scala/scala/xml/ReuseNodesTest.scala (100%) rename {js => shared}/src/test/scala/scala/xml/XMLSyntaxTest.scala (100%) rename {js => shared}/src/test/scala/scala/xml/XMLTest.scala (100%) rename {js => shared}/src/test/scala/scala/xml/parsing/PiParsingTest.scala (100%) rename {js => shared}/src/test/scala/scala/xml/parsing/Ticket0632Test.scala (100%) rename {js => shared}/src/test/scala/scala/xml/pull/XMLEventReaderTest.scala (100%) diff --git a/js/src/test/scala/scala/xml/ReuseNodesTest.scala b/shared/src/test/scala/scala/xml/ReuseNodesTest.scala similarity index 100% rename from js/src/test/scala/scala/xml/ReuseNodesTest.scala rename to shared/src/test/scala/scala/xml/ReuseNodesTest.scala diff --git a/js/src/test/scala/scala/xml/XMLSyntaxTest.scala b/shared/src/test/scala/scala/xml/XMLSyntaxTest.scala similarity index 100% rename from js/src/test/scala/scala/xml/XMLSyntaxTest.scala rename to shared/src/test/scala/scala/xml/XMLSyntaxTest.scala diff --git a/js/src/test/scala/scala/xml/XMLTest.scala b/shared/src/test/scala/scala/xml/XMLTest.scala similarity index 100% rename from js/src/test/scala/scala/xml/XMLTest.scala rename to shared/src/test/scala/scala/xml/XMLTest.scala diff --git a/js/src/test/scala/scala/xml/parsing/PiParsingTest.scala b/shared/src/test/scala/scala/xml/parsing/PiParsingTest.scala similarity index 100% rename from js/src/test/scala/scala/xml/parsing/PiParsingTest.scala rename to shared/src/test/scala/scala/xml/parsing/PiParsingTest.scala diff --git a/js/src/test/scala/scala/xml/parsing/Ticket0632Test.scala b/shared/src/test/scala/scala/xml/parsing/Ticket0632Test.scala similarity index 100% rename from js/src/test/scala/scala/xml/parsing/Ticket0632Test.scala rename to shared/src/test/scala/scala/xml/parsing/Ticket0632Test.scala diff --git a/js/src/test/scala/scala/xml/pull/XMLEventReaderTest.scala b/shared/src/test/scala/scala/xml/pull/XMLEventReaderTest.scala similarity index 100% rename from js/src/test/scala/scala/xml/pull/XMLEventReaderTest.scala rename to shared/src/test/scala/scala/xml/pull/XMLEventReaderTest.scala From 0e43f6be172113a057961ebd11ca43b545026a0d Mon Sep 17 00:00:00 2001 From: Olivier Blanvillain Date: Sat, 4 Feb 2017 21:48:06 +0100 Subject: [PATCH 119/789] Remove two empty test classes (these tested nothing) --- .../test/scala/scala/xml/ReuseNodesTest.scala | 58 ------------------- .../scala/xml/pull/XMLEventReaderTest.scala | 19 ------ 2 files changed, 77 deletions(-) delete mode 100644 shared/src/test/scala/scala/xml/ReuseNodesTest.scala delete mode 100644 shared/src/test/scala/scala/xml/pull/XMLEventReaderTest.scala diff --git a/shared/src/test/scala/scala/xml/ReuseNodesTest.scala b/shared/src/test/scala/scala/xml/ReuseNodesTest.scala deleted file mode 100644 index 75f67efaf..000000000 --- a/shared/src/test/scala/scala/xml/ReuseNodesTest.scala +++ /dev/null @@ -1,58 +0,0 @@ -package scala.xml - -import scala.xml.transform._ -import org.junit.Test -import org.junit.Assert.assertTrue -import org.junit.Assert.assertEquals -import org.junit.runner.RunWith -/** - * This test verify that after the tranform, the resultant xml node - * uses as many old nodes as possible. - * - * Three transformers class for case - - * One for orginal, one for modified, and one proposed which shows - * all are equivalent when it comes to reusing as many nodes as possible - */ -object ReuseNodesTest { - - class OriginalTranformr(rules: RewriteRule*) extends RuleTransformer(rules:_*) { - override def transform(ns: Seq[Node]): Seq[Node] = { - val xs = ns.toStream map transform - val (xs1, xs2) = xs zip ns span { case (x, n) => unchanged(n, x) } - - if (xs2.isEmpty) ns - else (xs1 map (_._2)) ++ xs2.head._1 ++ transform(ns drop (xs1.length + 1)) - } - override def transform(n:Node): Seq[Node] = super.transform(n) - } - - class ModifiedTranformr(rules: RewriteRule*) extends RuleTransformer(rules:_*) { - override def transform(ns: Seq[Node]): Seq[Node] = { - val changed = ns flatMap transform - - if (changed.length != ns.length || (changed, ns).zipped.exists(_ != _)) changed - else ns - } - override def transform(n:Node): Seq[Node] = super.transform(n) - } - - class AlternateTranformr(rules: RewriteRule*) extends RuleTransformer(rules:_*) { - override def transform(ns: Seq[Node]): Seq[Node] = { - val xs = ns.toStream map transform - val (xs1, xs2) = xs zip ns span { case (x, n) => unchanged(n, x) } - - if (xs2.isEmpty) ns - else (xs1 map (_._2)) ++ xs2.head._1 ++ transform(ns drop (xs1.length + 1)) - } - override def transform(n:Node): Seq[Node] = super.transform(n) - } - - def rewriteRule = new RewriteRule { - override def transform(n: Node): NodeSeq = n match { - case n if n.label == "change" => Elem( - n.prefix, "changed", n.attributes, n.scope, n.child.isEmpty, n.child : _*) - case _ => n - } - } - -} diff --git a/shared/src/test/scala/scala/xml/pull/XMLEventReaderTest.scala b/shared/src/test/scala/scala/xml/pull/XMLEventReaderTest.scala deleted file mode 100644 index 6cfd4e872..000000000 --- a/shared/src/test/scala/scala/xml/pull/XMLEventReaderTest.scala +++ /dev/null @@ -1,19 +0,0 @@ -package scala.xml -package pull - -import org.junit.Test -import org.junit.Assert.{assertFalse, assertTrue} - -import scala.io.Source -import scala.xml.parsing.FatalError - -class XMLEventReaderTest { - - val src = Source.fromString("!") - - private def toSource(s: String) = new Source { - val iter = s.iterator - override def reportError(pos: Int, msg: String, out: java.io.PrintStream = Console.err) {} - } - -} From 46f5cad6b6961e0a7f85b922e97549e9545abbf7 Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Sat, 4 Feb 2017 23:47:52 -0500 Subject: [PATCH 120/789] Update copyright to 2017 --- LICENSE.md | 4 ++-- shared/src/main/scala/scala/xml/Atom.scala | 2 +- shared/src/main/scala/scala/xml/Attribute.scala | 2 +- shared/src/main/scala/scala/xml/Comment.scala | 2 +- shared/src/main/scala/scala/xml/Document.scala | 2 +- shared/src/main/scala/scala/xml/Elem.scala | 2 +- shared/src/main/scala/scala/xml/EntityRef.scala | 2 +- shared/src/main/scala/scala/xml/Equality.scala | 2 +- shared/src/main/scala/scala/xml/Group.scala | 2 +- .../main/scala/scala/xml/MalformedAttributeException.scala | 2 +- shared/src/main/scala/scala/xml/MetaData.scala | 2 +- shared/src/main/scala/scala/xml/NamespaceBinding.scala | 2 +- shared/src/main/scala/scala/xml/Node.scala | 2 +- shared/src/main/scala/scala/xml/NodeBuffer.scala | 2 +- shared/src/main/scala/scala/xml/NodeSeq.scala | 2 +- shared/src/main/scala/scala/xml/Null.scala | 2 +- shared/src/main/scala/scala/xml/PCData.scala | 2 +- shared/src/main/scala/scala/xml/PrefixedAttribute.scala | 2 +- shared/src/main/scala/scala/xml/PrettyPrinter.scala | 2 +- shared/src/main/scala/scala/xml/ProcInstr.scala | 2 +- shared/src/main/scala/scala/xml/QNode.scala | 2 +- shared/src/main/scala/scala/xml/SpecialNode.scala | 2 +- shared/src/main/scala/scala/xml/Text.scala | 2 +- shared/src/main/scala/scala/xml/TextBuffer.scala | 2 +- shared/src/main/scala/scala/xml/TopScope.scala | 2 +- shared/src/main/scala/scala/xml/TypeSymbol.scala | 2 +- shared/src/main/scala/scala/xml/Unparsed.scala | 2 +- shared/src/main/scala/scala/xml/UnprefixedAttribute.scala | 2 +- shared/src/main/scala/scala/xml/Utility.scala | 2 +- shared/src/main/scala/scala/xml/XML.scala | 2 +- shared/src/main/scala/scala/xml/dtd/ContentModel.scala | 2 +- shared/src/main/scala/scala/xml/dtd/ContentModelParser.scala | 2 +- shared/src/main/scala/scala/xml/dtd/DTD.scala | 2 +- shared/src/main/scala/scala/xml/dtd/Decl.scala | 2 +- shared/src/main/scala/scala/xml/dtd/DocType.scala | 2 +- shared/src/main/scala/scala/xml/dtd/ElementValidator.scala | 2 +- shared/src/main/scala/scala/xml/dtd/ExternalID.scala | 2 +- shared/src/main/scala/scala/xml/dtd/Scanner.scala | 2 +- shared/src/main/scala/scala/xml/dtd/Tokens.scala | 2 +- shared/src/main/scala/scala/xml/dtd/ValidationException.scala | 2 +- shared/src/main/scala/scala/xml/dtd/impl/Base.scala | 2 +- shared/src/main/scala/scala/xml/dtd/impl/BaseBerrySethi.scala | 2 +- shared/src/main/scala/scala/xml/dtd/impl/DetWordAutom.scala | 2 +- shared/src/main/scala/scala/xml/dtd/impl/Inclusion.scala | 2 +- .../src/main/scala/scala/xml/dtd/impl/NondetWordAutom.scala | 2 +- .../src/main/scala/scala/xml/dtd/impl/PointedHedgeExp.scala | 2 +- .../main/scala/scala/xml/dtd/impl/SubsetConstruction.scala | 2 +- shared/src/main/scala/scala/xml/dtd/impl/SyntaxError.scala | 2 +- shared/src/main/scala/scala/xml/dtd/impl/WordBerrySethi.scala | 2 +- shared/src/main/scala/scala/xml/dtd/impl/WordExp.scala | 2 +- shared/src/main/scala/scala/xml/factory/Binder.scala | 2 +- .../src/main/scala/scala/xml/factory/LoggedNodeFactory.scala | 2 +- shared/src/main/scala/scala/xml/factory/NodeFactory.scala | 2 +- shared/src/main/scala/scala/xml/factory/XMLLoader.scala | 2 +- .../scala/scala/xml/include/CircularIncludeException.scala | 2 +- .../scala/xml/include/UnavailableResourceException.scala | 2 +- .../src/main/scala/scala/xml/include/XIncludeException.scala | 2 +- .../main/scala/scala/xml/include/sax/EncodingHeuristics.scala | 2 +- .../src/main/scala/scala/xml/include/sax/XIncludeFilter.scala | 2 +- shared/src/main/scala/scala/xml/include/sax/XIncluder.scala | 2 +- shared/src/main/scala/scala/xml/package.scala | 2 +- .../main/scala/scala/xml/parsing/ConstructingHandler.scala | 2 +- .../src/main/scala/scala/xml/parsing/ConstructingParser.scala | 2 +- .../main/scala/scala/xml/parsing/DefaultMarkupHandler.scala | 2 +- shared/src/main/scala/scala/xml/parsing/ExternalSources.scala | 2 +- shared/src/main/scala/scala/xml/parsing/FactoryAdapter.scala | 2 +- shared/src/main/scala/scala/xml/parsing/FatalError.scala | 2 +- shared/src/main/scala/scala/xml/parsing/MarkupHandler.scala | 2 +- shared/src/main/scala/scala/xml/parsing/MarkupParser.scala | 2 +- .../src/main/scala/scala/xml/parsing/MarkupParserCommon.scala | 2 +- .../scala/scala/xml/parsing/NoBindingFactoryAdapter.scala | 2 +- shared/src/main/scala/scala/xml/parsing/TokenTests.scala | 2 +- .../scala/scala/xml/parsing/ValidatingMarkupHandler.scala | 2 +- shared/src/main/scala/scala/xml/parsing/XhtmlEntities.scala | 2 +- shared/src/main/scala/scala/xml/parsing/XhtmlParser.scala | 2 +- .../main/scala/scala/xml/persistent/CachedFileStorage.scala | 2 +- shared/src/main/scala/scala/xml/persistent/Index.scala | 2 +- shared/src/main/scala/scala/xml/persistent/SetStorage.scala | 2 +- shared/src/main/scala/scala/xml/pull/XMLEvent.scala | 2 +- shared/src/main/scala/scala/xml/pull/XMLEventReader.scala | 2 +- .../src/main/scala/scala/xml/transform/BasicTransformer.scala | 2 +- shared/src/main/scala/scala/xml/transform/RewriteRule.scala | 2 +- .../src/main/scala/scala/xml/transform/RuleTransformer.scala | 2 +- 83 files changed, 84 insertions(+), 84 deletions(-) diff --git a/LICENSE.md b/LICENSE.md index ab370cc81..4ce1fe0e3 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -1,5 +1,5 @@ -Copyright (c) 2002-2016 EPFL -Copyright (c) 2011-2016 Lightbend, Inc. +Copyright (c) 2002-2017 EPFL +Copyright (c) 2011-2017 Lightbend, Inc. All rights reserved. diff --git a/shared/src/main/scala/scala/xml/Atom.scala b/shared/src/main/scala/scala/xml/Atom.scala index 84f59bc50..9af64c274 100644 --- a/shared/src/main/scala/scala/xml/Atom.scala +++ b/shared/src/main/scala/scala/xml/Atom.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2013, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2003-2017, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/Attribute.scala b/shared/src/main/scala/scala/xml/Attribute.scala index d3a89d6fb..c31c430f6 100644 --- a/shared/src/main/scala/scala/xml/Attribute.scala +++ b/shared/src/main/scala/scala/xml/Attribute.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2013, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2003-2017, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/Comment.scala b/shared/src/main/scala/scala/xml/Comment.scala index 23d4a9d4a..b13adde91 100644 --- a/shared/src/main/scala/scala/xml/Comment.scala +++ b/shared/src/main/scala/scala/xml/Comment.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2013, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2003-2017, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/Document.scala b/shared/src/main/scala/scala/xml/Document.scala index 3410b15d7..a6a9a4f69 100644 --- a/shared/src/main/scala/scala/xml/Document.scala +++ b/shared/src/main/scala/scala/xml/Document.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2013, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2003-2017, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/Elem.scala b/shared/src/main/scala/scala/xml/Elem.scala index 933f0d664..37d53bcc4 100755 --- a/shared/src/main/scala/scala/xml/Elem.scala +++ b/shared/src/main/scala/scala/xml/Elem.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2002-2013, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2002-2017, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/EntityRef.scala b/shared/src/main/scala/scala/xml/EntityRef.scala index f19a4a00f..0d31591ba 100644 --- a/shared/src/main/scala/scala/xml/EntityRef.scala +++ b/shared/src/main/scala/scala/xml/EntityRef.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2013, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2003-2017, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/Equality.scala b/shared/src/main/scala/scala/xml/Equality.scala index 41c4352a2..4ee4cb4e0 100644 --- a/shared/src/main/scala/scala/xml/Equality.scala +++ b/shared/src/main/scala/scala/xml/Equality.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2013, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2003-2017, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/Group.scala b/shared/src/main/scala/scala/xml/Group.scala index f2248ff7d..8691ae54e 100644 --- a/shared/src/main/scala/scala/xml/Group.scala +++ b/shared/src/main/scala/scala/xml/Group.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2013, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2003-2017, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/MalformedAttributeException.scala b/shared/src/main/scala/scala/xml/MalformedAttributeException.scala index d264831a5..12a76257d 100644 --- a/shared/src/main/scala/scala/xml/MalformedAttributeException.scala +++ b/shared/src/main/scala/scala/xml/MalformedAttributeException.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2013, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2003-2017, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/MetaData.scala b/shared/src/main/scala/scala/xml/MetaData.scala index ad413013c..fed10618d 100644 --- a/shared/src/main/scala/scala/xml/MetaData.scala +++ b/shared/src/main/scala/scala/xml/MetaData.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2013, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2003-2017, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/NamespaceBinding.scala b/shared/src/main/scala/scala/xml/NamespaceBinding.scala index cb97c1d06..6a5fb174a 100644 --- a/shared/src/main/scala/scala/xml/NamespaceBinding.scala +++ b/shared/src/main/scala/scala/xml/NamespaceBinding.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2002-2013, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2002-2017, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/Node.scala b/shared/src/main/scala/scala/xml/Node.scala index 737ce2878..96f6d0ce3 100755 --- a/shared/src/main/scala/scala/xml/Node.scala +++ b/shared/src/main/scala/scala/xml/Node.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2013, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2003-2017, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/NodeBuffer.scala b/shared/src/main/scala/scala/xml/NodeBuffer.scala index 39da2a291..ba26bced6 100644 --- a/shared/src/main/scala/scala/xml/NodeBuffer.scala +++ b/shared/src/main/scala/scala/xml/NodeBuffer.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2013, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2003-2017, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/NodeSeq.scala b/shared/src/main/scala/scala/xml/NodeSeq.scala index 5f2b6b6c9..22b218f07 100644 --- a/shared/src/main/scala/scala/xml/NodeSeq.scala +++ b/shared/src/main/scala/scala/xml/NodeSeq.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2013, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2003-2017, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/Null.scala b/shared/src/main/scala/scala/xml/Null.scala index d02fd0dcb..46243f69d 100644 --- a/shared/src/main/scala/scala/xml/Null.scala +++ b/shared/src/main/scala/scala/xml/Null.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2013, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2003-2017, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/PCData.scala b/shared/src/main/scala/scala/xml/PCData.scala index 864bfa564..5b6546e8e 100644 --- a/shared/src/main/scala/scala/xml/PCData.scala +++ b/shared/src/main/scala/scala/xml/PCData.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2013, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2003-2017, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/PrefixedAttribute.scala b/shared/src/main/scala/scala/xml/PrefixedAttribute.scala index a6dd27d79..9f695275a 100644 --- a/shared/src/main/scala/scala/xml/PrefixedAttribute.scala +++ b/shared/src/main/scala/scala/xml/PrefixedAttribute.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2013, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2003-2017, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/PrettyPrinter.scala b/shared/src/main/scala/scala/xml/PrettyPrinter.scala index 4f1024e1a..b3f4f9940 100755 --- a/shared/src/main/scala/scala/xml/PrettyPrinter.scala +++ b/shared/src/main/scala/scala/xml/PrettyPrinter.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2013, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2003-2017, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/ProcInstr.scala b/shared/src/main/scala/scala/xml/ProcInstr.scala index a42f6bc05..648f58c79 100644 --- a/shared/src/main/scala/scala/xml/ProcInstr.scala +++ b/shared/src/main/scala/scala/xml/ProcInstr.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2013, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2003-2017, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/QNode.scala b/shared/src/main/scala/scala/xml/QNode.scala index cb0dcc648..0ec3c7cc6 100644 --- a/shared/src/main/scala/scala/xml/QNode.scala +++ b/shared/src/main/scala/scala/xml/QNode.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2013, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2003-2017, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/SpecialNode.scala b/shared/src/main/scala/scala/xml/SpecialNode.scala index a7db42b5e..3105ee24b 100644 --- a/shared/src/main/scala/scala/xml/SpecialNode.scala +++ b/shared/src/main/scala/scala/xml/SpecialNode.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2013, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2003-2017, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/Text.scala b/shared/src/main/scala/scala/xml/Text.scala index 9da658a98..6240e418a 100644 --- a/shared/src/main/scala/scala/xml/Text.scala +++ b/shared/src/main/scala/scala/xml/Text.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2013, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2003-2017, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/TextBuffer.scala b/shared/src/main/scala/scala/xml/TextBuffer.scala index 7e2cecd7e..8f3dcc58c 100644 --- a/shared/src/main/scala/scala/xml/TextBuffer.scala +++ b/shared/src/main/scala/scala/xml/TextBuffer.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2013, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2003-2017, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/TopScope.scala b/shared/src/main/scala/scala/xml/TopScope.scala index 53d4b2c5d..b5a95c043 100644 --- a/shared/src/main/scala/scala/xml/TopScope.scala +++ b/shared/src/main/scala/scala/xml/TopScope.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2002-2013, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2002-2017, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/TypeSymbol.scala b/shared/src/main/scala/scala/xml/TypeSymbol.scala index d2eab6a9b..9081ba300 100644 --- a/shared/src/main/scala/scala/xml/TypeSymbol.scala +++ b/shared/src/main/scala/scala/xml/TypeSymbol.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2002-2013, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2002-2017, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/Unparsed.scala b/shared/src/main/scala/scala/xml/Unparsed.scala index 97ad396e3..20141076b 100644 --- a/shared/src/main/scala/scala/xml/Unparsed.scala +++ b/shared/src/main/scala/scala/xml/Unparsed.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2013, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2003-2017, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/UnprefixedAttribute.scala b/shared/src/main/scala/scala/xml/UnprefixedAttribute.scala index 6cc156694..9ee0a9b14 100644 --- a/shared/src/main/scala/scala/xml/UnprefixedAttribute.scala +++ b/shared/src/main/scala/scala/xml/UnprefixedAttribute.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2002-2013, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2002-2017, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/Utility.scala b/shared/src/main/scala/scala/xml/Utility.scala index e9aa88de6..5b96ccefb 100755 --- a/shared/src/main/scala/scala/xml/Utility.scala +++ b/shared/src/main/scala/scala/xml/Utility.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2013, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2003-2017, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/XML.scala b/shared/src/main/scala/scala/xml/XML.scala index 8b70eafd2..c8c26d8cf 100755 --- a/shared/src/main/scala/scala/xml/XML.scala +++ b/shared/src/main/scala/scala/xml/XML.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2013, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2003-2017, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/dtd/ContentModel.scala b/shared/src/main/scala/scala/xml/dtd/ContentModel.scala index afd47ed8e..acec798c9 100644 --- a/shared/src/main/scala/scala/xml/dtd/ContentModel.scala +++ b/shared/src/main/scala/scala/xml/dtd/ContentModel.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2002-2013, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2002-2017, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/dtd/ContentModelParser.scala b/shared/src/main/scala/scala/xml/dtd/ContentModelParser.scala index ec48436b3..24dc57ee1 100644 --- a/shared/src/main/scala/scala/xml/dtd/ContentModelParser.scala +++ b/shared/src/main/scala/scala/xml/dtd/ContentModelParser.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2002-2013, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2002-2017, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://www.scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/dtd/DTD.scala b/shared/src/main/scala/scala/xml/dtd/DTD.scala index 95a3e888f..5648b025b 100644 --- a/shared/src/main/scala/scala/xml/dtd/DTD.scala +++ b/shared/src/main/scala/scala/xml/dtd/DTD.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2002-2013, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2002-2017, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/dtd/Decl.scala b/shared/src/main/scala/scala/xml/dtd/Decl.scala index 6cb2a2210..94e9e9d23 100644 --- a/shared/src/main/scala/scala/xml/dtd/Decl.scala +++ b/shared/src/main/scala/scala/xml/dtd/Decl.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** - ** / __/ __// _ | / / / _ | (c) 2003-2013, LAMP/EPFL ** + ** / __/ __// _ | / / / _ | (c) 2003-2017, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://www.scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/dtd/DocType.scala b/shared/src/main/scala/scala/xml/dtd/DocType.scala index af48110b9..822b32eaf 100644 --- a/shared/src/main/scala/scala/xml/dtd/DocType.scala +++ b/shared/src/main/scala/scala/xml/dtd/DocType.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2013, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2003-2017, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/dtd/ElementValidator.scala b/shared/src/main/scala/scala/xml/dtd/ElementValidator.scala index a55098852..e57279f76 100644 --- a/shared/src/main/scala/scala/xml/dtd/ElementValidator.scala +++ b/shared/src/main/scala/scala/xml/dtd/ElementValidator.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2002-2013, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2002-2017, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://www.scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/dtd/ExternalID.scala b/shared/src/main/scala/scala/xml/dtd/ExternalID.scala index 7baa46677..a60ce1caf 100644 --- a/shared/src/main/scala/scala/xml/dtd/ExternalID.scala +++ b/shared/src/main/scala/scala/xml/dtd/ExternalID.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2013, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2003-2017, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://www.scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/dtd/Scanner.scala b/shared/src/main/scala/scala/xml/dtd/Scanner.scala index 84a05dde0..1252af153 100644 --- a/shared/src/main/scala/scala/xml/dtd/Scanner.scala +++ b/shared/src/main/scala/scala/xml/dtd/Scanner.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2002-2013, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2002-2017, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/dtd/Tokens.scala b/shared/src/main/scala/scala/xml/dtd/Tokens.scala index 56438589c..65905ddb4 100644 --- a/shared/src/main/scala/scala/xml/dtd/Tokens.scala +++ b/shared/src/main/scala/scala/xml/dtd/Tokens.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2002-2013, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2002-2017, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://www.scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/dtd/ValidationException.scala b/shared/src/main/scala/scala/xml/dtd/ValidationException.scala index e4286b9f2..941ba7ef7 100644 --- a/shared/src/main/scala/scala/xml/dtd/ValidationException.scala +++ b/shared/src/main/scala/scala/xml/dtd/ValidationException.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2002-2013, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2002-2017, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://www.scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/dtd/impl/Base.scala b/shared/src/main/scala/scala/xml/dtd/impl/Base.scala index 35e5be757..62f20531e 100644 --- a/shared/src/main/scala/scala/xml/dtd/impl/Base.scala +++ b/shared/src/main/scala/scala/xml/dtd/impl/Base.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2013, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2003-2017, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/dtd/impl/BaseBerrySethi.scala b/shared/src/main/scala/scala/xml/dtd/impl/BaseBerrySethi.scala index fe3159c0f..31c372586 100644 --- a/shared/src/main/scala/scala/xml/dtd/impl/BaseBerrySethi.scala +++ b/shared/src/main/scala/scala/xml/dtd/impl/BaseBerrySethi.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2013, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2003-2017, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/dtd/impl/DetWordAutom.scala b/shared/src/main/scala/scala/xml/dtd/impl/DetWordAutom.scala index 28490b11f..46dd3ebdf 100644 --- a/shared/src/main/scala/scala/xml/dtd/impl/DetWordAutom.scala +++ b/shared/src/main/scala/scala/xml/dtd/impl/DetWordAutom.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2013, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2003-2017, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/dtd/impl/Inclusion.scala b/shared/src/main/scala/scala/xml/dtd/impl/Inclusion.scala index a609a6e55..ac36bb8cd 100644 --- a/shared/src/main/scala/scala/xml/dtd/impl/Inclusion.scala +++ b/shared/src/main/scala/scala/xml/dtd/impl/Inclusion.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2013, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2003-2017, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/dtd/impl/NondetWordAutom.scala b/shared/src/main/scala/scala/xml/dtd/impl/NondetWordAutom.scala index 5079d932d..ba8dfad9d 100644 --- a/shared/src/main/scala/scala/xml/dtd/impl/NondetWordAutom.scala +++ b/shared/src/main/scala/scala/xml/dtd/impl/NondetWordAutom.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2013, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2003-2017, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/dtd/impl/PointedHedgeExp.scala b/shared/src/main/scala/scala/xml/dtd/impl/PointedHedgeExp.scala index 4b8026206..b18cf60e3 100644 --- a/shared/src/main/scala/scala/xml/dtd/impl/PointedHedgeExp.scala +++ b/shared/src/main/scala/scala/xml/dtd/impl/PointedHedgeExp.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2013, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2003-2017, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/dtd/impl/SubsetConstruction.scala b/shared/src/main/scala/scala/xml/dtd/impl/SubsetConstruction.scala index 9501155b5..93ca0cfcd 100644 --- a/shared/src/main/scala/scala/xml/dtd/impl/SubsetConstruction.scala +++ b/shared/src/main/scala/scala/xml/dtd/impl/SubsetConstruction.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2013, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2003-2017, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/dtd/impl/SyntaxError.scala b/shared/src/main/scala/scala/xml/dtd/impl/SyntaxError.scala index 131d9550a..13ec44213 100644 --- a/shared/src/main/scala/scala/xml/dtd/impl/SyntaxError.scala +++ b/shared/src/main/scala/scala/xml/dtd/impl/SyntaxError.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2013, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2003-2017, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/dtd/impl/WordBerrySethi.scala b/shared/src/main/scala/scala/xml/dtd/impl/WordBerrySethi.scala index 2a5a5ce30..24af4f207 100644 --- a/shared/src/main/scala/scala/xml/dtd/impl/WordBerrySethi.scala +++ b/shared/src/main/scala/scala/xml/dtd/impl/WordBerrySethi.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2013, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2003-2017, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/dtd/impl/WordExp.scala b/shared/src/main/scala/scala/xml/dtd/impl/WordExp.scala index 86e99b8fb..23a59433a 100644 --- a/shared/src/main/scala/scala/xml/dtd/impl/WordExp.scala +++ b/shared/src/main/scala/scala/xml/dtd/impl/WordExp.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2013, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2003-2017, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/factory/Binder.scala b/shared/src/main/scala/scala/xml/factory/Binder.scala index 0189c8b72..e865bfce1 100755 --- a/shared/src/main/scala/scala/xml/factory/Binder.scala +++ b/shared/src/main/scala/scala/xml/factory/Binder.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2002-2013, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2002-2017, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/factory/LoggedNodeFactory.scala b/shared/src/main/scala/scala/xml/factory/LoggedNodeFactory.scala index 27a90aac4..26473b980 100644 --- a/shared/src/main/scala/scala/xml/factory/LoggedNodeFactory.scala +++ b/shared/src/main/scala/scala/xml/factory/LoggedNodeFactory.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2002-2013, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2002-2017, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/factory/NodeFactory.scala b/shared/src/main/scala/scala/xml/factory/NodeFactory.scala index dfb2cc0bb..4b57eafd9 100644 --- a/shared/src/main/scala/scala/xml/factory/NodeFactory.scala +++ b/shared/src/main/scala/scala/xml/factory/NodeFactory.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2013, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2003-2017, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/factory/XMLLoader.scala b/shared/src/main/scala/scala/xml/factory/XMLLoader.scala index 4e3cacf7b..0604282ea 100644 --- a/shared/src/main/scala/scala/xml/factory/XMLLoader.scala +++ b/shared/src/main/scala/scala/xml/factory/XMLLoader.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2013, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2003-2017, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/include/CircularIncludeException.scala b/shared/src/main/scala/scala/xml/include/CircularIncludeException.scala index 351f40300..eba534127 100644 --- a/shared/src/main/scala/scala/xml/include/CircularIncludeException.scala +++ b/shared/src/main/scala/scala/xml/include/CircularIncludeException.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2002-2013, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2002-2017, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/include/UnavailableResourceException.scala b/shared/src/main/scala/scala/xml/include/UnavailableResourceException.scala index 3298c2794..aa069d7a5 100644 --- a/shared/src/main/scala/scala/xml/include/UnavailableResourceException.scala +++ b/shared/src/main/scala/scala/xml/include/UnavailableResourceException.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2002-2013, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2002-2017, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/include/XIncludeException.scala b/shared/src/main/scala/scala/xml/include/XIncludeException.scala index 64672b070..76ee2bee2 100644 --- a/shared/src/main/scala/scala/xml/include/XIncludeException.scala +++ b/shared/src/main/scala/scala/xml/include/XIncludeException.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2002-2013, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2002-2017, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/include/sax/EncodingHeuristics.scala b/shared/src/main/scala/scala/xml/include/sax/EncodingHeuristics.scala index b12b9ac82..1f3cebb86 100644 --- a/shared/src/main/scala/scala/xml/include/sax/EncodingHeuristics.scala +++ b/shared/src/main/scala/scala/xml/include/sax/EncodingHeuristics.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2002-2013, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2002-2017, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/include/sax/XIncludeFilter.scala b/shared/src/main/scala/scala/xml/include/sax/XIncludeFilter.scala index dc18dd412..9287499af 100644 --- a/shared/src/main/scala/scala/xml/include/sax/XIncludeFilter.scala +++ b/shared/src/main/scala/scala/xml/include/sax/XIncludeFilter.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2002-2013, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2002-2017, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/include/sax/XIncluder.scala b/shared/src/main/scala/scala/xml/include/sax/XIncluder.scala index 4697a8c11..5eb3611a1 100644 --- a/shared/src/main/scala/scala/xml/include/sax/XIncluder.scala +++ b/shared/src/main/scala/scala/xml/include/sax/XIncluder.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2002-2013, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2002-2017, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/package.scala b/shared/src/main/scala/scala/xml/package.scala index 7e90d80b0..18d37cf98 100644 --- a/shared/src/main/scala/scala/xml/package.scala +++ b/shared/src/main/scala/scala/xml/package.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2013, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2003-2017, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/parsing/ConstructingHandler.scala b/shared/src/main/scala/scala/xml/parsing/ConstructingHandler.scala index 7de6cc419..a945694b3 100755 --- a/shared/src/main/scala/scala/xml/parsing/ConstructingHandler.scala +++ b/shared/src/main/scala/scala/xml/parsing/ConstructingHandler.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2002-2013, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2002-2017, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/parsing/ConstructingParser.scala b/shared/src/main/scala/scala/xml/parsing/ConstructingParser.scala index b5162c82a..1e980c27b 100644 --- a/shared/src/main/scala/scala/xml/parsing/ConstructingParser.scala +++ b/shared/src/main/scala/scala/xml/parsing/ConstructingParser.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2013, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2003-2017, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/parsing/DefaultMarkupHandler.scala b/shared/src/main/scala/scala/xml/parsing/DefaultMarkupHandler.scala index 796891341..eb0d0489f 100755 --- a/shared/src/main/scala/scala/xml/parsing/DefaultMarkupHandler.scala +++ b/shared/src/main/scala/scala/xml/parsing/DefaultMarkupHandler.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2002-2013, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2002-2017, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/parsing/ExternalSources.scala b/shared/src/main/scala/scala/xml/parsing/ExternalSources.scala index 13a88ae40..80707b3b9 100644 --- a/shared/src/main/scala/scala/xml/parsing/ExternalSources.scala +++ b/shared/src/main/scala/scala/xml/parsing/ExternalSources.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2013, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2003-2017, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/parsing/FactoryAdapter.scala b/shared/src/main/scala/scala/xml/parsing/FactoryAdapter.scala index c0d82dbda..fc1beed04 100644 --- a/shared/src/main/scala/scala/xml/parsing/FactoryAdapter.scala +++ b/shared/src/main/scala/scala/xml/parsing/FactoryAdapter.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2013, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2003-2017, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/parsing/FatalError.scala b/shared/src/main/scala/scala/xml/parsing/FatalError.scala index 700d68c5c..e389c975f 100644 --- a/shared/src/main/scala/scala/xml/parsing/FatalError.scala +++ b/shared/src/main/scala/scala/xml/parsing/FatalError.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2002-2013, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2002-2017, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/parsing/MarkupHandler.scala b/shared/src/main/scala/scala/xml/parsing/MarkupHandler.scala index 369aa6c87..e8d393984 100755 --- a/shared/src/main/scala/scala/xml/parsing/MarkupHandler.scala +++ b/shared/src/main/scala/scala/xml/parsing/MarkupHandler.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2013, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2003-2017, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/parsing/MarkupParser.scala b/shared/src/main/scala/scala/xml/parsing/MarkupParser.scala index d9a61b393..a0831249b 100755 --- a/shared/src/main/scala/scala/xml/parsing/MarkupParser.scala +++ b/shared/src/main/scala/scala/xml/parsing/MarkupParser.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2013, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2003-2017, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/parsing/MarkupParserCommon.scala b/shared/src/main/scala/scala/xml/parsing/MarkupParserCommon.scala index 72d669f21..110f04756 100644 --- a/shared/src/main/scala/scala/xml/parsing/MarkupParserCommon.scala +++ b/shared/src/main/scala/scala/xml/parsing/MarkupParserCommon.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2013, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2003-2017, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/parsing/NoBindingFactoryAdapter.scala b/shared/src/main/scala/scala/xml/parsing/NoBindingFactoryAdapter.scala index 7b3bfe061..6142041e0 100644 --- a/shared/src/main/scala/scala/xml/parsing/NoBindingFactoryAdapter.scala +++ b/shared/src/main/scala/scala/xml/parsing/NoBindingFactoryAdapter.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2013, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2003-2017, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/parsing/TokenTests.scala b/shared/src/main/scala/scala/xml/parsing/TokenTests.scala index f528f7db0..ab71a43c0 100644 --- a/shared/src/main/scala/scala/xml/parsing/TokenTests.scala +++ b/shared/src/main/scala/scala/xml/parsing/TokenTests.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2013, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2003-2017, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/parsing/ValidatingMarkupHandler.scala b/shared/src/main/scala/scala/xml/parsing/ValidatingMarkupHandler.scala index fcd2d0884..e9001181b 100644 --- a/shared/src/main/scala/scala/xml/parsing/ValidatingMarkupHandler.scala +++ b/shared/src/main/scala/scala/xml/parsing/ValidatingMarkupHandler.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2002-2013, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2002-2017, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/parsing/XhtmlEntities.scala b/shared/src/main/scala/scala/xml/parsing/XhtmlEntities.scala index 7d5ba4340..02814e28a 100644 --- a/shared/src/main/scala/scala/xml/parsing/XhtmlEntities.scala +++ b/shared/src/main/scala/scala/xml/parsing/XhtmlEntities.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2013, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2003-2017, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/parsing/XhtmlParser.scala b/shared/src/main/scala/scala/xml/parsing/XhtmlParser.scala index a463f49a8..3c1d72ffd 100644 --- a/shared/src/main/scala/scala/xml/parsing/XhtmlParser.scala +++ b/shared/src/main/scala/scala/xml/parsing/XhtmlParser.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2013, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2003-2017, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/persistent/CachedFileStorage.scala b/shared/src/main/scala/scala/xml/persistent/CachedFileStorage.scala index 8a6cc6787..4b1e2bc09 100644 --- a/shared/src/main/scala/scala/xml/persistent/CachedFileStorage.scala +++ b/shared/src/main/scala/scala/xml/persistent/CachedFileStorage.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2002-2013, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2002-2017, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/persistent/Index.scala b/shared/src/main/scala/scala/xml/persistent/Index.scala index 312f5c797..cdd07af86 100644 --- a/shared/src/main/scala/scala/xml/persistent/Index.scala +++ b/shared/src/main/scala/scala/xml/persistent/Index.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2002-2013, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2002-2017, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/persistent/SetStorage.scala b/shared/src/main/scala/scala/xml/persistent/SetStorage.scala index 8dd4d3ee7..52d4d68fe 100644 --- a/shared/src/main/scala/scala/xml/persistent/SetStorage.scala +++ b/shared/src/main/scala/scala/xml/persistent/SetStorage.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2002-2013, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2002-2017, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/pull/XMLEvent.scala b/shared/src/main/scala/scala/xml/pull/XMLEvent.scala index 2c1ae267e..57cc61989 100644 --- a/shared/src/main/scala/scala/xml/pull/XMLEvent.scala +++ b/shared/src/main/scala/scala/xml/pull/XMLEvent.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2013, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2003-2017, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/pull/XMLEventReader.scala b/shared/src/main/scala/scala/xml/pull/XMLEventReader.scala index a2c266276..c8981f0a6 100755 --- a/shared/src/main/scala/scala/xml/pull/XMLEventReader.scala +++ b/shared/src/main/scala/scala/xml/pull/XMLEventReader.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2013, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2003-2017, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/transform/BasicTransformer.scala b/shared/src/main/scala/scala/xml/transform/BasicTransformer.scala index ce7441ef8..1fe78e478 100644 --- a/shared/src/main/scala/scala/xml/transform/BasicTransformer.scala +++ b/shared/src/main/scala/scala/xml/transform/BasicTransformer.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2002-2013, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2002-2017, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/transform/RewriteRule.scala b/shared/src/main/scala/scala/xml/transform/RewriteRule.scala index eee3c6315..c0b6041de 100644 --- a/shared/src/main/scala/scala/xml/transform/RewriteRule.scala +++ b/shared/src/main/scala/scala/xml/transform/RewriteRule.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2002-2013, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2002-2017, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/transform/RuleTransformer.scala b/shared/src/main/scala/scala/xml/transform/RuleTransformer.scala index 3a222ba75..3458bd57e 100644 --- a/shared/src/main/scala/scala/xml/transform/RuleTransformer.scala +++ b/shared/src/main/scala/scala/xml/transform/RuleTransformer.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2002-2013, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2002-2017, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** From 5bec43f4dfad6fc3cf6a23d612eb10ee64bf466a Mon Sep 17 00:00:00 2001 From: Seth Tisue Date: Tue, 7 Feb 2017 16:44:54 -0800 Subject: [PATCH 121/789] fix Markdown formatting --- LICENSE.md | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/LICENSE.md b/LICENSE.md index 4ce1fe0e3..e69f60003 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -1,19 +1,19 @@ -Copyright (c) 2002-2017 EPFL -Copyright (c) 2011-2017 Lightbend, Inc. +Copyright (c) 2002-2017 EPFL +Copyright (c) 2011-2017 Lightbend, Inc. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - * Neither the name of the EPFL nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. +* Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. +* Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. +* Neither the name of the EPFL nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT From 2eafecbdbf58c8c1be530bf0dd4335098092916d Mon Sep 17 00:00:00 2001 From: Olivier Blanvillain Date: Sat, 4 Feb 2017 21:49:25 +0100 Subject: [PATCH 122/789] Remove duplicated shared/jvm tests, prepend JVM to test classes when required Moving jv tests to shared introduced name conflicts on the duplicated calsses, the rename solves that --- .../test/scala/scala/xml/XMLSyntaxTest.scala | 57 +-- jvm/src/test/scala/scala/xml/XMLTest.scala | 333 +----------------- .../scala/xml/parsing/PiParsingTest.scala | 13 +- .../scala/xml/parsing/Ticket0632Test.scala | 8 +- 4 files changed, 6 insertions(+), 405 deletions(-) diff --git a/jvm/src/test/scala/scala/xml/XMLSyntaxTest.scala b/jvm/src/test/scala/scala/xml/XMLSyntaxTest.scala index fa250b416..16155bc58 100644 --- a/jvm/src/test/scala/scala/xml/XMLSyntaxTest.scala +++ b/jvm/src/test/scala/scala/xml/XMLSyntaxTest.scala @@ -8,62 +8,7 @@ import org.junit.Assert.assertTrue import org.junit.Assert.assertFalse import org.junit.Assert.assertEquals -class XMLSyntaxTest { - - private def handle[A](x: Node): A = { - x.child(0).asInstanceOf[Atom[A]].data - } - - @Test - def test1(): Unit = { - val xNull = {null} // these used to be Atom(unit), changed to empty children - assertTrue(xNull.child sameElements Nil) - - val x0 = {} // these used to be Atom(unit), changed to empty children - val x00 = { } // dto. - val xa = { "world" } - - assertTrue(x0.child sameElements Nil) - assertTrue(x00.child sameElements Nil) - assertEquals("world", handle[String](xa)) - - val xb = { 1.5 } - assertEquals(1.5, handle[Double](xb), 0.0) - - val xc = { 5 } - assertEquals(5, handle[Int](xc)) - - val xd = { true } - assertEquals(true, handle[Boolean](xd)) - - val xe = { 5:Short } - assertEquals((5:Short), handle[Short](xe)) - - val xf = { val x = 27; x } - assertEquals(27, handle[Int](xf)) - - val xg = { List(1,2,3,4) } - assertEquals("1 2 3 4", xg.toString) - assertFalse(xg.child.map(_.isInstanceOf[Text]).exists(identity)) - - val xh = { for(x <- List(1,2,3,4) if x % 2 == 0) yield x } - assertEquals("2 4", xh.toString) - assertFalse(xh.child.map(_.isInstanceOf[Text]).exists(identity)) - } - - /** see SVN r13821 (emir): support for , - * so that Options can be used for optional attributes. - */ - @Test - def test2(): Unit = { - val x1: Option[Seq[Node]] = Some(hello) - val n1 = ; - assertEquals(x1, n1.attribute("key")) - - val x2: Option[Seq[Node]] = None - val n2 = ; - assertEquals(x2, n2.attribute("key")) - } +class XMLSyntaxTestJVM { @Test def test3(): Unit = { diff --git a/jvm/src/test/scala/scala/xml/XMLTest.scala b/jvm/src/test/scala/scala/xml/XMLTest.scala index c86184ffd..aea258486 100644 --- a/jvm/src/test/scala/scala/xml/XMLTest.scala +++ b/jvm/src/test/scala/scala/xml/XMLTest.scala @@ -17,212 +17,13 @@ import java.io.StringReader import scala.collection.Iterable import scala.xml.Utility.sort -object XMLTest { +object XMLTestJVM { val e: scala.xml.MetaData = Null //Node.NoAttributes val sc: scala.xml.NamespaceBinding = TopScope } -class XMLTest { - import XMLTest.{ e, sc } - - @UnitTest - def nodeSeq: Unit = { - val p = - - - - - - val pelems_1 = for (x <- p \ "bar"; y <- p \ "baz") yield { - Text(x.attributes("value").toString + y.attributes("bazValue").toString + "!") - }; - - val pelems_2 = NodeSeq.fromSeq(List(Text("38!"), Text("58!"))); - assertTrue(pelems_1 sameElements pelems_2) - assertTrue(Text("8") sameElements (p \\ "@bazValue")) - } - - @UnitTest - def queryBooks: Unit = { - val books = - - Blabla - Blubabla - Baaaaaaalabla - ; - - val reviews = - - - Blabla - - Hallo Welt. - - - - Blubabla - - Hello Blu - - - - Blubabla - - rem 2 - - - ; - - val results1 = new scala.xml.PrettyPrinter(80, 5).formatNodes( - for ( - t <- books \\ "title"; - r <- reviews \\ "entry" if (r \ "title") xml_== t - ) yield - { t } - { r \ "remarks" } - ); - val results1Expected = """ - | Blabla - | Hallo Welt. - | - | Blubabla - | Hello Blu - | - | Blubabla - | rem 2 - |""".stripMargin - assertEquals(results1Expected, results1) - - { - val actual = for (t @ Blabla <- NodeSeq.fromSeq(books.child).toList) - yield t - val expected = List(Blabla) - assertEquals(expected, actual) - } - - } - - @UnitTest - def queryPhoneBook: Unit = { - val phoneBook = - - - This is thephonebook - of the - ACME - corporation. - - - John - +41 21 693 68 67 - +41 79 602 23 23 - - ; - - val addrBook = - - - This is theaddressbook - of the - ACME - corporation. - - - John - Elm Street - Dolphin City - - ; - - val actual: String = new scala.xml.PrettyPrinter(80, 5).formatNodes( - for ( - t <- addrBook \\ "entry"; - r <- phoneBook \\ "entry" if (t \ "name") xml_== (r \ "name") - ) yield - { t.child } - { r \ "phone" } - ) - val expected = """| - | John - | Elm Street - | Dolphin City - | +41 21 693 68 67 - | +41 79 602 23 23 - |""".stripMargin - assertEquals(expected, actual) - } - - @UnitTest - def namespaces: Unit = { - val cuckoo = - - - ; - assertEquals("http://cuckoo.com", cuckoo.namespace) - for (n <- cuckoo \ "_") { - assertEquals("http://cuckoo.com", n.namespace) - } - } - - @UnitTest - def namespacesWithNestedXmls: Unit = { - val foo = - val bar = {foo} - val expected = """""" - val actual = bar.toString - assertEquals(expected, actual) - } - - @UnitTest - def validationOfElements: Unit = { - val vtor = new scala.xml.dtd.ElementValidator(); - { - import scala.xml.dtd.ELEMENTS - import scala.xml.dtd.ContentModel._ - vtor.setContentModel( - ELEMENTS( - Sequ( - Letter(ElemName("bar")), - Star(Letter(ElemName("baz")))))); - } - assertTrue(vtor()) - - { - import scala.xml.dtd.MIXED - import scala.xml.dtd.ContentModel._ - - vtor.setContentModel( - MIXED( - Alt(Letter(ElemName("bar")), - Letter(ElemName("baz")), - Letter(ElemName("bal"))))); - } - - assertTrue(vtor()) - assertTrue(vtor(abcdedgh)) - assertFalse(vtor( )) - } - - def validationfOfAttributes: Unit = { - val vtor = new scala.xml.dtd.ElementValidator(); - vtor.setContentModel(null) - vtor.setMetaData(List()) - assertFalse(vtor()) - - { - import scala.xml.dtd._ - vtor setMetaData List(AttrDecl("bar", "CDATA", IMPLIED)) - } - assertFalse(vtor()) - assertTrue(vtor()) - - { - import scala.xml.dtd._ - vtor.setMetaData(List(AttrDecl("bar", "CDATA", REQUIRED))) - } - assertFalse(vtor()) - assertTrue(vtor()) - } +class XMLTestJVM { + import XMLTestJVM.{ e, sc } def Elem(prefix: String, label: String, attributes: MetaData, scope: NamespaceBinding, child: Node*): Elem = scala.xml.Elem.apply(prefix, label, attributes, scope, minimizeEmpty = true, child: _*) @@ -344,21 +145,6 @@ class XMLTest { Elem(null, "title", e, sc, Text("Foundations of Programming Languages")))) } - @UnitTest - def groupNode = { - val zx1: Node = Group { } - val zy1: Node = { zx1 } - assertEquals("", zy1.toString) - - assertEquals("", - Group { List(, zy1, zx1) }.toString) - - val zz1 = - - assertTrue(zx1 xml_== zz1) - assertTrue(zz1.length == 3) - } - @UnitTest def unparsed = { // println("attribute value normalization") @@ -386,119 +172,6 @@ class XMLTest { assertTrue(n.attributes.get("BAR", n, "attr").nonEmpty) } - @UnitTest - def dodgyNamespace = { - val x = - assertTrue(x.toString.matches(".*xmlns:dog=\"http://dog.com\".*")); - } - - import NodeSeq.seqToNodeSeq - - val ax = - - - - val cx = - crazy text world - - - val bx = - - @UnitTest - def XmlEx = { - assertTrue((ax \ "@foo") xml_== "bar") // uses NodeSeq.view! - assertTrue((ax \ "@foo") xml_== xml.Text("bar")) // dto. - assertTrue((bx \ "@foo") xml_== "bar&x") // dto. - assertTrue((bx \ "@foo") xml_sameElements List(xml.Text("bar&x"))) - assertTrue("" == bx.toString) - } - - @UnitTest - def XmlEy { - val z = ax \ "@{the namespace from outer space}foo" - assertTrue((ax \ "@{the namespace from outer space}foo") xml_== "baz") - assertTrue((cx \ "@{the namespace from outer space}foo") xml_== "baz") - - try { - ax \ "@" - assertTrue(false) - } catch { - case _: IllegalArgumentException => - } - try { - ax \ "@{" - assertTrue(false) - } catch { - case _: IllegalArgumentException => - } - try { - ax \ "@{}" - assertTrue(false) - } catch { - case _: IllegalArgumentException => - } - - } - - @UnitTest - def comment = - assertEquals("", toString) - - @UnitTest - def weirdElem = - assertEquals("", toString) - - @UnitTest - def escape = - assertEquals(""" - "Come, come again, whoever you are, come! -Heathen, fire worshipper or idolatrous, come! -Come even if you broke your penitence a hundred times, -Ours is the portal of hope, come as you are." - Mevlana Celaleddin Rumi""", toString) // this guy will escaped, and rightly so - - @UnitTest - def unparsed2 = { - object myBreak extends scala.xml.Unparsed("
") - assertEquals("
", { myBreak } toString) // shows use of unparsed - } - - @UnitTest - def justDontFail = { - match { - case scala.xml.QNode("gaga", "foo", md, child @ _*) => - } - - match { - case scala.xml.Node("foo", md, child @ _*) => - } - } - - @UnitTest - def ioPosition = { - val out = new ByteArrayOutputStream - Console.withErr(out) { - Console.withOut(out) { - try { - xml.parsing.ConstructingParser.fromSource(io.Source.fromString(""), false).document() - } catch { - case e: Exception => println(e.getMessage) - } - } - } - out.flush() - assertEquals( - """:1:5: '/' expected instead of '' ^ -:1:5: name expected, but char '' cannot start a name ^ -expected closing tag of foo -""", out.toString) - } - def f(s: String) = { { diff --git a/jvm/src/test/scala/scala/xml/parsing/PiParsingTest.scala b/jvm/src/test/scala/scala/xml/parsing/PiParsingTest.scala index e9769d374..d002eeb36 100644 --- a/jvm/src/test/scala/scala/xml/parsing/PiParsingTest.scala +++ b/jvm/src/test/scala/scala/xml/parsing/PiParsingTest.scala @@ -6,7 +6,7 @@ import org.junit.runner.RunWith import org.junit.runners.JUnit4 import scala.xml.JUnitAssertsForXML.assertEquals -class PiParsingTest { +class PiParsingTestJVM { import scala.io.Source.fromString @@ -21,12 +21,6 @@ class PiParsingTest { assertEquals(expected, parseNoWS("ab")) } - @Test - def piNoWSLiteral: Unit = { - val expected = "ab" - assertEquals(expected, ab) - } - @Test def piNoWSloadString: Unit = { val expected = "ab" @@ -44,10 +38,5 @@ class PiParsingTest { val expected = " a b " assertEquals(expected, xml.XML.loadString(" a b ")) } - @Test - def piLiteral: Unit = { - val expected = " a b " - assertEquals(expected, a b ) - } } diff --git a/jvm/src/test/scala/scala/xml/parsing/Ticket0632Test.scala b/jvm/src/test/scala/scala/xml/parsing/Ticket0632Test.scala index 7a6b71a71..3691071fa 100644 --- a/jvm/src/test/scala/scala/xml/parsing/Ticket0632Test.scala +++ b/jvm/src/test/scala/scala/xml/parsing/Ticket0632Test.scala @@ -6,7 +6,7 @@ import org.junit.runner.RunWith import org.junit.runners.JUnit4 import scala.xml.JUnitAssertsForXML.assertEquals -class Ticket0632Test { +class Ticket0632TestJVM { import scala.io.Source.fromString import scala.xml.parsing.ConstructingParser.fromSource @@ -18,8 +18,6 @@ class Ticket0632Test { val expected = "" assertEquals(expected, parse("")) assertEquals(expected, xml.XML.loadString("")) - assertEquals(expected, ) - assertEquals(expected, ) } @Test @@ -27,8 +25,6 @@ class Ticket0632Test { val expected = "" assertEquals(expected, xml.XML.loadString("")) assertEquals(expected, parse("")) - assertEquals(expected, ) - assertEquals(expected, ) } @Test @@ -36,8 +32,6 @@ class Ticket0632Test { val expected = "" assertEquals(expected, xml.XML.loadString("")) assertEquals(expected, parse("")) - assertEquals(expected, ) - assertEquals(expected, ) } } From d26ff2826df4ed616b2bf30eae4dd02e964323fd Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Fri, 17 Mar 2017 11:54:35 -0400 Subject: [PATCH 123/789] Add Aaron S. Hawley to README Maintainers are biswanaths and aaron_s_hawley --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index ac0d527f5..9659d2712 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ API documentation is available [here](http://www.scala-lang.org/api/current/scal ## Maintenance status -This library is community-maintained. The lead maintainer is [@biswanaths](https://github.com/biswanaths). +This library is community-maintained. The lead maintainers are [@biswanaths](https://github.com/biswanaths) and [@aaron_s_hawley][https://github.com/ashawley]. ## Security best practices From ce0f82b0f3793eeb59cb396c8da262ba6c82b145 Mon Sep 17 00:00:00 2001 From: Ningning Date: Thu, 30 Mar 2017 22:02:46 +0800 Subject: [PATCH 124/789] Typo in README To correct the hyperlink and make aaron_s_hawley happy :). --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 9659d2712..984223d15 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ API documentation is available [here](http://www.scala-lang.org/api/current/scal ## Maintenance status -This library is community-maintained. The lead maintainers are [@biswanaths](https://github.com/biswanaths) and [@aaron_s_hawley][https://github.com/ashawley]. +This library is community-maintained. The lead maintainers are [@biswanaths](https://github.com/biswanaths) and [@aaron_s_hawley](https://github.com/ashawley). ## Security best practices From de0b47eb84c523c69c8a66c485dba7c06817ce7f Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Fri, 21 Apr 2017 19:01:37 -0400 Subject: [PATCH 125/789] Fix unused imports More warnings by default linter starting in Scala 2.12.2 --- jvm/src/test/scala/scala/xml/ReuseNodesTest.scala | 3 --- jvm/src/test/scala/scala/xml/XMLSyntaxTest.scala | 4 ---- jvm/src/test/scala/scala/xml/XMLTest.scala | 5 ----- .../test/scala/scala/xml/parsing/PiParsingTest.scala | 3 --- .../test/scala/scala/xml/parsing/Ticket0632Test.scala | 4 +--- shared/src/main/scala/scala/xml/MetaData.scala | 2 +- shared/src/main/scala/scala/xml/NodeSeq.scala | 1 - shared/src/main/scala/scala/xml/Utility.scala | 3 +-- shared/src/main/scala/scala/xml/XML.scala | 3 +-- .../main/scala/scala/xml/dtd/impl/DetWordAutom.scala | 4 +--- .../main/scala/scala/xml/dtd/impl/WordBerrySethi.scala | 2 +- .../src/main/scala/scala/xml/factory/NodeFactory.scala | 3 --- .../scala/xml/include/sax/EncodingHeuristics.scala | 1 - .../scala/scala/xml/include/sax/XIncludeFilter.scala | 2 +- .../main/scala/scala/xml/include/sax/XIncluder.scala | 4 ++-- .../main/scala/scala/xml/parsing/FactoryAdapter.scala | 1 - .../scala/scala/xml/parsing/MarkupParserCommon.scala | 4 ---- .../scala/scala/xml/persistent/CachedFileStorage.scala | 1 - shared/src/test/scala/scala/xml/AttributeTest.scala | 5 ----- shared/src/test/scala/scala/xml/MetaDataTest.scala | 3 --- .../test/scala/scala/xml/PrintEmptyElementsTest.scala | 3 --- shared/src/test/scala/scala/xml/UtilityTest.scala | 3 --- shared/src/test/scala/scala/xml/XMLEmbeddingTest.scala | 7 +------ shared/src/test/scala/scala/xml/XMLSyntaxTest.scala | 3 --- shared/src/test/scala/scala/xml/XMLTest.scala | 10 ---------- .../test/scala/scala/xml/parsing/PiParsingTest.scala | 8 -------- .../test/scala/scala/xml/parsing/Ticket0632Test.scala | 6 ------ 27 files changed, 10 insertions(+), 88 deletions(-) diff --git a/jvm/src/test/scala/scala/xml/ReuseNodesTest.scala b/jvm/src/test/scala/scala/xml/ReuseNodesTest.scala index d3b05a338..586fb92a0 100644 --- a/jvm/src/test/scala/scala/xml/ReuseNodesTest.scala +++ b/jvm/src/test/scala/scala/xml/ReuseNodesTest.scala @@ -1,9 +1,6 @@ package scala.xml import scala.xml.transform._ -import org.junit.Test -import org.junit.Assert.assertTrue -import org.junit.Assert.assertEquals import org.junit.Assert.assertSame import org.junit.experimental.theories.Theories import org.junit.experimental.theories.Theory diff --git a/jvm/src/test/scala/scala/xml/XMLSyntaxTest.scala b/jvm/src/test/scala/scala/xml/XMLSyntaxTest.scala index 16155bc58..48c5e1d22 100644 --- a/jvm/src/test/scala/scala/xml/XMLSyntaxTest.scala +++ b/jvm/src/test/scala/scala/xml/XMLSyntaxTest.scala @@ -2,10 +2,6 @@ package scala.xml import org.junit.Test import org.junit.Ignore -import org.junit.runner.RunWith -import org.junit.runners.JUnit4 -import org.junit.Assert.assertTrue -import org.junit.Assert.assertFalse import org.junit.Assert.assertEquals class XMLSyntaxTestJVM { diff --git a/jvm/src/test/scala/scala/xml/XMLTest.scala b/jvm/src/test/scala/scala/xml/XMLTest.scala index aea258486..1b4058629 100644 --- a/jvm/src/test/scala/scala/xml/XMLTest.scala +++ b/jvm/src/test/scala/scala/xml/XMLTest.scala @@ -3,15 +3,11 @@ package scala.xml import language.postfixOps import org.junit.{Test => UnitTest} -import org.junit.Ignore -import org.junit.runner.RunWith -import org.junit.runners.JUnit4 import org.junit.Assert.assertTrue import org.junit.Assert.assertFalse import org.junit.Assert.assertEquals import scala.xml.parsing.ConstructingParser import java.io.StringWriter -import java.io.BufferedOutputStream import java.io.ByteArrayOutputStream import java.io.StringReader import scala.collection.Iterable @@ -495,7 +491,6 @@ class XMLTestJVM { } import java.io.{ Console => _, _ } - import scala.io._ import scala.xml.parsing._ @UnitTest def dontLoop: Unit = { diff --git a/jvm/src/test/scala/scala/xml/parsing/PiParsingTest.scala b/jvm/src/test/scala/scala/xml/parsing/PiParsingTest.scala index d002eeb36..f560e998c 100644 --- a/jvm/src/test/scala/scala/xml/parsing/PiParsingTest.scala +++ b/jvm/src/test/scala/scala/xml/parsing/PiParsingTest.scala @@ -1,9 +1,6 @@ package scala.xml.parsing import org.junit.Test -import org.junit.Ignore -import org.junit.runner.RunWith -import org.junit.runners.JUnit4 import scala.xml.JUnitAssertsForXML.assertEquals class PiParsingTestJVM { diff --git a/jvm/src/test/scala/scala/xml/parsing/Ticket0632Test.scala b/jvm/src/test/scala/scala/xml/parsing/Ticket0632Test.scala index 3691071fa..40b1976ab 100644 --- a/jvm/src/test/scala/scala/xml/parsing/Ticket0632Test.scala +++ b/jvm/src/test/scala/scala/xml/parsing/Ticket0632Test.scala @@ -2,15 +2,13 @@ package scala.xml.parsing import org.junit.Test import org.junit.Ignore -import org.junit.runner.RunWith -import org.junit.runners.JUnit4 import scala.xml.JUnitAssertsForXML.assertEquals class Ticket0632TestJVM { import scala.io.Source.fromString import scala.xml.parsing.ConstructingParser.fromSource - import scala.xml.{NodeSeq, TopScope} + import scala.xml.TopScope private def parse(s:String) = fromSource(fromString(s), false).element(TopScope) @Test diff --git a/shared/src/main/scala/scala/xml/MetaData.scala b/shared/src/main/scala/scala/xml/MetaData.scala index fed10618d..02c228f69 100644 --- a/shared/src/main/scala/scala/xml/MetaData.scala +++ b/shared/src/main/scala/scala/xml/MetaData.scala @@ -11,7 +11,7 @@ package xml import Utility.sbToString import scala.annotation.tailrec -import scala.collection.{ AbstractIterable, Iterator } +import scala.collection.AbstractIterable /** * Copyright 2008 Google Inc. All Rights Reserved. diff --git a/shared/src/main/scala/scala/xml/NodeSeq.scala b/shared/src/main/scala/scala/xml/NodeSeq.scala index 22b218f07..c498279e9 100644 --- a/shared/src/main/scala/scala/xml/NodeSeq.scala +++ b/shared/src/main/scala/scala/xml/NodeSeq.scala @@ -43,7 +43,6 @@ object NodeSeq { * @version 1.0 */ abstract class NodeSeq extends AbstractSeq[Node] with immutable.Seq[Node] with SeqLike[Node, NodeSeq] with Equality { - import NodeSeq.seqToNodeSeq // import view magic for NodeSeq wrappers /** Creates a list buffer as builder for this class */ override protected[this] def newBuilder = NodeSeq.newBuilder diff --git a/shared/src/main/scala/scala/xml/Utility.scala b/shared/src/main/scala/scala/xml/Utility.scala index 5b96ccefb..467e57af3 100755 --- a/shared/src/main/scala/scala/xml/Utility.scala +++ b/shared/src/main/scala/scala/xml/Utility.scala @@ -10,7 +10,6 @@ package scala package xml import scala.collection.mutable -import parsing.XhtmlEntities import scala.language.implicitConversions /** @@ -105,7 +104,7 @@ object Utility extends AnyRef with parsing.TokenTests { val escMap = pairs map { case (s, c) => c -> ("&%s;" format s) } val unescMap = pairs ++ Map("apos" -> '\'') } - import Escapes.{ escMap, unescMap } + import Escapes.unescMap /** * Appends escaped string to `s`. diff --git a/shared/src/main/scala/scala/xml/XML.scala b/shared/src/main/scala/scala/xml/XML.scala index c8c26d8cf..649c8b029 100755 --- a/shared/src/main/scala/scala/xml/XML.scala +++ b/shared/src/main/scala/scala/xml/XML.scala @@ -9,10 +9,9 @@ package scala package xml -import parsing.NoBindingFactoryAdapter import factory.XMLLoader import java.io.{ File, FileDescriptor, FileInputStream, FileOutputStream } -import java.io.{ InputStream, Reader, StringReader, Writer } +import java.io.{ InputStream, Reader, StringReader } import java.nio.channels.Channels import scala.util.control.Exception.ultimately diff --git a/shared/src/main/scala/scala/xml/dtd/impl/DetWordAutom.scala b/shared/src/main/scala/scala/xml/dtd/impl/DetWordAutom.scala index 46dd3ebdf..5484b72cd 100644 --- a/shared/src/main/scala/scala/xml/dtd/impl/DetWordAutom.scala +++ b/shared/src/main/scala/scala/xml/dtd/impl/DetWordAutom.scala @@ -9,8 +9,6 @@ package scala package xml.dtd.impl -import scala.collection.{ mutable, immutable } - /** * A deterministic automaton. States are integers, where * 0 is always the only initial state. Transitions are represented @@ -26,7 +24,7 @@ import scala.collection.{ mutable, immutable } private[dtd] abstract class DetWordAutom[T <: AnyRef] { val nstates: Int val finals: Array[Int] - val delta: Array[mutable.Map[T, Int]] + val delta: Array[scala.collection.mutable.Map[T, Int]] val default: Array[Int] def isFinal(q: Int) = finals(q) != 0 diff --git a/shared/src/main/scala/scala/xml/dtd/impl/WordBerrySethi.scala b/shared/src/main/scala/scala/xml/dtd/impl/WordBerrySethi.scala index 24af4f207..8ab87daf5 100644 --- a/shared/src/main/scala/scala/xml/dtd/impl/WordBerrySethi.scala +++ b/shared/src/main/scala/scala/xml/dtd/impl/WordBerrySethi.scala @@ -23,7 +23,7 @@ import scala.collection.{ immutable, mutable } private[dtd] abstract class WordBerrySethi extends BaseBerrySethi { override val lang: WordExp - import lang.{ Alt, Eps, Letter, RegExp, Sequ, Star, _labelT } + import lang.{ Eps, Letter, RegExp, Sequ, _labelT } protected var labels: mutable.HashSet[_labelT] = _ // don't let this fool you, only labelAt is a real, surjective mapping diff --git a/shared/src/main/scala/scala/xml/factory/NodeFactory.scala b/shared/src/main/scala/scala/xml/factory/NodeFactory.scala index 4b57eafd9..36cb2c723 100644 --- a/shared/src/main/scala/scala/xml/factory/NodeFactory.scala +++ b/shared/src/main/scala/scala/xml/factory/NodeFactory.scala @@ -10,9 +10,6 @@ package scala package xml package factory -import parsing.{ FactoryAdapter, NoBindingFactoryAdapter } -import java.io.{ InputStream, Reader, StringReader, File, FileDescriptor, FileInputStream } - trait NodeFactory[A <: Node] { val ignoreComments = false val ignoreProcInstr = false diff --git a/shared/src/main/scala/scala/xml/include/sax/EncodingHeuristics.scala b/shared/src/main/scala/scala/xml/include/sax/EncodingHeuristics.scala index 1f3cebb86..6fff1a477 100644 --- a/shared/src/main/scala/scala/xml/include/sax/EncodingHeuristics.scala +++ b/shared/src/main/scala/scala/xml/include/sax/EncodingHeuristics.scala @@ -11,7 +11,6 @@ package xml package include.sax import java.io.InputStream -import scala.util.matching.Regex /** * `EncodingHeuristics` reads from a stream diff --git a/shared/src/main/scala/scala/xml/include/sax/XIncludeFilter.scala b/shared/src/main/scala/scala/xml/include/sax/XIncludeFilter.scala index 9287499af..49d901c8c 100644 --- a/shared/src/main/scala/scala/xml/include/sax/XIncludeFilter.scala +++ b/shared/src/main/scala/scala/xml/include/sax/XIncludeFilter.scala @@ -15,7 +15,7 @@ import scala.xml.include._ import org.xml.sax.{ Attributes, XMLReader, Locator } import org.xml.sax.helpers.{ XMLReaderFactory, XMLFilterImpl, NamespaceSupport, AttributesImpl } -import java.io.{ InputStream, BufferedInputStream, InputStreamReader, IOException, UnsupportedEncodingException } +import java.io.{ BufferedInputStream, InputStreamReader, IOException, UnsupportedEncodingException } import java.util.Stack import java.net.{ URL, MalformedURLException } diff --git a/shared/src/main/scala/scala/xml/include/sax/XIncluder.scala b/shared/src/main/scala/scala/xml/include/sax/XIncluder.scala index 5eb3611a1..ae1cd9dd0 100644 --- a/shared/src/main/scala/scala/xml/include/sax/XIncluder.scala +++ b/shared/src/main/scala/scala/xml/include/sax/XIncluder.scala @@ -11,9 +11,9 @@ package xml package include.sax import scala.collection.mutable -import org.xml.sax.{ ContentHandler, XMLReader, Locator, Attributes } +import org.xml.sax.{ ContentHandler, Locator, Attributes } import org.xml.sax.ext.LexicalHandler -import java.io.{ File, OutputStream, OutputStreamWriter, Writer, IOException } +import java.io.{ OutputStream, OutputStreamWriter, IOException } /** * XIncluder is a SAX `ContentHandler` that writes its XML document onto diff --git a/shared/src/main/scala/scala/xml/parsing/FactoryAdapter.scala b/shared/src/main/scala/scala/xml/parsing/FactoryAdapter.scala index fc1beed04..a8b5c887f 100644 --- a/shared/src/main/scala/scala/xml/parsing/FactoryAdapter.scala +++ b/shared/src/main/scala/scala/xml/parsing/FactoryAdapter.scala @@ -10,7 +10,6 @@ package scala package xml package parsing -import java.io.{ InputStream, Reader, File, FileDescriptor, FileInputStream } import scala.collection.{ mutable, Iterator } import org.xml.sax.Attributes import org.xml.sax.helpers.DefaultHandler diff --git a/shared/src/main/scala/scala/xml/parsing/MarkupParserCommon.scala b/shared/src/main/scala/scala/xml/parsing/MarkupParserCommon.scala index 110f04756..9a64bb077 100644 --- a/shared/src/main/scala/scala/xml/parsing/MarkupParserCommon.scala +++ b/shared/src/main/scala/scala/xml/parsing/MarkupParserCommon.scala @@ -10,10 +10,6 @@ package scala package xml package parsing -import scala.io.Source -import scala.annotation.switch -import Utility.Escapes.{ pairs => unescape } - import Utility.SU /** diff --git a/shared/src/main/scala/scala/xml/persistent/CachedFileStorage.scala b/shared/src/main/scala/scala/xml/persistent/CachedFileStorage.scala index 4b1e2bc09..e697fc75c 100644 --- a/shared/src/main/scala/scala/xml/persistent/CachedFileStorage.scala +++ b/shared/src/main/scala/scala/xml/persistent/CachedFileStorage.scala @@ -11,7 +11,6 @@ package xml package persistent import java.io.{ File, FileOutputStream } -import java.nio.ByteBuffer import java.nio.channels.Channels import java.lang.Thread diff --git a/shared/src/test/scala/scala/xml/AttributeTest.scala b/shared/src/test/scala/scala/xml/AttributeTest.scala index 67b289748..8943a0a00 100644 --- a/shared/src/test/scala/scala/xml/AttributeTest.scala +++ b/shared/src/test/scala/scala/xml/AttributeTest.scala @@ -1,11 +1,6 @@ package scala.xml import org.junit.Test -import org.junit.Ignore -import org.junit.runner.RunWith -import org.junit.runners.JUnit4 -import org.junit.Assert.assertTrue -import org.junit.Assert.assertFalse import org.junit.Assert.assertEquals class AttributeTest { diff --git a/shared/src/test/scala/scala/xml/MetaDataTest.scala b/shared/src/test/scala/scala/xml/MetaDataTest.scala index 46b598c3a..87be69b82 100644 --- a/shared/src/test/scala/scala/xml/MetaDataTest.scala +++ b/shared/src/test/scala/scala/xml/MetaDataTest.scala @@ -1,9 +1,6 @@ package scala.xml import org.junit.Test -import org.junit.Ignore -import org.junit.runner.RunWith -import org.junit.runners.JUnit4 import org.junit.Assert.assertEquals class MetaDataTest { diff --git a/shared/src/test/scala/scala/xml/PrintEmptyElementsTest.scala b/shared/src/test/scala/scala/xml/PrintEmptyElementsTest.scala index f5270b473..a1d9b11cc 100644 --- a/shared/src/test/scala/scala/xml/PrintEmptyElementsTest.scala +++ b/shared/src/test/scala/scala/xml/PrintEmptyElementsTest.scala @@ -1,9 +1,6 @@ package scala.xml import org.junit.Test -import org.junit.Ignore -import org.junit.runner.RunWith -import org.junit.runners.JUnit4 import JUnitAssertsForXML.assertEquals class PrintEmptyElementsTest { diff --git a/shared/src/test/scala/scala/xml/UtilityTest.scala b/shared/src/test/scala/scala/xml/UtilityTest.scala index eba631efb..f6b3828fa 100644 --- a/shared/src/test/scala/scala/xml/UtilityTest.scala +++ b/shared/src/test/scala/scala/xml/UtilityTest.scala @@ -1,9 +1,6 @@ package scala.xml import org.junit.Test -import org.junit.Ignore -import org.junit.runner.RunWith -import org.junit.runners.JUnit4 import org.junit.Assert.assertTrue import org.junit.Assert.assertFalse import org.junit.Assert.assertEquals diff --git a/shared/src/test/scala/scala/xml/XMLEmbeddingTest.scala b/shared/src/test/scala/scala/xml/XMLEmbeddingTest.scala index 81c69bfb3..398ab6dde 100644 --- a/shared/src/test/scala/scala/xml/XMLEmbeddingTest.scala +++ b/shared/src/test/scala/scala/xml/XMLEmbeddingTest.scala @@ -1,11 +1,6 @@ package scala.xml import org.junit.Test -import org.junit.Ignore -import org.junit.runner.RunWith -import org.junit.runners.JUnit4 -import org.junit.Assert.assertTrue -import org.junit.Assert.assertFalse import org.junit.Assert.assertEquals class XMLEmbeddingTest { @@ -20,4 +15,4 @@ class XMLEmbeddingTest { assertEquals("{}{}{}", za.text) } -} \ No newline at end of file +} diff --git a/shared/src/test/scala/scala/xml/XMLSyntaxTest.scala b/shared/src/test/scala/scala/xml/XMLSyntaxTest.scala index da3c34c8e..89b9bdbbc 100644 --- a/shared/src/test/scala/scala/xml/XMLSyntaxTest.scala +++ b/shared/src/test/scala/scala/xml/XMLSyntaxTest.scala @@ -1,9 +1,6 @@ package scala.xml import org.junit.Test -import org.junit.Ignore -import org.junit.runner.RunWith -import org.junit.runners.JUnit4 import org.junit.Assert.assertTrue import org.junit.Assert.assertFalse import org.junit.Assert.assertEquals diff --git a/shared/src/test/scala/scala/xml/XMLTest.scala b/shared/src/test/scala/scala/xml/XMLTest.scala index 316517dfd..ac2f4347f 100644 --- a/shared/src/test/scala/scala/xml/XMLTest.scala +++ b/shared/src/test/scala/scala/xml/XMLTest.scala @@ -3,17 +3,11 @@ package scala.xml import language.postfixOps import org.junit.{Test => UnitTest} -import org.junit.Ignore -import org.junit.runner.RunWith -import org.junit.runners.JUnit4 import org.junit.Assert.assertTrue import org.junit.Assert.assertFalse import org.junit.Assert.assertEquals // import scala.xml.parsing.ConstructingParser import java.io.StringWriter -import java.io.BufferedOutputStream -import java.io.ByteArrayOutputStream -import java.io.StringReader import scala.collection.Iterable import scala.xml.Utility.sort @@ -23,8 +17,6 @@ object XMLTest { } class XMLTest { - import XMLTest.{ e, sc } - @UnitTest def nodeSeq: Unit = { val p = @@ -248,8 +240,6 @@ class XMLTest { assertTrue(x.toString.matches(".*xmlns:dog=\"http://dog.com\".*")); } - import NodeSeq.seqToNodeSeq - val ax = diff --git a/shared/src/test/scala/scala/xml/parsing/PiParsingTest.scala b/shared/src/test/scala/scala/xml/parsing/PiParsingTest.scala index fedf38dc5..cca701b31 100644 --- a/shared/src/test/scala/scala/xml/parsing/PiParsingTest.scala +++ b/shared/src/test/scala/scala/xml/parsing/PiParsingTest.scala @@ -1,24 +1,16 @@ package scala.xml.parsing import org.junit.Test -import org.junit.Ignore -import org.junit.runner.RunWith -import org.junit.runners.JUnit4 import scala.xml.JUnitAssertsForXML.assertEquals class PiParsingTest { - - import scala.io.Source.fromString - import scala.xml.TopScope - @Test def piNoWSLiteral: Unit = { val expected = "ab" assertEquals(expected, ab) } - @Test def piLiteral: Unit = { val expected = " a b " diff --git a/shared/src/test/scala/scala/xml/parsing/Ticket0632Test.scala b/shared/src/test/scala/scala/xml/parsing/Ticket0632Test.scala index 8b939118a..8adbd2503 100644 --- a/shared/src/test/scala/scala/xml/parsing/Ticket0632Test.scala +++ b/shared/src/test/scala/scala/xml/parsing/Ticket0632Test.scala @@ -1,16 +1,10 @@ package scala.xml.parsing import org.junit.Test -import org.junit.Ignore -import org.junit.runner.RunWith -import org.junit.runners.JUnit4 import scala.xml.JUnitAssertsForXML.assertEquals class Ticket0632Test { - import scala.io.Source.fromString - import scala.xml.{NodeSeq, TopScope} - @Test def singleAmp: Unit = { val expected = "" From aae96a2773ffb5dadfdd5e3f022300ca46686f46 Mon Sep 17 00:00:00 2001 From: Dale Wijnand Date: Mon, 24 Apr 2017 10:37:44 +0100 Subject: [PATCH 126/789] Link to a less empty API docs page --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 984223d15..1847bf6d6 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ If you are cross-building a project that uses scala-xml with both Scala 2.10 and The compiler was decoupled from this particular implementation using the same approach as for comprehensions (XML syntax is desugared into a set of method calls, which unfortunately is only defined by the [implementation](https://github.com/scala/scala/blob/2.11.x/src/compiler/scala/tools/nsc/ast/parser/SymbolicXMLBuilder.scala)). Alternative implementations are welcome! -API documentation is available [here](http://www.scala-lang.org/api/current/scala-xml/). +API documentation is available [here](http://www.scala-lang.org/api/current/scala-xml/scala/xml/index.html). ## Maintenance status From b2f1d14f10c1c2602d8821acec6be869c28c5d1d Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Fri, 21 Apr 2017 16:16:13 -0400 Subject: [PATCH 127/789] Bump version to 1.0.7 - version 1.0.7 - mimaPreviousVersion to 1.0.6 - Scala 2.11.11 and 2.12.2 - sbt 0.13.15 --- build.sbt | 8 ++++---- project/build.properties | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/build.sbt b/build.sbt index 81a9abcad..64b76fdd4 100644 --- a/build.sbt +++ b/build.sbt @@ -4,9 +4,9 @@ scalaVersion in ThisBuild := crossScalaVersions.value.head crossScalaVersions in ThisBuild := { val java = System.getProperty("java.version") if (java.startsWith("1.6.") || java.startsWith("1.7.")) - Seq("2.11.8") + Seq("2.11.11") else if (java.startsWith("1.8.") || java.startsWith("1.9.")) - Seq("2.12.1") + Seq("2.12.2") else sys.error(s"don't know what Scala versions to build on $java") } @@ -18,7 +18,7 @@ lazy val root = project.in(file(".")) lazy val xml = crossProject.in(file(".")) .settings( name := "scala-xml", - version := "1.0.6-SNAPSHOT", + version := "1.0.7-SNAPSHOT", scalacOptions ++= "-deprecation:false -feature -Xlint:-stars-align,-nullary-unit,_".split("\\s+").to[Seq], scalacOptions in Test += "-Xxml:coalescing") .jvmSettings( @@ -29,7 +29,7 @@ lazy val xml = crossProject.in(file(".")) libraryDependencies += "junit" % "junit" % "4.11" % "test", libraryDependencies += "com.novocode" % "junit-interface" % "0.10" % "test", libraryDependencies += ("org.scala-lang" % "scala-compiler" % scalaVersion.value % "test").exclude("org.scala-lang.modules", s"scala-xml*"), - mimaPreviousVersion := Some("1.0.5"), + mimaPreviousVersion := Some("1.0.6"), // You cannot disable JVM test forking when working on scala modules // that are distributed with the compiler because of an SBT // classloader leaking issue (scala/scala-xml#20 and #112). diff --git a/project/build.properties b/project/build.properties index 27e88aa11..64317fdae 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version=0.13.13 +sbt.version=0.13.15 From 983e4538c19b1a09f9cd32c70a23d31b7131b9eb Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Fri, 21 Apr 2017 19:15:12 -0400 Subject: [PATCH 128/789] Update scala-js plugin to 0.6.15 --- project/plugins.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/plugins.sbt b/project/plugins.sbt index 03dbd0511..869efcd35 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,3 +1,3 @@ addSbtPlugin("org.scala-lang.modules" % "scala-module-plugin" % "1.0.4") -addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.14") +addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.15") From cdeae68bccd0a18119a973568ac716eb5f6eb484 Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Tue, 25 Oct 2016 16:28:28 -0400 Subject: [PATCH 129/789] Modify SBT to have api mapping to Scala library for scaladoc * build.sbt (apiMappings): Add mapping to scala-lang.org URL. --- build.sbt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index 64b76fdd4..46ecf9443 100644 --- a/build.sbt +++ b/build.sbt @@ -20,7 +20,12 @@ lazy val xml = crossProject.in(file(".")) name := "scala-xml", version := "1.0.7-SNAPSHOT", scalacOptions ++= "-deprecation:false -feature -Xlint:-stars-align,-nullary-unit,_".split("\\s+").to[Seq], - scalacOptions in Test += "-Xxml:coalescing") + scalacOptions in Test += "-Xxml:coalescing", + apiMappings += ( + scalaInstance.value.libraryJar + -> url(s"http://www.scala-lang.org/api/${scalaVersion.value}/") + ) + ) .jvmSettings( scalaModuleSettings ++ scalaModuleOsgiSettings ++ From 81cbf13fe87c7b27158c455b8c9690adae5f8db7 Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Mon, 24 Apr 2017 00:54:56 -0400 Subject: [PATCH 130/789] Fix Scaladoc warnings for JDK refs - Use Java library hack from StackOverflow - Fix ref to java.io.IOException --- build.sbt | 7 +++++-- .../scala/scala/xml/include/sax/EncodingHeuristics.scala | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/build.sbt b/build.sbt index 46ecf9443..d64911908 100644 --- a/build.sbt +++ b/build.sbt @@ -21,9 +21,12 @@ lazy val xml = crossProject.in(file(".")) version := "1.0.7-SNAPSHOT", scalacOptions ++= "-deprecation:false -feature -Xlint:-stars-align,-nullary-unit,_".split("\\s+").to[Seq], scalacOptions in Test += "-Xxml:coalescing", - apiMappings += ( + apiMappings ++= Map( scalaInstance.value.libraryJar - -> url(s"http://www.scala-lang.org/api/${scalaVersion.value}/") + -> url(s"http://www.scala-lang.org/api/${scalaVersion.value}/"), + // http://stackoverflow.com/questions/16934488 + file(System.getProperty("sun.boot.class.path").split(java.io.File.pathSeparator).filter(_.endsWith(java.io.File.separator + "rt.jar")).head) + -> url("http://docs.oracle.com/javase/8/docs/api") ) ) .jvmSettings( diff --git a/shared/src/main/scala/scala/xml/include/sax/EncodingHeuristics.scala b/shared/src/main/scala/scala/xml/include/sax/EncodingHeuristics.scala index 6fff1a477..a105037f0 100644 --- a/shared/src/main/scala/scala/xml/include/sax/EncodingHeuristics.scala +++ b/shared/src/main/scala/scala/xml/include/sax/EncodingHeuristics.scala @@ -41,7 +41,7 @@ object EncodingHeuristics { * [[http://www.w3.org/TR/xml/#sec-guessing w3]]. * * @param in `InputStream` to read from. - * @throws IOException if the stream cannot be reset + * @throws java.io.IOException if the stream cannot be reset * @return the name of the encoding. */ def readEncodingFromStream(in: InputStream): String = { From 66656aad4463bf91cfc155cfa6d65a72073daeb6 Mon Sep 17 00:00:00 2001 From: Lukas Rytz Date: Tue, 25 Apr 2017 14:46:18 +0200 Subject: [PATCH 131/789] Allow publishing existing tags against new Scala versions --- admin/README.md | 68 ++++++++++++++++++++++++++------------------- admin/build.sh | 44 +++++++++++++++++++++++------ build.sbt | 27 ++++++++---------- project/plugins.sbt | 4 +-- 4 files changed, 89 insertions(+), 54 deletions(-) diff --git a/admin/README.md b/admin/README.md index d84727a74..46626b4e5 100644 --- a/admin/README.md +++ b/admin/README.md @@ -1,7 +1,5 @@ ## Tag Driven Releasing -Copied from https://github.com/scala/scala-java8-compat/commit/4a6cfc97cd95227b86650410e1b632e5ff79335b. - ### Background Reading - http://docs.travis-ci.com/user/environment-variables/ @@ -14,47 +12,61 @@ To configure tag driven releases from Travis CI. 1. Generate a key pair for this repository with `./admin/genKeyPair.sh`. Edit `.travis.yml` and `admin/build.sh` as prompted. - 2. Publish the public key to https://pgp.mit.edu - 3. Store other secrets as encrypted environment variables with `admin/encryptEnvVars.sh`. + 1. Publish the public key to https://pgp.mit.edu + 1. Store other secrets as encrypted environment variables with `admin/encryptEnvVars.sh`. Edit `.travis.yml` as prompted. - 4. Edit `.travis.yml` to use `./admin/build.sh` as the build script, + 1. Edit `.travis.yml` to use `./admin/build.sh` as the build script, and edit that script to use the tasks required for this project. - 5. Edit `build.sbt` to select which JDK will be used for publishing - for which Scala versions. + 1. Edit `build.sbt`'s `scalaVersionsByJvm in ThisBuild` to select Scala and JVM version + combinations that will be used for publishing. -It is important to add comments in .travis.yml to identify the name +It is important to add comments in `.travis.yml` to identify the name of each environment variable encoded in a `:secure` section. -After all of these steps, your .travis.yml should contain config of the -form: +After these steps, your `.travis.yml` should contain config of the form: + +``` +language: scala + +env: + global: + # PGP_PASSPHRASE + - secure: "XXXXXX" + # SONA_USER + - secure: "XXXXXX" + # SONA_PASS + - secure: "XXXXXX" - language: scala - env: - global: - # PGP_PASSPHRASE - - secure: "XXXXXX" - # SONA_USER - - secure: "XXXXXX" - # SONA_PASS - - secure: "XXXXXX" - script: admin/build.sh +script: admin/build.sh + +jdk: + - openjdk6 + - oraclejdk8 + +notifications: + email: + - a@b.com +``` If Sonatype credentials change in the future, step 3 can be repeated without generating a new key. -Be sure to use SBT 0.13.7 or higher to avoid [#1430](https://github.com/sbt/sbt/issues/1430)! - ### Testing - 1. Follow the release process below to create a dummy release (e.g. 0.1.0-TEST1). + 1. Follow the release process below to create a dummy release (e.g., `v0.1.0-TEST1`). Confirm that the release was staged to Sonatype but do not release it to Maven central. Instead, drop the staging repository. ### Performing a release - 1. Create a GitHub "Release" (with a corresponding tag) via the GitHub + 1. Create a GitHub "Release" with a corresponding tag (e.g., `v0.1.1`) via the GitHub web interface. - 2. Travis CI will schedule a build for this release. Review the build logs. - 3. Log into https://oss.sonatype.org/ and identify the staging repository. - 4. Sanity check its contents - 5. Release staging repository to Maven and send out release announcement. + 1. The release will be published using the Scala and JVM version combinations specified + in `scalaVersionsByJvm` in `build.sbt`. + - If you need to release against a different Scala version, include the Scala version + and the JVM version to use in the tag name, separated by `#`s (e.g., `v0.1.1#2.13.0-M1#8`). + Note that the JVM version needs to be listed in `.travis.yml` for the build to run. + 1. Travis CI will schedule a build for this release. Review the build logs. + 1. Log into https://oss.sonatype.org/ and identify the staging repository. + 1. Sanity check its contents. + 1. Release staging repository to Maven and send out release announcement. diff --git a/admin/build.sh b/admin/build.sh index bdd8490de..037672bd4 100755 --- a/admin/build.sh +++ b/admin/build.sh @@ -2,15 +2,43 @@ set -e -# prep environment for publish to sonatype staging if the HEAD commit is tagged +# Builds of tagged revisions are published to sonatype staging. -# git on travis does not fetch tags, but we have TRAVIS_TAG -# headTag=$(git describe --exact-match ||:) +# Travis runs a build on new revisions and on new tags, so a tagged revision is built twice. +# Builds for a tag have TRAVIS_TAG defined, which we use for identifying tagged builds. +# Checking the local git clone would not work because git on travis does not fetch tags. + +# The version number to be published is extracted from the tag, e.g., v1.2.3 publishes +# version 1.2.3 using all Scala versions in build.sbt's `crossScalaVersions`. + +# When a new, binary incompatible Scala version becomes available, a previously released version +# can be released using that new Scala version by creating a new tag containing the Scala and the +# JVM version after hashes, e.g., v1.2.3#2.13.0-M1#8. The JVM version needs to be listed in +# `.travis.yml`, otherwise the required build doesn't run. + +verPat="[0-9]+\.[0-9]+\.[0-9]+(-[A-Za-z0-9-]+)?" +tagPat="^v$verPat(#$verPat#[0-9]+)?$" + +if [[ "$TRAVIS_TAG" =~ $tagPat ]]; then + currentJvmVer=$(java -version 2>&1 | awk -F '"' '/version/ {print $2}' | sed 's/^1\.//' | sed 's/[^0-9].*//') + + tagVer=$(echo $TRAVIS_TAG | sed s/#.*// | sed s/^v//) + publishVersion='set every version := "'$tagVer'"' + + scalaAndJvmVer=$(echo $TRAVIS_TAG | sed s/[^#]*// | sed s/^#//) + if [ "$scalaAndJvmVer" != "" ]; then + scalaVer=$(echo $scalaAndJvmVer | sed s/#.*//) + jvmVer=$(echo $scalaAndJvmVer | sed s/[^#]*// | sed s/^#//) + if [ "$jvmVer" != "$currentJvmVer" ]; then + echo "Not publishing $TRAVIS_TAG on Java version $currentJvmVer." + exit 0 + fi + publishScalaVersion='set every ScalaModulePlugin.scalaVersionsByJvm := Map('$jvmVer' -> List("'$scalaVer'" -> true))' + echo "Releasing $tagVer using Scala $scalaVer on Java version $jvmVer." + else + echo "Releasing $tagVer on Java version $currentJvmVer according to 'scalaVersionsByJvm' in build.sbt." + fi -if [[ "$TRAVIS_TAG" =~ ^v[0-9]+\.[0-9]+\.[0-9]+(-[A-Za-z0-9-]+)? ]]; then - echo "Going to release from tag $TRAVIS_TAG!" - myVer=$(echo $TRAVIS_TAG | sed -e s/^v//) - publishVersion='set every version := "'$myVer'"' extraTarget="+publish-signed" cat admin/gpg.sbt >> project/plugins.sbt cp admin/publish-settings.sbt . @@ -22,4 +50,4 @@ if [[ "$TRAVIS_TAG" =~ ^v[0-9]+\.[0-9]+\.[0-9]+(-[A-Za-z0-9-]+)? ]]; then openssl aes-256-cbc -K $K -iv $IV -in admin/secring.asc.enc -out admin/secring.asc -d fi -sbt "$publishVersion" clean update +test +publishLocal $extraTarget +sbt "$publishVersion" "$publishScalaVersion" clean update +test +publishLocal $extraTarget diff --git a/build.sbt b/build.sbt index 46ecf9443..c77c60fec 100644 --- a/build.sbt +++ b/build.sbt @@ -1,14 +1,14 @@ -import com.typesafe.tools.mima.plugin.{MimaPlugin, MimaKeys} +import ScalaModulePlugin._ -scalaVersion in ThisBuild := crossScalaVersions.value.head -crossScalaVersions in ThisBuild := { - val java = System.getProperty("java.version") - if (java.startsWith("1.6.") || java.startsWith("1.7.")) - Seq("2.11.11") - else if (java.startsWith("1.8.") || java.startsWith("1.9.")) - Seq("2.12.2") - else - sys.error(s"don't know what Scala versions to build on $java") +scalaVersionsByJvm in ThisBuild := { + val v211 = "2.11.11" + val v212 = "2.12.2" + val v213 = "2.13.0-M1" + Map( + 6 -> List(v211 -> true), + 7 -> List(v211 -> false), + 8 -> List(v212 -> true, v213 -> true, v211 -> false), + 9 -> List(v212 -> false, v213 -> false, v211 -> false)) } lazy val root = project.in(file(".")) @@ -28,17 +28,12 @@ lazy val xml = crossProject.in(file(".")) ) .jvmSettings( scalaModuleSettings ++ - scalaModuleOsgiSettings ++ List( OsgiKeys.exportPackage := Seq(s"scala.xml.*;version=${version.value}"), libraryDependencies += "junit" % "junit" % "4.11" % "test", libraryDependencies += "com.novocode" % "junit-interface" % "0.10" % "test", libraryDependencies += ("org.scala-lang" % "scala-compiler" % scalaVersion.value % "test").exclude("org.scala-lang.modules", s"scala-xml*"), - mimaPreviousVersion := Some("1.0.6"), - // You cannot disable JVM test forking when working on scala modules - // that are distributed with the compiler because of an SBT - // classloader leaking issue (scala/scala-xml#20 and #112). - fork in Test := true): _*) + mimaPreviousVersion := Some("1.0.6")): _*) .jsConfigure(_.enablePlugins(ScalaJSJUnitPlugin)) lazy val xmlJVM = xml.jvm diff --git a/project/plugins.sbt b/project/plugins.sbt index 869efcd35..4420c3b0c 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,3 +1,3 @@ -addSbtPlugin("org.scala-lang.modules" % "scala-module-plugin" % "1.0.4") +addSbtPlugin("org.scala-lang.modules" % "scala-module-plugin" % "1.0.8") -addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.15") +addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.16") From 006afa45933695a4adc57aef28ab12561ae0efa1 Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Sat, 17 Dec 2016 10:51:03 -0500 Subject: [PATCH 132/789] Fix exclude rule for scala-xml from scala-compiler * build.sbt (libraryDependencies): There's no evidence that SBT supports Ivy's exclude globbing. See Ivy documentation http://ant.apache.org/ivy/history/2.4.0/ivyfile/artifact-exclude.html --- build.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index c77c60fec..a63ec69cd 100644 --- a/build.sbt +++ b/build.sbt @@ -32,7 +32,7 @@ lazy val xml = crossProject.in(file(".")) OsgiKeys.exportPackage := Seq(s"scala.xml.*;version=${version.value}"), libraryDependencies += "junit" % "junit" % "4.11" % "test", libraryDependencies += "com.novocode" % "junit-interface" % "0.10" % "test", - libraryDependencies += ("org.scala-lang" % "scala-compiler" % scalaVersion.value % "test").exclude("org.scala-lang.modules", s"scala-xml*"), + libraryDependencies += ("org.scala-lang" % "scala-compiler" % scalaVersion.value % "test").exclude("org.scala-lang.modules", s"scala-xml_${scalaVersion.value}"), mimaPreviousVersion := Some("1.0.6")): _*) .jsConfigure(_.enablePlugins(ScalaJSJUnitPlugin)) From 3af7a49845995fcca1f48d0bc8e0ae3b018e7c1c Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Fri, 5 May 2017 12:39:47 -0400 Subject: [PATCH 133/789] Fix 2.12 warnings - Unused imports - Unused code (in tests) - Local var never set (convert to val) [warn] scala-xml/jvm/src/test/scala/scala/xml/XMLSyntaxTest.scala:4: Unused import [warn] import org.junit.Ignore [warn] [warn] jvm/src/test/scala/scala/xml/parsing/Ticket0632Test.scala:4: Unused import [warn] import org.junit.Ignore [warn] ^ [warn] shared/src/test/scala/scala/xml/PatternMatching.scala:83: local var m in method nodeSeq is never set: consider using immutable val [warn] var m: PartialFunction[Any, Any] = { case SafeNodeSeq(s @ _*) => s } [warn] ^ [warn] shared/src/test/scala/scala/xml/Transformers.scala:6: Unused import [warn] import org.junit.Assert.assertTrue [warn] ^ [warn] shared/src/test/scala/scala/xml/XMLTest.scala:264: local val z in method XmlEy is never used [warn] val z = ax \ "@{the namespace from outer space}foo" [warn] ^ [warn] three warnings found [warn] 3 warnings found --- jvm/src/test/scala/scala/xml/XMLSyntaxTest.scala | 1 - jvm/src/test/scala/scala/xml/parsing/Ticket0632Test.scala | 1 - shared/src/test/scala/scala/xml/PatternMatching.scala | 2 +- shared/src/test/scala/scala/xml/Transformers.scala | 1 - shared/src/test/scala/scala/xml/XMLTest.scala | 1 - 5 files changed, 1 insertion(+), 5 deletions(-) diff --git a/jvm/src/test/scala/scala/xml/XMLSyntaxTest.scala b/jvm/src/test/scala/scala/xml/XMLSyntaxTest.scala index 48c5e1d22..50dbf4a65 100644 --- a/jvm/src/test/scala/scala/xml/XMLSyntaxTest.scala +++ b/jvm/src/test/scala/scala/xml/XMLSyntaxTest.scala @@ -1,7 +1,6 @@ package scala.xml import org.junit.Test -import org.junit.Ignore import org.junit.Assert.assertEquals class XMLSyntaxTestJVM { diff --git a/jvm/src/test/scala/scala/xml/parsing/Ticket0632Test.scala b/jvm/src/test/scala/scala/xml/parsing/Ticket0632Test.scala index 40b1976ab..ceb27c994 100644 --- a/jvm/src/test/scala/scala/xml/parsing/Ticket0632Test.scala +++ b/jvm/src/test/scala/scala/xml/parsing/Ticket0632Test.scala @@ -1,7 +1,6 @@ package scala.xml.parsing import org.junit.Test -import org.junit.Ignore import scala.xml.JUnitAssertsForXML.assertEquals class Ticket0632TestJVM { diff --git a/shared/src/test/scala/scala/xml/PatternMatching.scala b/shared/src/test/scala/scala/xml/PatternMatching.scala index 14f45b10a..fbf94b62b 100644 --- a/shared/src/test/scala/scala/xml/PatternMatching.scala +++ b/shared/src/test/scala/scala/xml/PatternMatching.scala @@ -80,7 +80,7 @@ class PatternMatching extends { }) // SI-1059 - var m: PartialFunction[Any, Any] = { case SafeNodeSeq(s @ _*) => s } + val m: PartialFunction[Any, Any] = { case SafeNodeSeq(s @ _*) => s } assertEquals(m(
++ ), List(, )) assertTrue(m.isDefinedAt( ++ )) diff --git a/shared/src/test/scala/scala/xml/Transformers.scala b/shared/src/test/scala/scala/xml/Transformers.scala index e02d0d6a6..5cec41080 100644 --- a/shared/src/test/scala/scala/xml/Transformers.scala +++ b/shared/src/test/scala/scala/xml/Transformers.scala @@ -3,7 +3,6 @@ package scala.xml import scala.xml.transform._ import org.junit.Test -import org.junit.Assert.assertTrue import org.junit.Assert.assertEquals class Transformers { diff --git a/shared/src/test/scala/scala/xml/XMLTest.scala b/shared/src/test/scala/scala/xml/XMLTest.scala index ac2f4347f..46f21d16f 100644 --- a/shared/src/test/scala/scala/xml/XMLTest.scala +++ b/shared/src/test/scala/scala/xml/XMLTest.scala @@ -261,7 +261,6 @@ class XMLTest { @UnitTest def XmlEy { - val z = ax \ "@{the namespace from outer space}foo" assertTrue((ax \ "@{the namespace from outer space}foo") xml_== "baz") assertTrue((cx \ "@{the namespace from outer space}foo") xml_== "baz") From 0911e6f2afc9c2867381f307f70a037f0263442f Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Wed, 3 May 2017 00:29:42 -0400 Subject: [PATCH 134/789] Improve junit tests to use assertEquals Using assertTrue and == won't show expected versus result. --- jvm/src/test/scala/scala/xml/XMLTest.scala | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/jvm/src/test/scala/scala/xml/XMLTest.scala b/jvm/src/test/scala/scala/xml/XMLTest.scala index 1b4058629..cc40e998e 100644 --- a/jvm/src/test/scala/scala/xml/XMLTest.scala +++ b/jvm/src/test/scala/scala/xml/XMLTest.scala @@ -40,8 +40,8 @@ class XMLTestJVM { override def text = "" } - assertTrue(c == parsedxml11) - assertTrue(parsedxml1 == parsedxml11) + assertEquals(c, parsedxml11) + assertEquals(parsedxml1, parsedxml11) assertTrue(List(parsedxml1) sameElements List(parsedxml11)) assertTrue(Array(parsedxml1).toList sameElements List(parsedxml11)) @@ -50,10 +50,10 @@ class XMLTestJVM { val i = new InputSource(new StringReader(x2)) val x2p = scala.xml.XML.load(i) - assertTrue(x2p == Elem(null, "book", e, sc, + assertEquals(Elem(null, "book", e, sc, Elem(null, "author", e, sc, Text("Peter Buneman")), Elem(null, "author", e, sc, Text("Dan Suciu")), - Elem(null, "title", e, sc, Text("Data on ze web")))) + Elem(null, "title", e, sc, Text("Data on ze web"))), x2p) } @@ -431,16 +431,16 @@ class XMLTestJVM { @UnitTest def t6939 = { val foo = - assertTrue(foo.child.head.scope.toString == """ xmlns:x="http://bar.com/"""") + assertEquals(foo.child.head.scope.toString, """ xmlns:x="http://bar.com/"""") val fooDefault = - assertTrue(fooDefault.child.head.scope.toString == """ xmlns="http://bar.com/"""") + assertEquals(fooDefault.child.head.scope.toString, """ xmlns="http://bar.com/"""") val foo2 = scala.xml.XML.loadString("""""") - assertTrue(foo2.child.head.scope.toString == """ xmlns:x="http://bar.com/"""") + assertEquals(foo2.child.head.scope.toString, """ xmlns:x="http://bar.com/"""") val foo2Default = scala.xml.XML.loadString("""""") - assertTrue(foo2Default.child.head.scope.toString == """ xmlns="http://bar.com/"""") + assertEquals(foo2Default.child.head.scope.toString, """ xmlns="http://bar.com/"""") } @UnitTest From a30715e26d0540963f5c985c66b9e986977136b4 Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Wed, 3 May 2017 00:38:29 -0400 Subject: [PATCH 135/789] Replace deprecated stack with list 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] ^ --- .../xml/dtd/impl/SubsetConstruction.scala | 9 +++-- .../scala/scala/xml/factory/XMLLoader.scala | 4 +- .../scala/xml/include/sax/XIncluder.scala | 11 +++-- .../scala/xml/parsing/FactoryAdapter.scala | 40 +++++++++++-------- 4 files changed, 35 insertions(+), 29 deletions(-) diff --git a/shared/src/main/scala/scala/xml/dtd/impl/SubsetConstruction.scala b/shared/src/main/scala/scala/xml/dtd/impl/SubsetConstruction.scala index 93ca0cfcd..b046a34e3 100644 --- a/shared/src/main/scala/scala/xml/dtd/impl/SubsetConstruction.scala +++ b/shared/src/main/scala/scala/xml/dtd/impl/SubsetConstruction.scala @@ -32,9 +32,9 @@ private[dtd] class SubsetConstruction[T <: AnyRef](val nfa: NondetWordAutom[T]) val delta = new mutable.HashMap[immutable.BitSet, mutable.HashMap[T, immutable.BitSet]] var deftrans = mutable.Map(q0 -> sink, sink -> sink) // initial transitions var finals: mutable.Map[immutable.BitSet, Int] = mutable.Map() - val rest = new mutable.Stack[immutable.BitSet] + var rest = immutable.List.empty[immutable.BitSet] - rest.push(sink, q0) + rest = q0 :: sink :: rest def addFinal(q: immutable.BitSet) { if (nfa containsFinal q) @@ -43,7 +43,7 @@ private[dtd] class SubsetConstruction[T <: AnyRef](val nfa: NondetWordAutom[T]) def add(Q: immutable.BitSet) { if (!states(Q)) { states += Q - rest push Q + rest = Q :: rest addFinal(Q) } } @@ -51,7 +51,8 @@ private[dtd] class SubsetConstruction[T <: AnyRef](val nfa: NondetWordAutom[T]) addFinal(q0) // initial state may also be a final state while (!rest.isEmpty) { - val P = rest.pop() + val P = rest.head + rest = rest.tail // assign a number to this bitset indexMap = indexMap.updated(P, ix) invIndexMap = invIndexMap.updated(ix, P) diff --git a/shared/src/main/scala/scala/xml/factory/XMLLoader.scala b/shared/src/main/scala/scala/xml/factory/XMLLoader.scala index 0604282ea..e08b41e94 100644 --- a/shared/src/main/scala/scala/xml/factory/XMLLoader.scala +++ b/shared/src/main/scala/scala/xml/factory/XMLLoader.scala @@ -37,9 +37,9 @@ trait XMLLoader[T <: Node] { def loadXML(source: InputSource, parser: SAXParser): T = { val newAdapter = adapter - newAdapter.scopeStack push TopScope + newAdapter.scopeStack = TopScope :: newAdapter.scopeStack parser.parse(source, newAdapter) - newAdapter.scopeStack.pop() + newAdapter.scopeStack = newAdapter.scopeStack.tail newAdapter.rootElem.asInstanceOf[T] } diff --git a/shared/src/main/scala/scala/xml/include/sax/XIncluder.scala b/shared/src/main/scala/scala/xml/include/sax/XIncluder.scala index ae1cd9dd0..ec5da7618 100644 --- a/shared/src/main/scala/scala/xml/include/sax/XIncluder.scala +++ b/shared/src/main/scala/scala/xml/include/sax/XIncluder.scala @@ -10,7 +10,6 @@ package scala package xml package include.sax -import scala.collection.mutable import org.xml.sax.{ ContentHandler, Locator, Attributes } import org.xml.sax.ext.LexicalHandler import java.io.{ OutputStream, OutputStreamWriter, IOException } @@ -126,7 +125,7 @@ class XIncluder(outs: OutputStream, encoding: String) extends ContentHandler wit // LexicalHandler methods private var inDTD: Boolean = false - private val entities = new mutable.Stack[String]() + private var entities = List.empty[String] def startDTD(name: String, publicID: String, systemID: String) { inDTD = true @@ -145,12 +144,12 @@ class XIncluder(outs: OutputStream, encoding: String) extends ContentHandler wit } def endDTD() {} - def startEntity(name: String) { - entities push name + def startEntity(name: String): Unit = { + entities = name :: entities } - def endEntity(name: String) { - entities.pop() + def endEntity(name: String): Unit = { + entities = entities.tail } def startCDATA() {} diff --git a/shared/src/main/scala/scala/xml/parsing/FactoryAdapter.scala b/shared/src/main/scala/scala/xml/parsing/FactoryAdapter.scala index a8b5c887f..41dd60388 100644 --- a/shared/src/main/scala/scala/xml/parsing/FactoryAdapter.scala +++ b/shared/src/main/scala/scala/xml/parsing/FactoryAdapter.scala @@ -10,7 +10,6 @@ package scala package xml package parsing -import scala.collection.{ mutable, Iterator } import org.xml.sax.Attributes import org.xml.sax.helpers.DefaultHandler @@ -39,10 +38,10 @@ abstract class FactoryAdapter extends DefaultHandler with factory.XMLLoader[Node var rootElem: Node = null val buffer = new StringBuilder() - val attribStack = new mutable.Stack[MetaData] - val hStack = new mutable.Stack[Node] // [ element ] contains siblings - val tagStack = new mutable.Stack[String] - var scopeStack = new mutable.Stack[NamespaceBinding] + var attribStack = List.empty[MetaData] + var hStack = List.empty[Node] // [ element ] contains siblings + var tagStack = List.empty[String] + var scopeStack = List.empty[NamespaceBinding] var curTag: String = null var capture: Boolean = false @@ -122,17 +121,17 @@ abstract class FactoryAdapter extends DefaultHandler with factory.XMLLoader[Node attributes: Attributes): Unit = { captureText() - tagStack push curTag + tagStack = curTag :: tagStack curTag = qname val localName = splitName(qname)._2 capture = nodeContainsText(localName) - hStack push null + hStack = null :: hStack var m: MetaData = Null var scpe: NamespaceBinding = if (scopeStack.isEmpty) TopScope - else scopeStack.top + else scopeStack.head for (i <- 0 until attributes.getLength()) { val qname = attributes getQName i @@ -147,8 +146,8 @@ abstract class FactoryAdapter extends DefaultHandler with factory.XMLLoader[Node m = Attribute(Option(pre), key, Text(value), m) } - scopeStack push scpe - attribStack push m + scopeStack = scpe :: scopeStack + attribStack = m :: attribStack } /** @@ -156,7 +155,7 @@ abstract class FactoryAdapter extends DefaultHandler with factory.XMLLoader[Node */ def captureText(): Unit = { if (capture && buffer.length > 0) - hStack push createText(buffer.toString) + hStack = createText(buffer.toString) :: hStack buffer.clear() } @@ -170,17 +169,24 @@ abstract class FactoryAdapter extends DefaultHandler with factory.XMLLoader[Node */ override def endElement(uri: String, _localName: String, qname: String): Unit = { captureText() - val metaData = attribStack.pop() + val metaData = attribStack.head + attribStack = attribStack.tail // reverse order to get it right - val v = (Iterator continually hStack.pop takeWhile (_ != null)).toList.reverse + val v = hStack.takeWhile(_ != null).reverse + hStack = hStack.dropWhile(_ != null) match { + case null :: hs => hs + case hs => hs + } val (pre, localName) = splitName(qname) - val scp = scopeStack.pop() + val scp = scopeStack.head + scopeStack = scopeStack.tail // create element rootElem = createNode(pre, localName, metaData, scp, v) - hStack push rootElem - curTag = tagStack.pop() + hStack = rootElem :: hStack + curTag = tagStack.head + tagStack = tagStack.tail capture = curTag != null && nodeContainsText(curTag) // root level } @@ -189,6 +195,6 @@ abstract class FactoryAdapter extends DefaultHandler with factory.XMLLoader[Node */ override def processingInstruction(target: String, data: String) { captureText() - hStack pushAll createProcInstr(target, data) + hStack = hStack.reverse_:::(createProcInstr(target, data).toList) } } From 913247e717a351813d7fbb4b7e512c8b0354105e Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Wed, 10 May 2017 23:20:01 -0400 Subject: [PATCH 136/789] Add mima exclude filters for mutable.Stack 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. --- build.sbt | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/build.sbt b/build.sbt index 4782aca5c..85bf1ef87 100644 --- a/build.sbt +++ b/build.sbt @@ -36,6 +36,19 @@ lazy val xml = crossProject.in(file(".")) libraryDependencies += "junit" % "junit" % "4.11" % "test", libraryDependencies += "com.novocode" % "junit-interface" % "0.10" % "test", libraryDependencies += ("org.scala-lang" % "scala-compiler" % scalaVersion.value % "test").exclude("org.scala-lang.modules", s"scala-xml_${scalaVersion.value}"), + mimaBinaryIssueFilters ++= { + import com.typesafe.tools.mima.core._ + import com.typesafe.tools.mima.core.ProblemFilters._ + Seq( + // Scala 2.12 deprecated mutable.Stack, so we broke + // binary compatability for 1.0.7 in the following way: + exclude[IncompatibleMethTypeProblem]("scala.xml.parsing.FactoryAdapter.scopeStack_="), + exclude[IncompatibleResultTypeProblem]("scala.xml.parsing.FactoryAdapter.hStack"), + exclude[IncompatibleResultTypeProblem]("scala.xml.parsing.FactoryAdapter.scopeStack"), + exclude[IncompatibleResultTypeProblem]("scala.xml.parsing.FactoryAdapter.attribStack"), + exclude[IncompatibleResultTypeProblem]("scala.xml.parsing.FactoryAdapter.tagStack") + ) + }, mimaPreviousVersion := Some("1.0.6")): _*) .jsConfigure(_.enablePlugins(ScalaJSJUnitPlugin)) From 424ca626a06d446498f4a2cec70b3201f5f8adc8 Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Thu, 11 May 2017 00:53:07 -0400 Subject: [PATCH 137/789] Document dropping mutuable.Stack Make a note of binary compatability change in scaladoc for members that were converted to mutable.Stack. --- .../scala/xml/parsing/FactoryAdapter.scala | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/shared/src/main/scala/scala/xml/parsing/FactoryAdapter.scala b/shared/src/main/scala/scala/xml/parsing/FactoryAdapter.scala index 41dd60388..c74754d86 100644 --- a/shared/src/main/scala/scala/xml/parsing/FactoryAdapter.scala +++ b/shared/src/main/scala/scala/xml/parsing/FactoryAdapter.scala @@ -38,9 +38,33 @@ abstract class FactoryAdapter extends DefaultHandler with factory.XMLLoader[Node var rootElem: Node = null val buffer = new StringBuilder() + /** List of attributes + * + * Previously was a [[scala.collection.mutable.Stack]], but is now a mutable [[scala.collection.immutable.List]]. + * + * @since 1.0.7 + */ var attribStack = List.empty[MetaData] + /** List of elements + * + * Previously was a [[scala.collection.mutable.Stack]], but is now a mutable [[scala.collection.immutable.List]]. + * + * @since 1.0.7 + */ var hStack = List.empty[Node] // [ element ] contains siblings + /** List of element names + * + * Previously was a [[scala.collection.mutable.Stack]], but is now a mutable [[scala.collection.immutable.List]]. + * + * @since 1.0.7 + */ var tagStack = List.empty[String] + /** List of namespaces + * + * Previously was a [[scala.collection.mutable.Stack]], but is now a mutable [[scala.collection.immutable.List]]. + * + * @since 1.0.7 + */ var scopeStack = List.empty[NamespaceBinding] var curTag: String = null From 6824df841ed7139496c0f84a398926263113d8d1 Mon Sep 17 00:00:00 2001 From: Fehmi Can Saglam Date: Tue, 20 Oct 2015 18:40:26 +0300 Subject: [PATCH 138/789] Test for XMLEventReader mishandling ' --- .../scala/xml/pull/XMLEventReaderTest.scala | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/jvm/src/test/scala/scala/xml/pull/XMLEventReaderTest.scala b/jvm/src/test/scala/scala/xml/pull/XMLEventReaderTest.scala index 6b66326da..f36b8798e 100644 --- a/jvm/src/test/scala/scala/xml/pull/XMLEventReaderTest.scala +++ b/jvm/src/test/scala/scala/xml/pull/XMLEventReaderTest.scala @@ -168,4 +168,40 @@ class XMLEventReaderTest { while(er.hasNext) er.next() er.stop() } + + @Test + def entityRefTest: Unit = { + val source = Source.fromString(""'<>&") + val er = new XMLEventReader(source) + + assertTrue(er.next match { + case EvElemStart(_, "text", _, _) => true + case _ => false + }) + assertTrue(er.next match { + case EvEntityRef("quot") => true + case e => false + }) + assertTrue(er.next match { + case EvEntityRef("apos") => true + case _ => false + }) + assertTrue(er.next match { + case EvEntityRef("lt") => true + case _ => false + }) + assertTrue(er.next match { + case EvEntityRef("gt") => true + case _ => false + }) + assertTrue(er.next match { + case EvEntityRef("amp") => true + case _ => false + }) + assertTrue(er.next match { + case EvElemEnd(_, "text") => true + case _ => false + }) + assert(er.isEmpty) + } } From 3b0775bc433106e8a4c4041a53820f10c5d8aa50 Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Tue, 15 Dec 2015 16:31:14 -0500 Subject: [PATCH 139/789] Fix #72 XMLEventReader does not handle ' properly * shared/src/main/scala/scala/xml/Utility.scala: Uncomment apos in unescape map. * jvm/src/test/scala/scala/xml/pull/XMLEventReaderTest.scala (entityRefTest): Refactor unit test. --- .../scala/xml/pull/XMLEventReaderTest.scala | 34 ++++++------------- shared/src/main/scala/scala/xml/Utility.scala | 10 +++--- 2 files changed, 15 insertions(+), 29 deletions(-) diff --git a/jvm/src/test/scala/scala/xml/pull/XMLEventReaderTest.scala b/jvm/src/test/scala/scala/xml/pull/XMLEventReaderTest.scala index f36b8798e..49df7d56f 100644 --- a/jvm/src/test/scala/scala/xml/pull/XMLEventReaderTest.scala +++ b/jvm/src/test/scala/scala/xml/pull/XMLEventReaderTest.scala @@ -2,7 +2,7 @@ package scala.xml package pull import org.junit.Test -import org.junit.Assert.{assertFalse, assertTrue} +import org.junit.Assert.{assertEquals,assertFalse, assertTrue} import scala.io.Source import scala.xml.parsing.FatalError @@ -170,7 +170,7 @@ class XMLEventReaderTest { } @Test - def entityRefTest: Unit = { + def entityRefTest: Unit = { // SI-7796 val source = Source.fromString(""'<>&") val er = new XMLEventReader(source) @@ -178,30 +178,18 @@ class XMLEventReaderTest { case EvElemStart(_, "text", _, _) => true case _ => false }) - assertTrue(er.next match { - case EvEntityRef("quot") => true - case e => false - }) - assertTrue(er.next match { - case EvEntityRef("apos") => true - case _ => false - }) - assertTrue(er.next match { - case EvEntityRef("lt") => true - case _ => false - }) - assertTrue(er.next match { - case EvEntityRef("gt") => true - case _ => false - }) - assertTrue(er.next match { - case EvEntityRef("amp") => true - case _ => false - }) + + assertEquals(EvEntityRef("quot"), er.next) + assertEquals(EvEntityRef("apos"), er.next) + assertEquals(EvEntityRef("lt"), er.next) + assertEquals(EvEntityRef("gt"), er.next) + assertEquals(EvEntityRef("amp"), er.next) + assertTrue(er.next match { case EvElemEnd(_, "text") => true case _ => false }) - assert(er.isEmpty) + + assertTrue(er.isEmpty) } } diff --git a/shared/src/main/scala/scala/xml/Utility.scala b/shared/src/main/scala/scala/xml/Utility.scala index 467e57af3..57d9291bf 100755 --- a/shared/src/main/scala/scala/xml/Utility.scala +++ b/shared/src/main/scala/scala/xml/Utility.scala @@ -96,13 +96,11 @@ object Utility extends AnyRef with parsing.TokenTests { "lt" -> '<', "gt" -> '>', "amp" -> '&', - "quot" -> '"' - // enigmatic comment explaining why this isn't escaped -- - // is valid xhtml but not html, and IE doesn't know it, says jweb - // "apos" -> '\'' + "quot" -> '"', + "apos" -> '\'' ) - val escMap = pairs map { case (s, c) => c -> ("&%s;" format s) } - val unescMap = pairs ++ Map("apos" -> '\'') + val escMap = (pairs - "apos") map { case (s, c) => c -> ("&%s;" format s) } + val unescMap = pairs } import Escapes.unescMap From a50eca62ab4a24ffb7cd63f17a1307133448205c Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Fri, 23 Jan 2015 15:19:14 -0500 Subject: [PATCH 140/789] Unit test for #46 preserve short/self-closing/empty tags --- jvm/src/test/scala/scala/xml/XMLTest.scala | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/jvm/src/test/scala/scala/xml/XMLTest.scala b/jvm/src/test/scala/scala/xml/XMLTest.scala index cc40e998e..b937069f1 100644 --- a/jvm/src/test/scala/scala/xml/XMLTest.scala +++ b/jvm/src/test/scala/scala/xml/XMLTest.scala @@ -542,4 +542,17 @@ class XMLTestJVM { pp.format(x, sb) assertEquals(expected, sb.toString) } + + @UnitTest + def issue46: Unit = { + // val x = + val x = + // val x = Elem(null, "node", e, sc) + val pp = new xml.PrettyPrinter(80, 2) + // This assertion passed + assertEquals("", x.toString) + // This was the bug, producing + assertEquals("", pp.format(x.copy(minimizeEmpty = true))) + } + } From 063ab3b47e81a4547395aec6ac6f80c3936a2cf9 Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Tue, 9 Feb 2016 19:04:09 -0500 Subject: [PATCH 141/789] Add new config for PrettyPrinter to minimize empty tags #90 * src/main/scala/scala/xml/PrettyPrinter.scala (PrettyPrinter): New parameter minimizeEmpty. (PrettyPrinter.traverse): Pass config for minimizeTags to Utility.serialize(). * src/test/scala/scala/xml/UtilityTest.scala (issue90): New test. * src/test/scala/scala/xml/XMLTest.scala (issue90): New test. --- jvm/src/test/scala/scala/xml/XMLTest.scala | 7 +++++++ shared/src/main/scala/scala/xml/PrettyPrinter.scala | 5 +++-- shared/src/test/scala/scala/xml/UtilityTest.scala | 6 ++++++ 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/jvm/src/test/scala/scala/xml/XMLTest.scala b/jvm/src/test/scala/scala/xml/XMLTest.scala index b937069f1..5d90054c7 100644 --- a/jvm/src/test/scala/scala/xml/XMLTest.scala +++ b/jvm/src/test/scala/scala/xml/XMLTest.scala @@ -555,4 +555,11 @@ class XMLTestJVM { assertEquals("", pp.format(x.copy(minimizeEmpty = true))) } + @UnitTest + def issue90: Unit = { + val pp = new xml.PrettyPrinter(80, 2, minimizeEmpty = true) + val x = + assertEquals("\n \n", pp.format(x)) + } + } diff --git a/shared/src/main/scala/scala/xml/PrettyPrinter.scala b/shared/src/main/scala/scala/xml/PrettyPrinter.scala index b3f4f9940..85bad15be 100755 --- a/shared/src/main/scala/scala/xml/PrettyPrinter.scala +++ b/shared/src/main/scala/scala/xml/PrettyPrinter.scala @@ -23,8 +23,9 @@ import Utility.sbToString * @param width the width to fit the output into * @param step indentation */ -class PrettyPrinter(width: Int, step: Int) { +class PrettyPrinter(width: Int, step: Int, minimizeEmpty: Boolean = false) { + val minimizeMode = if (minimizeEmpty) MinimizeMode.Always else MinimizeMode.Default class BrokenException() extends java.lang.Exception class Item @@ -150,7 +151,7 @@ class PrettyPrinter(width: Int, step: Int) { case _ => val test = { val sb = new StringBuilder() - Utility.serialize(node, pscope, sb, stripComments = false) + Utility.serialize(node, pscope, sb, stripComments = false, minimizeTags = minimizeMode) if (doPreserve(node)) sb.toString else TextBuffer.fromString(sb.toString).toText(0).data } diff --git a/shared/src/test/scala/scala/xml/UtilityTest.scala b/shared/src/test/scala/scala/xml/UtilityTest.scala index f6b3828fa..58aadf780 100644 --- a/shared/src/test/scala/scala/xml/UtilityTest.scala +++ b/shared/src/test/scala/scala/xml/UtilityTest.scala @@ -51,4 +51,10 @@ class UtilityTest {
.hashCode // Bug #777 } + @Test + def issue90: Unit = { + val x = + assertEquals("", Utility.serialize(x, minimizeTags = MinimizeMode.Always).toString) + } + } From 8c44f6dc770c38f05a80cc64c7a1066204b1f757 Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Tue, 9 Feb 2016 22:18:04 -0500 Subject: [PATCH 142/789] Fix Travis build failure from migration-manager (mimaReportBinaryIssues) * src/main/scala/scala/xml/PrettyPrinter.scala (PrettyPrinter): Convert class default parameter to alternate constructor. --- shared/src/main/scala/scala/xml/PrettyPrinter.scala | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/shared/src/main/scala/scala/xml/PrettyPrinter.scala b/shared/src/main/scala/scala/xml/PrettyPrinter.scala index 85bad15be..2da75a160 100755 --- a/shared/src/main/scala/scala/xml/PrettyPrinter.scala +++ b/shared/src/main/scala/scala/xml/PrettyPrinter.scala @@ -23,7 +23,9 @@ import Utility.sbToString * @param width the width to fit the output into * @param step indentation */ -class PrettyPrinter(width: Int, step: Int, minimizeEmpty: Boolean = false) { +class PrettyPrinter(width: Int, step: Int, minimizeEmpty: Boolean) { + + def this(width: Int, step: Int) = this(width, step, minimizeEmpty = false) val minimizeMode = if (minimizeEmpty) MinimizeMode.Always else MinimizeMode.Default class BrokenException() extends java.lang.Exception From 90df189b3ba3dca45a333907cc3b652b5b14f881 Mon Sep 17 00:00:00 2001 From: Som Snytt Date: Tue, 23 Dec 2014 13:08:38 -0800 Subject: [PATCH 143/789] Fix #44 Accept fifth edition names * jvm/src/main/scala/scala/xml/parsing/TokenTests.scala (isNameChar): Add middle dot, #xB7, as specified at [4a] of XML 1.0 5th edition. * jvm/src/test/scala/scala/xml/XMLTest.scala (t9060): New test. * jvm/src/test/scala/scala/xml/parsing/ConstructingParserTest.scala (t9060): New test. --- jvm/src/test/scala/scala/xml/XMLTest.scala | 12 +++++++--- .../xml/parsing/ConstructingParserTest.scala | 22 +++++++++++++++++++ .../scala/scala/xml/parsing/TokenTests.scala | 6 ++--- 3 files changed, 34 insertions(+), 6 deletions(-) create mode 100644 jvm/src/test/scala/scala/xml/parsing/ConstructingParserTest.scala diff --git a/jvm/src/test/scala/scala/xml/XMLTest.scala b/jvm/src/test/scala/scala/xml/XMLTest.scala index 5d90054c7..9ae6bc389 100644 --- a/jvm/src/test/scala/scala/xml/XMLTest.scala +++ b/jvm/src/test/scala/scala/xml/XMLTest.scala @@ -390,7 +390,7 @@ class XMLTestJVM { } @UnitTest - def t5052 { + def t5052 = { assertTrue( xml_== ) assertTrue( xml_== ) assertTrue( xml_== ) @@ -412,7 +412,7 @@ class XMLTestJVM { } @UnitTest - def t5843 { + def t5843 = { val foo = scala.xml.Attribute(null, "foo", "1", scala.xml.Null) val bar = scala.xml.Attribute(null, "bar", "2", foo) val ns = scala.xml.NamespaceBinding(null, "uri", scala.xml.TopScope) @@ -444,7 +444,7 @@ class XMLTestJVM { } @UnitTest - def t7074 { + def t7074 = { assertEquals("""""", sort() toString) assertEquals("""""", sort() toString) assertEquals("""""", sort() toString) @@ -456,6 +456,12 @@ class XMLTestJVM { assertEquals("""""", sort() toString) } + @UnitTest + def t9060 = { + val expected = """""" + assertEquals(expected, XML.loadString(expected).toString) + } + @UnitTest def attributes = { val noAttr = diff --git a/jvm/src/test/scala/scala/xml/parsing/ConstructingParserTest.scala b/jvm/src/test/scala/scala/xml/parsing/ConstructingParserTest.scala new file mode 100644 index 000000000..d67524c51 --- /dev/null +++ b/jvm/src/test/scala/scala/xml/parsing/ConstructingParserTest.scala @@ -0,0 +1,22 @@ +package scala.xml +package parsing + +import scala.io.Source +import org.junit.Test +import scala.xml.JUnitAssertsForXML.{ assertEquals => assertXml } + +class ConstructingParserTest { + + @Test + def t9060 = { + val a = """""" + val source = new Source { + val iter = a.iterator + override def reportError(pos: Int, msg: String, out: java.io.PrintStream = Console.err) = {} + } + val doc = ConstructingParser.fromSource(source, false).content(TopScope) + assertXml(a, doc) + + } + +} diff --git a/shared/src/main/scala/scala/xml/parsing/TokenTests.scala b/shared/src/main/scala/scala/xml/parsing/TokenTests.scala index ab71a43c0..22740d818 100644 --- a/shared/src/main/scala/scala/xml/parsing/TokenTests.scala +++ b/shared/src/main/scala/scala/xml/parsing/TokenTests.scala @@ -37,10 +37,10 @@ trait TokenTests { /** * {{{ - * NameChar ::= Letter | Digit | '.' | '-' | '_' | ':' + * NameChar ::= Letter | Digit | '.' | '-' | '_' | ':' | #xB7 * | CombiningChar | Extender * }}} - * See [4] and Appendix B of XML 1.0 specification. + * See [4] and [4a] of Appendix B of XML 1.0 specification. */ def isNameChar(ch: Char) = { import java.lang.Character._ @@ -50,7 +50,7 @@ trait TokenTests { case COMBINING_SPACING_MARK | ENCLOSING_MARK | NON_SPACING_MARK | MODIFIER_LETTER | DECIMAL_DIGIT_NUMBER => true - case _ => ".-:" contains ch + case _ => ".-:·" contains ch }) } From ee91a55f94a53739dee17b9c204f278ae81090db Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Mon, 15 Feb 2016 15:34:42 -0500 Subject: [PATCH 144/789] Allow a colon to start a name * jvm/src/main/scala/scala/xml/parsing/TokenTests.scala (isNameChar): Add middle dot. * jvm/src/main/scala/scala/xml/parsing/TokenTests.scala (isNameStart): Allow colon to start a name. * jvm/src/test/scala/scala/xml/UtilityTest.scala (isNameStart): Colon should be able to start a name. --- shared/src/main/scala/scala/xml/parsing/TokenTests.scala | 6 +++--- shared/src/test/scala/scala/xml/UtilityTest.scala | 3 +-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/shared/src/main/scala/scala/xml/parsing/TokenTests.scala b/shared/src/main/scala/scala/xml/parsing/TokenTests.scala index 22740d818..32149bd14 100644 --- a/shared/src/main/scala/scala/xml/parsing/TokenTests.scala +++ b/shared/src/main/scala/scala/xml/parsing/TokenTests.scala @@ -56,13 +56,13 @@ trait TokenTests { /** * {{{ - * NameStart ::= ( Letter | '_' ) + * NameStart ::= ( Letter | '_' | ':' ) * }}} * where Letter means in one of the Unicode general * categories `{ Ll, Lu, Lo, Lt, Nl }`. * * We do not allow a name to start with `:`. - * See [3] and Appendix B of XML 1.0 specification + * See [4] and Appendix B of XML 1.0 specification */ def isNameStart(ch: Char) = { import java.lang.Character._ @@ -71,7 +71,7 @@ trait TokenTests { case LOWERCASE_LETTER | UPPERCASE_LETTER | OTHER_LETTER | TITLECASE_LETTER | LETTER_NUMBER => true - case _ => ch == '_' + case _ => ":_".contains(ch) } } diff --git a/shared/src/test/scala/scala/xml/UtilityTest.scala b/shared/src/test/scala/scala/xml/UtilityTest.scala index 58aadf780..5c7d39496 100644 --- a/shared/src/test/scala/scala/xml/UtilityTest.scala +++ b/shared/src/test/scala/scala/xml/UtilityTest.scala @@ -2,7 +2,6 @@ package scala.xml import org.junit.Test import org.junit.Assert.assertTrue -import org.junit.Assert.assertFalse import org.junit.Assert.assertEquals class UtilityTest { @@ -10,7 +9,7 @@ class UtilityTest { @Test def isNameStart: Unit = { assertTrue(Utility.isNameStart('b')) - assertFalse(Utility.isNameStart(':')) + assertTrue(Utility.isNameStart(':')) } @Test From 3bbc63e9f654e53bb98ab17ad14da374f341fe69 Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Thu, 20 Oct 2016 18:48:26 -0400 Subject: [PATCH 145/789] Add test of NodeBuffer for #115 --- .../src/test/scala/scala/xml/NodeBufferTest.scala | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 shared/src/test/scala/scala/xml/NodeBufferTest.scala diff --git a/shared/src/test/scala/scala/xml/NodeBufferTest.scala b/shared/src/test/scala/scala/xml/NodeBufferTest.scala new file mode 100644 index 000000000..93fcb7a5f --- /dev/null +++ b/shared/src/test/scala/scala/xml/NodeBufferTest.scala @@ -0,0 +1,13 @@ +package scala.xml + +import org.junit.Test +import org.junit.Assert.assertEquals + +class NodeBufferTest { + + @Test + def testToString: Unit = { + val nodeBuffer = new NodeBuffer + assertEquals("NodeBuffer()", nodeBuffer.toString) + } +} From 3f27264c82edfd05465b9b1a63e56c6055284e17 Mon Sep 17 00:00:00 2001 From: js Date: Thu, 20 Oct 2016 18:49:15 -0400 Subject: [PATCH 146/789] Fix #115 with override def stringPrefix = "NodeBuffer" --- shared/src/main/scala/scala/xml/NodeBuffer.scala | 2 ++ 1 file changed, 2 insertions(+) diff --git a/shared/src/main/scala/scala/xml/NodeBuffer.scala b/shared/src/main/scala/scala/xml/NodeBuffer.scala index ba26bced6..6362f57ec 100644 --- a/shared/src/main/scala/scala/xml/NodeBuffer.scala +++ b/shared/src/main/scala/scala/xml/NodeBuffer.scala @@ -22,6 +22,8 @@ package xml */ class NodeBuffer extends scala.collection.mutable.ArrayBuffer[Node] { + override def stringPrefix: String = "NodeBuffer" + /** * Append given object to this buffer, returns reference on this * `NodeBuffer` for convenience. Some rules apply: From e15ce87ddef0f412865b3ae96fba3387ad59995b Mon Sep 17 00:00:00 2001 From: Rogach Date: Thu, 10 Nov 2016 23:28:25 +0300 Subject: [PATCH 147/789] Change default encoding in XML.save to UTF-8 Was ISO-8859-1, which resulted in encoding errors at runtime if document contained non-latin1 characters. Also XML spec states that documents without xml declaration are expected to contain UTF-8 or UTF-16 - so writing in ISO-8859-1 without xml declaration (which was the default) can easily break compliant parsers. --- shared/src/main/scala/scala/xml/XML.scala | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/shared/src/main/scala/scala/xml/XML.scala b/shared/src/main/scala/scala/xml/XML.scala index 649c8b029..0914beff1 100755 --- a/shared/src/main/scala/scala/xml/XML.scala +++ b/shared/src/main/scala/scala/xml/XML.scala @@ -63,7 +63,7 @@ object XML extends XMLLoader[Elem] { val preserve = "preserve" val space = "space" val lang = "lang" - val encoding = "ISO-8859-1" + val encoding = "UTF-8" /** Returns an XMLLoader whose load* methods will use the supplied SAXParser. */ def withSAXParser(p: SAXParser): XMLLoader[Elem] = @@ -82,7 +82,7 @@ object XML extends XMLLoader[Elem] { final def save( filename: String, node: Node, - enc: String = encoding, + enc: String = "UTF-8", xmlDecl: Boolean = false, doctype: dtd.DocType = null): Unit = { From 9b85c9ddab2423b4e3281ccc6fbf4dc201f19735 Mon Sep 17 00:00:00 2001 From: Rogach Date: Fri, 11 Nov 2016 00:02:01 +0300 Subject: [PATCH 148/789] Add note about default encoding change to XML.save method documentation. --- shared/src/main/scala/scala/xml/XML.scala | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/shared/src/main/scala/scala/xml/XML.scala b/shared/src/main/scala/scala/xml/XML.scala index 0914beff1..eee10c604 100755 --- a/shared/src/main/scala/scala/xml/XML.scala +++ b/shared/src/main/scala/scala/xml/XML.scala @@ -73,6 +73,10 @@ object XML extends XMLLoader[Elem] { * Saves a node to a file with given filename using given encoding * optionally with xmldecl and doctype declaration. * + * Note: default encoding was ISO-8859-1 (latin1) in pre-1.0.7 scala-xml versions. + * If your code depends on charaters in non-ASCII latin1 range, specify + * ISO-8859-1 encoding explicitly. + * * @param filename the filename * @param node the xml node we want to write * @param enc encoding to use From bcec7428624c667be75b8ceb4645300b53bc62bf Mon Sep 17 00:00:00 2001 From: Rogach Date: Fri, 11 Nov 2016 00:16:33 +0300 Subject: [PATCH 149/789] fix typo in method documentation --- shared/src/main/scala/scala/xml/XML.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shared/src/main/scala/scala/xml/XML.scala b/shared/src/main/scala/scala/xml/XML.scala index eee10c604..be1de76a5 100755 --- a/shared/src/main/scala/scala/xml/XML.scala +++ b/shared/src/main/scala/scala/xml/XML.scala @@ -74,7 +74,7 @@ object XML extends XMLLoader[Elem] { * optionally with xmldecl and doctype declaration. * * Note: default encoding was ISO-8859-1 (latin1) in pre-1.0.7 scala-xml versions. - * If your code depends on charaters in non-ASCII latin1 range, specify + * If your code depends on characters in non-ASCII latin1 range, specify * ISO-8859-1 encoding explicitly. * * @param filename the filename From c416c4eeea8727114f97a467646776fd216a7739 Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Fri, 11 Nov 2016 01:35:54 -0500 Subject: [PATCH 150/789] Add test for ISO-8859-1 defect found with XML.save in #121 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Try to closely mimic bug in XML.save and XML.loadFile, but write tests that don't use the file system. Will fail in 1.0.6 and earlier: expected:<...klmnopqrstuvwxyz{|}~[ ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖרÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ]> but was:<...klmnopqrstuvwxyz{|}~[????????????????????????????????????????????????????????????????????????????????????????????????]> Will be fixed in #122. --- jvm/src/test/scala/scala/xml/XMLTest.scala | 23 ++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/jvm/src/test/scala/scala/xml/XMLTest.scala b/jvm/src/test/scala/scala/xml/XMLTest.scala index 9ae6bc389..43dd182e2 100644 --- a/jvm/src/test/scala/scala/xml/XMLTest.scala +++ b/jvm/src/test/scala/scala/xml/XMLTest.scala @@ -300,6 +300,29 @@ class XMLTestJVM { """, wsdlTemplate4("service4", () => "target4") toString) } + // Issue found with ISO-8859-1 in #121 that was fixed with UTF-8 default + @UnitTest + def writeReadNoDeclarationDefaultEncoding: Unit = { + val chars = ((32 to 126) ++ (160 to 255)).map(_.toChar) + val xml = { chars.mkString } + + // com.sun.org.apache.xerces.internal.impl.io.MalformedByteSequenceException: + // Invalid byte 1 of 1-byte UTF-8 sequence. + // scala.xml.XML.save("foo.xml", xml) + // scala.xml.XML.loadFile("foo.xml").toString) + + val outputStream = new java.io.ByteArrayOutputStream + val streamWriter = new java.io.OutputStreamWriter(outputStream, XML.encoding) + + XML.write(streamWriter, xml, XML.encoding, false, null) + streamWriter.flush + + val inputStream = new java.io.ByteArrayInputStream(outputStream.toByteArray) + val streamReader = new java.io.InputStreamReader(inputStream) + + assertEquals(xml.toString, XML.load(streamReader).toString) + } + @UnitTest def t0663 = { val src = scala.io.Source.fromString("") From 9f36b3e0389ae3b3c5a82daba82807aea6033062 Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Tue, 24 May 2016 15:49:49 -0400 Subject: [PATCH 151/789] Revert imperative Utility.escape from 81d7e2a --- shared/src/main/scala/scala/xml/Utility.scala | 22 +++++-------------- 1 file changed, 5 insertions(+), 17 deletions(-) diff --git a/shared/src/main/scala/scala/xml/Utility.scala b/shared/src/main/scala/scala/xml/Utility.scala index 57d9291bf..8c8100b08 100755 --- a/shared/src/main/scala/scala/xml/Utility.scala +++ b/shared/src/main/scala/scala/xml/Utility.scala @@ -110,25 +110,13 @@ object Utility extends AnyRef with parsing.TokenTests { final def escape(text: String, s: StringBuilder): StringBuilder = { // Implemented per XML spec: // http://www.w3.org/International/questions/qa-controls - // imperative code 3x-4x faster than current implementation - // dpp (David Pollak) 2010/02/03 - val len = text.length - var pos = 0 - while (pos < len) { - text.charAt(pos) match { - case '<' => s.append("<") - case '>' => s.append(">") - case '&' => s.append("&") - case '"' => s.append(""") - case '\n' => s.append('\n') - case '\r' => s.append('\r') - case '\t' => s.append('\t') - case c => if (c >= ' ') s.append(c) + text.iterator.foldLeft(s) { (s, c) => + escMap.get(c) match { + case Some(str) => s ++= str + case _ => if c >= ' ' || "\n\r\t".contains(c) => s += c + case _ => s // noop } - - pos += 1 } - s } /** From 98bc791e33fa80387c3f271f9093cbad3be594f0 Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Tue, 25 Apr 2017 10:25:31 -0400 Subject: [PATCH 152/789] Revert removal of escMap import in de0b47e --- shared/src/main/scala/scala/xml/Utility.scala | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/shared/src/main/scala/scala/xml/Utility.scala b/shared/src/main/scala/scala/xml/Utility.scala index 8c8100b08..117c62aa4 100755 --- a/shared/src/main/scala/scala/xml/Utility.scala +++ b/shared/src/main/scala/scala/xml/Utility.scala @@ -102,7 +102,7 @@ object Utility extends AnyRef with parsing.TokenTests { val escMap = (pairs - "apos") map { case (s, c) => c -> ("&%s;" format s) } val unescMap = pairs } - import Escapes.unescMap + import Escapes.{ escMap, unescMap } /** * Appends escaped string to `s`. @@ -113,7 +113,7 @@ object Utility extends AnyRef with parsing.TokenTests { text.iterator.foldLeft(s) { (s, c) => escMap.get(c) match { case Some(str) => s ++= str - case _ => if c >= ' ' || "\n\r\t".contains(c) => s += c + case _ if c >= ' ' || "\n\r\t".contains(c) => s += c case _ => s // noop } } From 1c6ed32a59494912d9ae1840a3c6b972ca152473 Mon Sep 17 00:00:00 2001 From: Juris Krikis Date: Tue, 7 Mar 2017 09:54:59 +0200 Subject: [PATCH 153/789] Fix contention due to lzycompute synchronised access --- shared/src/main/scala/scala/xml/MetaData.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shared/src/main/scala/scala/xml/MetaData.scala b/shared/src/main/scala/scala/xml/MetaData.scala index 02c228f69..ae84b96d7 100644 --- a/shared/src/main/scala/scala/xml/MetaData.scala +++ b/shared/src/main/scala/scala/xml/MetaData.scala @@ -37,7 +37,7 @@ object MetaData { */ def normalize(attribs: MetaData, scope: NamespaceBinding): MetaData = { def iterate(md: MetaData, normalized_attribs: MetaData, set: Set[String]): MetaData = { - lazy val key = getUniversalKey(md, scope) + def key = getUniversalKey(md, scope) if (md eq Null) normalized_attribs else if ((md.value eq null) || set(key)) iterate(md.next, normalized_attribs, set) else md copy iterate(md.next, normalized_attribs, set + key) From 01e5c506796efe5f5bdcf83338698b1a01834fd5 Mon Sep 17 00:00:00 2001 From: Juris Krikis Date: Thu, 9 Mar 2017 11:16:54 +0200 Subject: [PATCH 154/789] Avoid duplicate getUniversalKey invocation --- shared/src/main/scala/scala/xml/MetaData.scala | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/shared/src/main/scala/scala/xml/MetaData.scala b/shared/src/main/scala/scala/xml/MetaData.scala index ae84b96d7..8d92892fa 100644 --- a/shared/src/main/scala/scala/xml/MetaData.scala +++ b/shared/src/main/scala/scala/xml/MetaData.scala @@ -37,10 +37,18 @@ object MetaData { */ def normalize(attribs: MetaData, scope: NamespaceBinding): MetaData = { def iterate(md: MetaData, normalized_attribs: MetaData, set: Set[String]): MetaData = { - def key = getUniversalKey(md, scope) - if (md eq Null) normalized_attribs - else if ((md.value eq null) || set(key)) iterate(md.next, normalized_attribs, set) - else md copy iterate(md.next, normalized_attribs, set + key) + if (md eq Null) { + normalized_attribs + } else if (md.value eq null) { + iterate(md.next, normalized_attribs, set) + } else { + val key = getUniversalKey(md, scope) + if (set(key)) { + iterate(md.next, normalized_attribs, set) + } else { + md copy iterate(md.next, normalized_attribs, set + key) + } + } } iterate(attribs, Null, Set()) } From f0c1e5f006e6708c868fd9aa93e0a732b5eb7713 Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Thu, 8 Jun 2017 09:48:49 -0400 Subject: [PATCH 155/789] Update maven badges --- README.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 1847bf6d6..ebec79812 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,9 @@ -scala-xml [](https://travis-ci.org/scala/scala-xml) [](http://search.maven.org/#search%7Cga%7C1%7Cg%3Aorg.scala-lang.modules%20a%3Ascala-xml_2.11) [](http://search.maven.org/#search%7Cga%7C1%7Cg%3Aorg.scala-lang.modules%20a%3Ascala-xml_2.12*) [![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/scala/scala-xml) +scala-xml +[![Travis](https://img.shields.io/travis/scala/scala-xml.svg)](https://travis-ci.org/scala/scala-xml) +[![latest release for 2.11](https://img.shields.io/maven-central/v/org.scala-lang.modules/scala-xml_2.11.svg?label=scala+2.11)](http://mvnrepository.com/artifact/org.scala-lang.modules/scala-xml_2.11) +[![latest release for 2.12](https://img.shields.io/maven-central/v/org.scala-lang.modules/scala-xml_2.12.svg?label=scala+2.12)](http://mvnrepository.com/artifact/org.scala-lang.modules/scala-xml_2.12) +[![latest release for 2.13.0-M1](https://img.shields.io/maven-central/v/org.scala-lang.modules/scala-xml_2.13.0-M1.svg?label=scala+2.13.0-M1)](http://mvnrepository.com/artifact/org.scala-lang.modules/scala-xml_2.13.0-M1) +[![Gitter](https://badges.gitter.im/Join+Chat.svg)](https://gitter.im/scala/scala-xml) ========= The standard Scala XML library. Please file issues here instead of over at issues.scala-lang.org. From 9917313003c33de6ae54a3fe03d4945aa2f94803 Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Mon, 17 Jul 2017 13:57:04 -0400 Subject: [PATCH 156/789] Rename scala-module-plugin to sbt-scala-module --- project/plugins.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/plugins.sbt b/project/plugins.sbt index 4420c3b0c..fe68b18bd 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,3 +1,3 @@ -addSbtPlugin("org.scala-lang.modules" % "scala-module-plugin" % "1.0.8") +addSbtPlugin("org.scala-lang.modules" % "sbt-scala-module" % "1.0.8") addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.16") From a211848a41169953a43238f56bfe6f830ac1e953 Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Mon, 17 Jul 2017 13:42:35 -0400 Subject: [PATCH 157/789] Update sbt-scala-module to 1.0.12 --- project/plugins.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/plugins.sbt b/project/plugins.sbt index fe68b18bd..3a47ab37b 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,3 +1,3 @@ -addSbtPlugin("org.scala-lang.modules" % "sbt-scala-module" % "1.0.8") +addSbtPlugin("org.scala-lang.modules" % "sbt-scala-module" % "1.0.12") addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.16") From 91bd5c4753bb6351bb0d7fcceddce6417c0f9e42 Mon Sep 17 00:00:00 2001 From: Lukas Rytz Date: Mon, 17 Jul 2017 21:43:51 +0200 Subject: [PATCH 158/789] Cleanups in the build --- build.sbt | 56 ++++++++++++++++++++++++++++++++----------------------- 1 file changed, 33 insertions(+), 23 deletions(-) diff --git a/build.sbt b/build.sbt index 85bf1ef87..097f8600d 100644 --- a/build.sbt +++ b/build.sbt @@ -13,43 +13,53 @@ scalaVersionsByJvm in ThisBuild := { lazy val root = project.in(file(".")) .aggregate(xmlJS, xmlJVM) - .settings(publish := {}, publishLocal := {}) + .settings(disablePublishing) lazy val xml = crossProject.in(file(".")) + .settings(scalaModuleSettings) + .jvmSettings(scalaModuleSettingsJVM) .settings( name := "scala-xml", version := "1.0.7-SNAPSHOT", + scalacOptions ++= "-deprecation:false -feature -Xlint:-stars-align,-nullary-unit,_".split("\\s+").to[Seq], scalacOptions in Test += "-Xxml:coalescing", + apiMappings ++= Map( scalaInstance.value.libraryJar -> url(s"http://www.scala-lang.org/api/${scalaVersion.value}/"), // http://stackoverflow.com/questions/16934488 file(System.getProperty("sun.boot.class.path").split(java.io.File.pathSeparator).filter(_.endsWith(java.io.File.separator + "rt.jar")).head) -> url("http://docs.oracle.com/javase/8/docs/api") - ) - ) + ), + + mimaBinaryIssueFilters ++= { + import com.typesafe.tools.mima.core._ + import com.typesafe.tools.mima.core.ProblemFilters._ + Seq( + // Scala 2.12 deprecated mutable.Stack, so we broke + // binary compatability for 1.0.7 in the following way: + exclude[IncompatibleMethTypeProblem]("scala.xml.parsing.FactoryAdapter.scopeStack_="), + exclude[IncompatibleResultTypeProblem]("scala.xml.parsing.FactoryAdapter.hStack"), + exclude[IncompatibleResultTypeProblem]("scala.xml.parsing.FactoryAdapter.scopeStack"), + exclude[IncompatibleResultTypeProblem]("scala.xml.parsing.FactoryAdapter.attribStack"), + exclude[IncompatibleResultTypeProblem]("scala.xml.parsing.FactoryAdapter.tagStack") + ) + }) .jvmSettings( - scalaModuleSettings ++ - List( - OsgiKeys.exportPackage := Seq(s"scala.xml.*;version=${version.value}"), - libraryDependencies += "junit" % "junit" % "4.11" % "test", - libraryDependencies += "com.novocode" % "junit-interface" % "0.10" % "test", - libraryDependencies += ("org.scala-lang" % "scala-compiler" % scalaVersion.value % "test").exclude("org.scala-lang.modules", s"scala-xml_${scalaVersion.value}"), - mimaBinaryIssueFilters ++= { - import com.typesafe.tools.mima.core._ - import com.typesafe.tools.mima.core.ProblemFilters._ - Seq( - // Scala 2.12 deprecated mutable.Stack, so we broke - // binary compatability for 1.0.7 in the following way: - exclude[IncompatibleMethTypeProblem]("scala.xml.parsing.FactoryAdapter.scopeStack_="), - exclude[IncompatibleResultTypeProblem]("scala.xml.parsing.FactoryAdapter.hStack"), - exclude[IncompatibleResultTypeProblem]("scala.xml.parsing.FactoryAdapter.scopeStack"), - exclude[IncompatibleResultTypeProblem]("scala.xml.parsing.FactoryAdapter.attribStack"), - exclude[IncompatibleResultTypeProblem]("scala.xml.parsing.FactoryAdapter.tagStack") - ) - }, - mimaPreviousVersion := Some("1.0.6")): _*) + OsgiKeys.exportPackage := Seq(s"scala.xml.*;version=${version.value}"), + + // there is currently no previous released JS version, therefore MiMa is enabled only on JVM + mimaPreviousVersion := Some("1.0.6"), + + libraryDependencies += "junit" % "junit" % "4.11" % "test", + libraryDependencies += "com.novocode" % "junit-interface" % "0.10" % "test", + libraryDependencies += ("org.scala-lang" % "scala-compiler" % scalaVersion.value % "test").exclude("org.scala-lang.modules", s"scala-xml_${scalaVersion.value}") + ) + .jsSettings( + // Scala.js cannot run forked tests + fork in Test := false + ) .jsConfigure(_.enablePlugins(ScalaJSJUnitPlugin)) lazy val xmlJVM = xml.jvm From ecfd897738f22c572df3beaeb6f6e549beba3800 Mon Sep 17 00:00:00 2001 From: Joe Barnes Date: Wed, 2 Aug 2017 21:26:19 -0500 Subject: [PATCH 159/789] Added two failing tests for serialization --- .../scala/scala/xml/SerializationTest.scala | 45 +++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 jvm/src/test/scala/scala/xml/SerializationTest.scala diff --git a/jvm/src/test/scala/scala/xml/SerializationTest.scala b/jvm/src/test/scala/scala/xml/SerializationTest.scala new file mode 100644 index 000000000..6a63eae84 --- /dev/null +++ b/jvm/src/test/scala/scala/xml/SerializationTest.scala @@ -0,0 +1,45 @@ +package scala.xml + +import java.io._ + +import org.junit.Assert.assertEquals +import org.junit.Test + +class SerializationTest { + def roundTrip[T](obj: T): T = { + def serialize(in: T): Array[Byte] = { + val bos = new ByteArrayOutputStream() + val oos = new ObjectOutputStream(bos) + oos.writeObject(in) + oos.flush() + bos.toByteArray() + } + + def deserialize(in: Array[Byte]): T = { + val bis = new ByteArrayInputStream(in) + val ois = new ObjectInputStream(bis) + ois.readObject.asInstanceOf[T] + } + + deserialize(serialize(obj)) + } + + @Test + def xmlLiteral: Unit = { + val n = + assertEquals(n, roundTrip(n)) + } + + @Test + def empty: Unit = { + assertEquals(NodeSeq.Empty, roundTrip(NodeSeq.Empty)) + } + + @Test + def implicitConversion: Unit = { + val parent = + val children: Seq[Node] = parent.child + val asNodeSeq: NodeSeq = children + assertEquals(asNodeSeq, roundTrip(asNodeSeq)) + } +} From 52d2a56b59c55e762043e109e66912673ffc6932 Mon Sep 17 00:00:00 2001 From: Joe Barnes Date: Wed, 2 Aug 2017 21:29:08 -0500 Subject: [PATCH 160/789] Added Serializable to the NodeSeq class to resolve issue #154 --- shared/src/main/scala/scala/xml/NodeSeq.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shared/src/main/scala/scala/xml/NodeSeq.scala b/shared/src/main/scala/scala/xml/NodeSeq.scala index c498279e9..7092bb974 100644 --- a/shared/src/main/scala/scala/xml/NodeSeq.scala +++ b/shared/src/main/scala/scala/xml/NodeSeq.scala @@ -42,7 +42,7 @@ object NodeSeq { * @author Burak Emir * @version 1.0 */ -abstract class NodeSeq extends AbstractSeq[Node] with immutable.Seq[Node] with SeqLike[Node, NodeSeq] with Equality { +abstract class NodeSeq extends AbstractSeq[Node] with immutable.Seq[Node] with SeqLike[Node, NodeSeq] with Equality with Serializable { /** Creates a list buffer as builder for this class */ override protected[this] def newBuilder = NodeSeq.newBuilder From 8ba498714d4c453c1b79f0b5c7ea6cae7d1ee6a7 Mon Sep 17 00:00:00 2001 From: Joe Barnes Date: Sat, 5 Aug 2017 23:20:57 -0400 Subject: [PATCH 161/789] Improve wording on stack deprecation --- .../src/main/scala/scala/xml/parsing/FactoryAdapter.scala | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/shared/src/main/scala/scala/xml/parsing/FactoryAdapter.scala b/shared/src/main/scala/scala/xml/parsing/FactoryAdapter.scala index c74754d86..6e83f7d05 100644 --- a/shared/src/main/scala/scala/xml/parsing/FactoryAdapter.scala +++ b/shared/src/main/scala/scala/xml/parsing/FactoryAdapter.scala @@ -40,28 +40,28 @@ abstract class FactoryAdapter extends DefaultHandler with factory.XMLLoader[Node val buffer = new StringBuilder() /** List of attributes * - * Previously was a [[scala.collection.mutable.Stack]], but is now a mutable [[scala.collection.immutable.List]]. + * Previously was a mutable [[scala.collection.mutable.Stack Stack]], but is now a mutable reference to an immutable [[scala.collection.immutable.List List]]. * * @since 1.0.7 */ var attribStack = List.empty[MetaData] /** List of elements * - * Previously was a [[scala.collection.mutable.Stack]], but is now a mutable [[scala.collection.immutable.List]]. + * Previously was a mutable [[scala.collection.mutable.Stack Stack]], but is now a mutable reference to an immutable [[scala.collection.immutable.List List]]. * * @since 1.0.7 */ var hStack = List.empty[Node] // [ element ] contains siblings /** List of element names * - * Previously was a [[scala.collection.mutable.Stack]], but is now a mutable [[scala.collection.immutable.List]]. + * Previously was a mutable [[scala.collection.mutable.Stack Stack]], but is now a mutable reference to an immutable [[scala.collection.immutable.List List]]. * * @since 1.0.7 */ var tagStack = List.empty[String] /** List of namespaces * - * Previously was a [[scala.collection.mutable.Stack]], but is now a mutable [[scala.collection.immutable.List]]. + * Previously was a mutable [[scala.collection.mutable.Stack Stack]], but is now a mutable reference to an immutable [[scala.collection.immutable.List List]]. * * @since 1.0.7 */ From 9cb2c7fdc539fa132c34e3a7b978bf3545b0d4d3 Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Mon, 7 Aug 2017 18:25:00 -0400 Subject: [PATCH 162/789] Dropping mutable.stack will be in 1.1.0 not 1.0.7 --- .../src/main/scala/scala/xml/parsing/FactoryAdapter.scala | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/shared/src/main/scala/scala/xml/parsing/FactoryAdapter.scala b/shared/src/main/scala/scala/xml/parsing/FactoryAdapter.scala index 6e83f7d05..a099c78d3 100644 --- a/shared/src/main/scala/scala/xml/parsing/FactoryAdapter.scala +++ b/shared/src/main/scala/scala/xml/parsing/FactoryAdapter.scala @@ -42,28 +42,28 @@ abstract class FactoryAdapter extends DefaultHandler with factory.XMLLoader[Node * * Previously was a mutable [[scala.collection.mutable.Stack Stack]], but is now a mutable reference to an immutable [[scala.collection.immutable.List List]]. * - * @since 1.0.7 + * @since 1.1.0 */ var attribStack = List.empty[MetaData] /** List of elements * * Previously was a mutable [[scala.collection.mutable.Stack Stack]], but is now a mutable reference to an immutable [[scala.collection.immutable.List List]]. * - * @since 1.0.7 + * @since 1.1.0 */ var hStack = List.empty[Node] // [ element ] contains siblings /** List of element names * * Previously was a mutable [[scala.collection.mutable.Stack Stack]], but is now a mutable reference to an immutable [[scala.collection.immutable.List List]]. * - * @since 1.0.7 + * @since 1.1.0 */ var tagStack = List.empty[String] /** List of namespaces * * Previously was a mutable [[scala.collection.mutable.Stack Stack]], but is now a mutable reference to an immutable [[scala.collection.immutable.List List]]. * - * @since 1.0.7 + * @since 1.1.0 */ var scopeStack = List.empty[NamespaceBinding] From 51ab1c523a27a1bf5b8d1452b37d7e332011c3b0 Mon Sep 17 00:00:00 2001 From: Seth Tisue Date: Thu, 28 Sep 2017 14:26:04 -0700 Subject: [PATCH 163/789] various readme tweaks I wanted to get rid of the JIRA link, but then did extra girl/boy-scouting --- README.md | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index ebec79812..a0c4d66b1 100644 --- a/README.md +++ b/README.md @@ -6,18 +6,21 @@ scala-xml [![Gitter](https://badges.gitter.im/Join+Chat.svg)](https://gitter.im/scala/scala-xml) ========= -The standard Scala XML library. Please file issues here instead of over at issues.scala-lang.org. +The standard Scala XML library. Please file XML issues here, not at https://github.com/scala/bug/issues. Since Scala 2.11, this library is a separate jar that can be omitted from Scala projects that do not use XML. -If you are cross-building a project that uses scala-xml with both Scala 2.10 and later Scala versions, take a look [this example](https://github.com/scala/scala-module-dependency-sample). -The compiler was decoupled from this particular implementation using the same approach as for comprehensions (XML syntax is desugared into a set of method calls, which unfortunately is only defined by the [implementation](https://github.com/scala/scala/blob/2.11.x/src/compiler/scala/tools/nsc/ast/parser/SymbolicXMLBuilder.scala)). Alternative implementations are welcome! +The decoupling works because the compiler desugars XML literals in Scala source code into a set of method calls. Alternative implementations of these calls are welcome! (The calls are unfortunately only defined by the [implementation](https://github.com/scala/scala/blob/2.11.x/src/compiler/scala/tools/nsc/ast/parser/SymbolicXMLBuilder.scala).) API documentation is available [here](http://www.scala-lang.org/api/current/scala-xml/scala/xml/index.html). +## Cross-building with 2.10 + +If you are cross-building a project that uses scala-xml with both Scala 2.10 and later Scala versions, take a look at [this example](https://github.com/scala/scala-module-dependency-sample). + ## Maintenance status -This library is community-maintained. The lead maintainers are [@biswanaths](https://github.com/biswanaths) and [@aaron_s_hawley](https://github.com/ashawley). +This library is community-maintained. The lead maintainers are [@aaron_s_hawley](https://github.com/ashawley) and [@biswanaths](https://github.com/biswanaths). ## Security best practices From cd7fd9cd80fae104ce29aac51d0d84e2ac463e3b Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Mon, 14 Aug 2017 18:46:45 -0400 Subject: [PATCH 164/789] Bump version to 1.1.0 - build.sbt - improve UTF-8 doc note --- build.sbt | 4 ++-- shared/src/main/scala/scala/xml/XML.scala | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/build.sbt b/build.sbt index 097f8600d..55900974b 100644 --- a/build.sbt +++ b/build.sbt @@ -20,7 +20,7 @@ lazy val xml = crossProject.in(file(".")) .jvmSettings(scalaModuleSettingsJVM) .settings( name := "scala-xml", - version := "1.0.7-SNAPSHOT", + version := "1.1.0-SNAPSHOT", scalacOptions ++= "-deprecation:false -feature -Xlint:-stars-align,-nullary-unit,_".split("\\s+").to[Seq], scalacOptions in Test += "-Xxml:coalescing", @@ -38,7 +38,7 @@ lazy val xml = crossProject.in(file(".")) import com.typesafe.tools.mima.core.ProblemFilters._ Seq( // Scala 2.12 deprecated mutable.Stack, so we broke - // binary compatability for 1.0.7 in the following way: + // binary compatibility for 1.1.0 in the following way: exclude[IncompatibleMethTypeProblem]("scala.xml.parsing.FactoryAdapter.scopeStack_="), exclude[IncompatibleResultTypeProblem]("scala.xml.parsing.FactoryAdapter.hStack"), exclude[IncompatibleResultTypeProblem]("scala.xml.parsing.FactoryAdapter.scopeStack"), diff --git a/shared/src/main/scala/scala/xml/XML.scala b/shared/src/main/scala/scala/xml/XML.scala index be1de76a5..96df9c513 100755 --- a/shared/src/main/scala/scala/xml/XML.scala +++ b/shared/src/main/scala/scala/xml/XML.scala @@ -73,7 +73,7 @@ object XML extends XMLLoader[Elem] { * Saves a node to a file with given filename using given encoding * optionally with xmldecl and doctype declaration. * - * Note: default encoding was ISO-8859-1 (latin1) in pre-1.0.7 scala-xml versions. + * Note: Before scala-xml 1.1.0, the default encoding was ISO-8859-1 (latin1). * If your code depends on characters in non-ASCII latin1 range, specify * ISO-8859-1 encoding explicitly. * From b67695ec6444b79ee313427442c34dff1a9131c3 Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Mon, 14 Aug 2017 18:47:51 -0400 Subject: [PATCH 165/789] Increment sbt to 0.13.16 --- project/build.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/build.properties b/project/build.properties index 64317fdae..c091b86ca 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version=0.13.15 +sbt.version=0.13.16 From e176d3ed5763289ff6aa899f2ef6038c2ae7e9c9 Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Thu, 5 Oct 2017 15:55:44 -0400 Subject: [PATCH 166/789] Increment scala compiler to 2.12.3 and 2.13.0-M2 --- build.sbt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build.sbt b/build.sbt index 55900974b..65b248329 100644 --- a/build.sbt +++ b/build.sbt @@ -2,8 +2,8 @@ import ScalaModulePlugin._ scalaVersionsByJvm in ThisBuild := { val v211 = "2.11.11" - val v212 = "2.12.2" - val v213 = "2.13.0-M1" + val v212 = "2.12.3" + val v213 = "2.13.0-M2" Map( 6 -> List(v211 -> true), 7 -> List(v211 -> false), From 25c7dc3e10648c2faeca1f67861912cd377aa2d6 Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Thu, 5 Oct 2017 18:08:09 -0400 Subject: [PATCH 167/789] Update scala-js plugin to 0.6.20 --- project/plugins.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/plugins.sbt b/project/plugins.sbt index 3a47ab37b..76cc17c5c 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,3 +1,3 @@ addSbtPlugin("org.scala-lang.modules" % "sbt-scala-module" % "1.0.12") -addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.16") +addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.20") From 1e8c888613d4928cb19afab90e4f99ab07d58b75 Mon Sep 17 00:00:00 2001 From: Joe Barnes Date: Thu, 3 Aug 2017 12:29:31 -0500 Subject: [PATCH 168/789] Reverting PR #150 --- build.sbt | 17 +---- jvm/src/test/scala/scala/xml/XMLTest.scala | 16 ++--- .../xml/dtd/impl/SubsetConstruction.scala | 9 ++- .../scala/scala/xml/factory/XMLLoader.scala | 4 +- .../scala/xml/include/sax/XIncluder.scala | 11 ++-- .../scala/xml/parsing/FactoryAdapter.scala | 64 +++++-------------- 6 files changed, 39 insertions(+), 82 deletions(-) diff --git a/build.sbt b/build.sbt index 65b248329..4ecf29d24 100644 --- a/build.sbt +++ b/build.sbt @@ -31,21 +31,8 @@ lazy val xml = crossProject.in(file(".")) // http://stackoverflow.com/questions/16934488 file(System.getProperty("sun.boot.class.path").split(java.io.File.pathSeparator).filter(_.endsWith(java.io.File.separator + "rt.jar")).head) -> url("http://docs.oracle.com/javase/8/docs/api") - ), - - mimaBinaryIssueFilters ++= { - import com.typesafe.tools.mima.core._ - import com.typesafe.tools.mima.core.ProblemFilters._ - Seq( - // Scala 2.12 deprecated mutable.Stack, so we broke - // binary compatibility for 1.1.0 in the following way: - exclude[IncompatibleMethTypeProblem]("scala.xml.parsing.FactoryAdapter.scopeStack_="), - exclude[IncompatibleResultTypeProblem]("scala.xml.parsing.FactoryAdapter.hStack"), - exclude[IncompatibleResultTypeProblem]("scala.xml.parsing.FactoryAdapter.scopeStack"), - exclude[IncompatibleResultTypeProblem]("scala.xml.parsing.FactoryAdapter.attribStack"), - exclude[IncompatibleResultTypeProblem]("scala.xml.parsing.FactoryAdapter.tagStack") - ) - }) + ) + ) .jvmSettings( OsgiKeys.exportPackage := Seq(s"scala.xml.*;version=${version.value}"), diff --git a/jvm/src/test/scala/scala/xml/XMLTest.scala b/jvm/src/test/scala/scala/xml/XMLTest.scala index 43dd182e2..ed35b8aaf 100644 --- a/jvm/src/test/scala/scala/xml/XMLTest.scala +++ b/jvm/src/test/scala/scala/xml/XMLTest.scala @@ -40,8 +40,8 @@ class XMLTestJVM { override def text = "" } - assertEquals(c, parsedxml11) - assertEquals(parsedxml1, parsedxml11) + assertTrue(c == parsedxml11) + assertTrue(parsedxml1 == parsedxml11) assertTrue(List(parsedxml1) sameElements List(parsedxml11)) assertTrue(Array(parsedxml1).toList sameElements List(parsedxml11)) @@ -50,10 +50,10 @@ class XMLTestJVM { val i = new InputSource(new StringReader(x2)) val x2p = scala.xml.XML.load(i) - assertEquals(Elem(null, "book", e, sc, + assertTrue(x2p == Elem(null, "book", e, sc, Elem(null, "author", e, sc, Text("Peter Buneman")), Elem(null, "author", e, sc, Text("Dan Suciu")), - Elem(null, "title", e, sc, Text("Data on ze web"))), x2p) + Elem(null, "title", e, sc, Text("Data on ze web")))) } @@ -454,16 +454,16 @@ class XMLTestJVM { @UnitTest def t6939 = { val foo = - assertEquals(foo.child.head.scope.toString, """ xmlns:x="http://bar.com/"""") + assertTrue(foo.child.head.scope.toString == """ xmlns:x="http://bar.com/"""") val fooDefault = - assertEquals(fooDefault.child.head.scope.toString, """ xmlns="http://bar.com/"""") + assertTrue(fooDefault.child.head.scope.toString == """ xmlns="http://bar.com/"""") val foo2 = scala.xml.XML.loadString("""""") - assertEquals(foo2.child.head.scope.toString, """ xmlns:x="http://bar.com/"""") + assertTrue(foo2.child.head.scope.toString == """ xmlns:x="http://bar.com/"""") val foo2Default = scala.xml.XML.loadString("""""") - assertEquals(foo2Default.child.head.scope.toString, """ xmlns="http://bar.com/"""") + assertTrue(foo2Default.child.head.scope.toString == """ xmlns="http://bar.com/"""") } @UnitTest diff --git a/shared/src/main/scala/scala/xml/dtd/impl/SubsetConstruction.scala b/shared/src/main/scala/scala/xml/dtd/impl/SubsetConstruction.scala index b046a34e3..93ca0cfcd 100644 --- a/shared/src/main/scala/scala/xml/dtd/impl/SubsetConstruction.scala +++ b/shared/src/main/scala/scala/xml/dtd/impl/SubsetConstruction.scala @@ -32,9 +32,9 @@ private[dtd] class SubsetConstruction[T <: AnyRef](val nfa: NondetWordAutom[T]) val delta = new mutable.HashMap[immutable.BitSet, mutable.HashMap[T, immutable.BitSet]] var deftrans = mutable.Map(q0 -> sink, sink -> sink) // initial transitions var finals: mutable.Map[immutable.BitSet, Int] = mutable.Map() - var rest = immutable.List.empty[immutable.BitSet] + val rest = new mutable.Stack[immutable.BitSet] - rest = q0 :: sink :: rest + rest.push(sink, q0) def addFinal(q: immutable.BitSet) { if (nfa containsFinal q) @@ -43,7 +43,7 @@ private[dtd] class SubsetConstruction[T <: AnyRef](val nfa: NondetWordAutom[T]) def add(Q: immutable.BitSet) { if (!states(Q)) { states += Q - rest = Q :: rest + rest push Q addFinal(Q) } } @@ -51,8 +51,7 @@ private[dtd] class SubsetConstruction[T <: AnyRef](val nfa: NondetWordAutom[T]) addFinal(q0) // initial state may also be a final state while (!rest.isEmpty) { - val P = rest.head - rest = rest.tail + val P = rest.pop() // assign a number to this bitset indexMap = indexMap.updated(P, ix) invIndexMap = invIndexMap.updated(ix, P) diff --git a/shared/src/main/scala/scala/xml/factory/XMLLoader.scala b/shared/src/main/scala/scala/xml/factory/XMLLoader.scala index e08b41e94..0604282ea 100644 --- a/shared/src/main/scala/scala/xml/factory/XMLLoader.scala +++ b/shared/src/main/scala/scala/xml/factory/XMLLoader.scala @@ -37,9 +37,9 @@ trait XMLLoader[T <: Node] { def loadXML(source: InputSource, parser: SAXParser): T = { val newAdapter = adapter - newAdapter.scopeStack = TopScope :: newAdapter.scopeStack + newAdapter.scopeStack push TopScope parser.parse(source, newAdapter) - newAdapter.scopeStack = newAdapter.scopeStack.tail + newAdapter.scopeStack.pop() newAdapter.rootElem.asInstanceOf[T] } diff --git a/shared/src/main/scala/scala/xml/include/sax/XIncluder.scala b/shared/src/main/scala/scala/xml/include/sax/XIncluder.scala index ec5da7618..ae1cd9dd0 100644 --- a/shared/src/main/scala/scala/xml/include/sax/XIncluder.scala +++ b/shared/src/main/scala/scala/xml/include/sax/XIncluder.scala @@ -10,6 +10,7 @@ package scala package xml package include.sax +import scala.collection.mutable import org.xml.sax.{ ContentHandler, Locator, Attributes } import org.xml.sax.ext.LexicalHandler import java.io.{ OutputStream, OutputStreamWriter, IOException } @@ -125,7 +126,7 @@ class XIncluder(outs: OutputStream, encoding: String) extends ContentHandler wit // LexicalHandler methods private var inDTD: Boolean = false - private var entities = List.empty[String] + private val entities = new mutable.Stack[String]() def startDTD(name: String, publicID: String, systemID: String) { inDTD = true @@ -144,12 +145,12 @@ class XIncluder(outs: OutputStream, encoding: String) extends ContentHandler wit } def endDTD() {} - def startEntity(name: String): Unit = { - entities = name :: entities + def startEntity(name: String) { + entities push name } - def endEntity(name: String): Unit = { - entities = entities.tail + def endEntity(name: String) { + entities.pop() } def startCDATA() {} diff --git a/shared/src/main/scala/scala/xml/parsing/FactoryAdapter.scala b/shared/src/main/scala/scala/xml/parsing/FactoryAdapter.scala index a099c78d3..a8b5c887f 100644 --- a/shared/src/main/scala/scala/xml/parsing/FactoryAdapter.scala +++ b/shared/src/main/scala/scala/xml/parsing/FactoryAdapter.scala @@ -10,6 +10,7 @@ package scala package xml package parsing +import scala.collection.{ mutable, Iterator } import org.xml.sax.Attributes import org.xml.sax.helpers.DefaultHandler @@ -38,34 +39,10 @@ abstract class FactoryAdapter extends DefaultHandler with factory.XMLLoader[Node var rootElem: Node = null val buffer = new StringBuilder() - /** List of attributes - * - * Previously was a mutable [[scala.collection.mutable.Stack Stack]], but is now a mutable reference to an immutable [[scala.collection.immutable.List List]]. - * - * @since 1.1.0 - */ - var attribStack = List.empty[MetaData] - /** List of elements - * - * Previously was a mutable [[scala.collection.mutable.Stack Stack]], but is now a mutable reference to an immutable [[scala.collection.immutable.List List]]. - * - * @since 1.1.0 - */ - var hStack = List.empty[Node] // [ element ] contains siblings - /** List of element names - * - * Previously was a mutable [[scala.collection.mutable.Stack Stack]], but is now a mutable reference to an immutable [[scala.collection.immutable.List List]]. - * - * @since 1.1.0 - */ - var tagStack = List.empty[String] - /** List of namespaces - * - * Previously was a mutable [[scala.collection.mutable.Stack Stack]], but is now a mutable reference to an immutable [[scala.collection.immutable.List List]]. - * - * @since 1.1.0 - */ - var scopeStack = List.empty[NamespaceBinding] + val attribStack = new mutable.Stack[MetaData] + val hStack = new mutable.Stack[Node] // [ element ] contains siblings + val tagStack = new mutable.Stack[String] + var scopeStack = new mutable.Stack[NamespaceBinding] var curTag: String = null var capture: Boolean = false @@ -145,17 +122,17 @@ abstract class FactoryAdapter extends DefaultHandler with factory.XMLLoader[Node attributes: Attributes): Unit = { captureText() - tagStack = curTag :: tagStack + tagStack push curTag curTag = qname val localName = splitName(qname)._2 capture = nodeContainsText(localName) - hStack = null :: hStack + hStack push null var m: MetaData = Null var scpe: NamespaceBinding = if (scopeStack.isEmpty) TopScope - else scopeStack.head + else scopeStack.top for (i <- 0 until attributes.getLength()) { val qname = attributes getQName i @@ -170,8 +147,8 @@ abstract class FactoryAdapter extends DefaultHandler with factory.XMLLoader[Node m = Attribute(Option(pre), key, Text(value), m) } - scopeStack = scpe :: scopeStack - attribStack = m :: attribStack + scopeStack push scpe + attribStack push m } /** @@ -179,7 +156,7 @@ abstract class FactoryAdapter extends DefaultHandler with factory.XMLLoader[Node */ def captureText(): Unit = { if (capture && buffer.length > 0) - hStack = createText(buffer.toString) :: hStack + hStack push createText(buffer.toString) buffer.clear() } @@ -193,24 +170,17 @@ abstract class FactoryAdapter extends DefaultHandler with factory.XMLLoader[Node */ override def endElement(uri: String, _localName: String, qname: String): Unit = { captureText() - val metaData = attribStack.head - attribStack = attribStack.tail + val metaData = attribStack.pop() // reverse order to get it right - val v = hStack.takeWhile(_ != null).reverse - hStack = hStack.dropWhile(_ != null) match { - case null :: hs => hs - case hs => hs - } + val v = (Iterator continually hStack.pop takeWhile (_ != null)).toList.reverse val (pre, localName) = splitName(qname) - val scp = scopeStack.head - scopeStack = scopeStack.tail + val scp = scopeStack.pop() // create element rootElem = createNode(pre, localName, metaData, scp, v) - hStack = rootElem :: hStack - curTag = tagStack.head - tagStack = tagStack.tail + hStack push rootElem + curTag = tagStack.pop() capture = curTag != null && nodeContainsText(curTag) // root level } @@ -219,6 +189,6 @@ abstract class FactoryAdapter extends DefaultHandler with factory.XMLLoader[Node */ override def processingInstruction(target: String, data: String) { captureText() - hStack = hStack.reverse_:::(createProcInstr(target, data).toList) + hStack pushAll createProcInstr(target, data) } } From 1c3169c786545a0e88c035941933a4e09d9bfbdc Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Mon, 16 Oct 2017 15:16:18 -0400 Subject: [PATCH 169/789] Update 2.13.0-M2 badge in README --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index a0c4d66b1..c3783d9ef 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ scala-xml [![Travis](https://img.shields.io/travis/scala/scala-xml.svg)](https://travis-ci.org/scala/scala-xml) [![latest release for 2.11](https://img.shields.io/maven-central/v/org.scala-lang.modules/scala-xml_2.11.svg?label=scala+2.11)](http://mvnrepository.com/artifact/org.scala-lang.modules/scala-xml_2.11) [![latest release for 2.12](https://img.shields.io/maven-central/v/org.scala-lang.modules/scala-xml_2.12.svg?label=scala+2.12)](http://mvnrepository.com/artifact/org.scala-lang.modules/scala-xml_2.12) -[![latest release for 2.13.0-M1](https://img.shields.io/maven-central/v/org.scala-lang.modules/scala-xml_2.13.0-M1.svg?label=scala+2.13.0-M1)](http://mvnrepository.com/artifact/org.scala-lang.modules/scala-xml_2.13.0-M1) +[![latest release for 2.13.0-M2](https://img.shields.io/maven-central/v/org.scala-lang.modules/scala-xml_2.13.0-M2.svg?label=scala+2.13.0-M2)](http://mvnrepository.com/artifact/org.scala-lang.modules/scala-xml_2.13.0-M2) [![Gitter](https://badges.gitter.im/Join+Chat.svg)](https://gitter.im/scala/scala-xml) ========= From 912f2bfed0801eca2a490160cefecdc1f8cfffe3 Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Mon, 16 Oct 2017 15:21:01 -0400 Subject: [PATCH 170/789] Add wiki link to README --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index c3783d9ef..21e24dd3b 100644 --- a/README.md +++ b/README.md @@ -14,6 +14,8 @@ The decoupling works because the compiler desugars XML literals in Scala source API documentation is available [here](http://www.scala-lang.org/api/current/scala-xml/scala/xml/index.html). +How to documentation is available in the [wiki](https://github.com/scala/scala-xml/wiki) + ## Cross-building with 2.10 If you are cross-building a project that uses scala-xml with both Scala 2.10 and later Scala versions, take a look at [this example](https://github.com/scala/scala-module-dependency-sample). From e2d7a2a75945b72c964975e4667297f0e0984bf2 Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Wed, 11 Oct 2017 19:03:03 -0400 Subject: [PATCH 171/789] Add JavaByteSerialization based on SerializationTest --- .../scala/xml/JavaByteSerialization.scala | 23 ++++++++++++++++ .../scala/scala/xml/SerializationTest.scala | 26 +++---------------- 2 files changed, 26 insertions(+), 23 deletions(-) create mode 100644 jvm/src/test/scala/scala/xml/JavaByteSerialization.scala diff --git a/jvm/src/test/scala/scala/xml/JavaByteSerialization.scala b/jvm/src/test/scala/scala/xml/JavaByteSerialization.scala new file mode 100644 index 000000000..401213a49 --- /dev/null +++ b/jvm/src/test/scala/scala/xml/JavaByteSerialization.scala @@ -0,0 +1,23 @@ +package scala.xml + +import java.io._ + +object JavaByteSerialization { + def roundTrip[T](obj: T): T = { + def serialize(in: T): Array[Byte] = { + val bos = new ByteArrayOutputStream() + val oos = new ObjectOutputStream(bos) + oos.writeObject(in) + oos.flush() + bos.toByteArray() + } + + def deserialize(in: Array[Byte]): T = { + val bis = new ByteArrayInputStream(in) + val ois = new ObjectInputStream(bis) + ois.readObject.asInstanceOf[T] + } + + deserialize(serialize(obj)) + } +} diff --git a/jvm/src/test/scala/scala/xml/SerializationTest.scala b/jvm/src/test/scala/scala/xml/SerializationTest.scala index 6a63eae84..0bea7e43d 100644 --- a/jvm/src/test/scala/scala/xml/SerializationTest.scala +++ b/jvm/src/test/scala/scala/xml/SerializationTest.scala @@ -1,38 +1,18 @@ package scala.xml -import java.io._ - import org.junit.Assert.assertEquals import org.junit.Test class SerializationTest { - def roundTrip[T](obj: T): T = { - def serialize(in: T): Array[Byte] = { - val bos = new ByteArrayOutputStream() - val oos = new ObjectOutputStream(bos) - oos.writeObject(in) - oos.flush() - bos.toByteArray() - } - - def deserialize(in: Array[Byte]): T = { - val bis = new ByteArrayInputStream(in) - val ois = new ObjectInputStream(bis) - ois.readObject.asInstanceOf[T] - } - - deserialize(serialize(obj)) - } - @Test def xmlLiteral: Unit = { val n = - assertEquals(n, roundTrip(n)) + assertEquals(n, JavaByteSerialization.roundTrip(n)) } @Test def empty: Unit = { - assertEquals(NodeSeq.Empty, roundTrip(NodeSeq.Empty)) + assertEquals(NodeSeq.Empty, JavaByteSerialization.roundTrip(NodeSeq.Empty)) } @Test @@ -40,6 +20,6 @@ class SerializationTest { val parent = val children: Seq[Node] = parent.child val asNodeSeq: NodeSeq = children - assertEquals(asNodeSeq, roundTrip(asNodeSeq)) + assertEquals(asNodeSeq, JavaByteSerialization.roundTrip(asNodeSeq)) } } From 830b8b9020c8d3c6f2e5016ec5a641e11bf50cb6 Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Wed, 11 Oct 2017 19:18:33 -0400 Subject: [PATCH 172/789] Make serialization test methods available --- .../scala/xml/JavaByteSerialization.scala | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/jvm/src/test/scala/scala/xml/JavaByteSerialization.scala b/jvm/src/test/scala/scala/xml/JavaByteSerialization.scala index 401213a49..c8fc145b9 100644 --- a/jvm/src/test/scala/scala/xml/JavaByteSerialization.scala +++ b/jvm/src/test/scala/scala/xml/JavaByteSerialization.scala @@ -4,20 +4,20 @@ import java.io._ object JavaByteSerialization { def roundTrip[T](obj: T): T = { - def serialize(in: T): Array[Byte] = { - val bos = new ByteArrayOutputStream() - val oos = new ObjectOutputStream(bos) - oos.writeObject(in) - oos.flush() - bos.toByteArray() - } + deserialize[T](serialize[T](obj)) + } - def deserialize(in: Array[Byte]): T = { - val bis = new ByteArrayInputStream(in) - val ois = new ObjectInputStream(bis) - ois.readObject.asInstanceOf[T] - } + def serialize[T](in: T): Array[Byte] = { + val bos = new ByteArrayOutputStream() + val oos = new ObjectOutputStream(bos) + oos.writeObject(in) + oos.flush() + bos.toByteArray() + } - deserialize(serialize(obj)) + def deserialize[T](in: Array[Byte]): T = { + val bis = new ByteArrayInputStream(in) + val ois = new ObjectInputStream(bis) + ois.readObject.asInstanceOf[T] } } From 01253265e4ee49c3022d13dd4a216e832bbc581d Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Wed, 11 Oct 2017 21:42:16 -0400 Subject: [PATCH 173/789] Add base64 to JavaByteSerialization --- jvm/src/test/scala/scala/xml/JavaByteSerialization.scala | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/jvm/src/test/scala/scala/xml/JavaByteSerialization.scala b/jvm/src/test/scala/scala/xml/JavaByteSerialization.scala index c8fc145b9..0e1acddf4 100644 --- a/jvm/src/test/scala/scala/xml/JavaByteSerialization.scala +++ b/jvm/src/test/scala/scala/xml/JavaByteSerialization.scala @@ -1,6 +1,7 @@ package scala.xml import java.io._ +import java.util.Base64 object JavaByteSerialization { def roundTrip[T](obj: T): T = { @@ -20,4 +21,12 @@ object JavaByteSerialization { val ois = new ObjectInputStream(bis) ois.readObject.asInstanceOf[T] } + + def base64Encode[T](in: T): String = { + Base64.getEncoder.encodeToString(serialize[T](in)) + } + + def base64Decode[T](in: String): T = { + deserialize[T](Base64.getDecoder.decode(in)) + } } From cf74f331eb87ee637c1e1e4d2f8fa7eb5d3335c5 Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Wed, 11 Oct 2017 21:42:53 -0400 Subject: [PATCH 174/789] Add an XPath and a base64 test of serialization --- jvm/src/test/scala/scala/xml/SerializationTest.scala | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/jvm/src/test/scala/scala/xml/SerializationTest.scala b/jvm/src/test/scala/scala/xml/SerializationTest.scala index 0bea7e43d..eb8f716ea 100644 --- a/jvm/src/test/scala/scala/xml/SerializationTest.scala +++ b/jvm/src/test/scala/scala/xml/SerializationTest.scala @@ -15,6 +15,11 @@ class SerializationTest { assertEquals(NodeSeq.Empty, JavaByteSerialization.roundTrip(NodeSeq.Empty)) } + @Test + def unmatched: Unit = { + assertEquals(NodeSeq.Empty, JavaByteSerialization.roundTrip( \ "HTML")) + } + @Test def implicitConversion: Unit = { val parent = @@ -22,4 +27,11 @@ class SerializationTest { val asNodeSeq: NodeSeq = children assertEquals(asNodeSeq, JavaByteSerialization.roundTrip(asNodeSeq)) } + + @Test + def base64Encode: Unit = { + val str = JavaByteSerialization.base64Encode(NodeSeq.Empty) + assertEquals("rO0ABXNy", str.take(8)) + assertEquals("AHhweA==", str.takeRight(8)) + } } From 1f93e3cfbbfb1a61c7805987994b6f062fa831e1 Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Thu, 12 Oct 2017 09:31:54 -0400 Subject: [PATCH 175/789] Add test dependency Apache commons-lang3 --- build.sbt | 1 + 1 file changed, 1 insertion(+) diff --git a/build.sbt b/build.sbt index 4ecf29d24..5757d2c10 100644 --- a/build.sbt +++ b/build.sbt @@ -41,6 +41,7 @@ lazy val xml = crossProject.in(file(".")) libraryDependencies += "junit" % "junit" % "4.11" % "test", libraryDependencies += "com.novocode" % "junit-interface" % "0.10" % "test", + libraryDependencies += "org.apache.commons" % "commons-lang3" % "3.6" % "test", libraryDependencies += ("org.scala-lang" % "scala-compiler" % scalaVersion.value % "test").exclude("org.scala-lang.modules", s"scala-xml_${scalaVersion.value}") ) .jsSettings( From e443d2c9dd574da0d614e3d3a05a43354d1674c7 Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Thu, 12 Oct 2017 09:37:58 -0400 Subject: [PATCH 176/789] Use SerializationUtils from apache.commons.lang3 --- .../scala/xml/JavaByteSerialization.scala | 25 ++++++++----------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/jvm/src/test/scala/scala/xml/JavaByteSerialization.scala b/jvm/src/test/scala/scala/xml/JavaByteSerialization.scala index 0e1acddf4..2d9f286d0 100644 --- a/jvm/src/test/scala/scala/xml/JavaByteSerialization.scala +++ b/jvm/src/test/scala/scala/xml/JavaByteSerialization.scala @@ -1,32 +1,27 @@ package scala.xml -import java.io._ +import java.io.Serializable import java.util.Base64 +import org.apache.commons.lang3.SerializationUtils object JavaByteSerialization { - def roundTrip[T](obj: T): T = { - deserialize[T](serialize[T](obj)) + def roundTrip[T <: Serializable](obj: T): T = { + SerializationUtils.roundtrip(obj) } - def serialize[T](in: T): Array[Byte] = { - val bos = new ByteArrayOutputStream() - val oos = new ObjectOutputStream(bos) - oos.writeObject(in) - oos.flush() - bos.toByteArray() + def serialize[T <: Serializable](in: T): Array[Byte] = { + SerializationUtils.serialize(in) } - def deserialize[T](in: Array[Byte]): T = { - val bis = new ByteArrayInputStream(in) - val ois = new ObjectInputStream(bis) - ois.readObject.asInstanceOf[T] + def deserialize[T <: Serializable](in: Array[Byte]): T = { + SerializationUtils.deserialize(in) } - def base64Encode[T](in: T): String = { + def base64Encode[T <: Serializable](in: T): String = { Base64.getEncoder.encodeToString(serialize[T](in)) } - def base64Decode[T](in: String): T = { + def base64Decode[T <: Serializable](in: String): T = { deserialize[T](Base64.getDecoder.decode(in)) } } From 3a3767064c0da8cf67aa7c9f22bb073cc7bf5c1b Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Thu, 19 Oct 2017 09:22:28 -0400 Subject: [PATCH 177/789] Add apt package for openjdk6 --- .travis.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.travis.yml b/.travis.yml index 0493fb4cc..9fce93b77 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,6 +14,11 @@ env: script: admin/build.sh +addons: + apt: + packages: + - openjdk-6-jdk + jdk: - openjdk6 - oraclejdk8 From d5265434a67400bd0a60b14ec1993aceecb92475 Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Thu, 19 Oct 2017 10:08:25 -0400 Subject: [PATCH 178/789] Delete base64 testing that fails in Java 6 --- jvm/src/test/scala/scala/xml/JavaByteSerialization.scala | 9 --------- jvm/src/test/scala/scala/xml/SerializationTest.scala | 7 ------- 2 files changed, 16 deletions(-) diff --git a/jvm/src/test/scala/scala/xml/JavaByteSerialization.scala b/jvm/src/test/scala/scala/xml/JavaByteSerialization.scala index 2d9f286d0..af88381cc 100644 --- a/jvm/src/test/scala/scala/xml/JavaByteSerialization.scala +++ b/jvm/src/test/scala/scala/xml/JavaByteSerialization.scala @@ -1,7 +1,6 @@ package scala.xml import java.io.Serializable -import java.util.Base64 import org.apache.commons.lang3.SerializationUtils object JavaByteSerialization { @@ -16,12 +15,4 @@ object JavaByteSerialization { def deserialize[T <: Serializable](in: Array[Byte]): T = { SerializationUtils.deserialize(in) } - - def base64Encode[T <: Serializable](in: T): String = { - Base64.getEncoder.encodeToString(serialize[T](in)) - } - - def base64Decode[T <: Serializable](in: String): T = { - deserialize[T](Base64.getDecoder.decode(in)) - } } diff --git a/jvm/src/test/scala/scala/xml/SerializationTest.scala b/jvm/src/test/scala/scala/xml/SerializationTest.scala index eb8f716ea..d3f4eb754 100644 --- a/jvm/src/test/scala/scala/xml/SerializationTest.scala +++ b/jvm/src/test/scala/scala/xml/SerializationTest.scala @@ -27,11 +27,4 @@ class SerializationTest { val asNodeSeq: NodeSeq = children assertEquals(asNodeSeq, JavaByteSerialization.roundTrip(asNodeSeq)) } - - @Test - def base64Encode: Unit = { - val str = JavaByteSerialization.base64Encode(NodeSeq.Empty) - assertEquals("rO0ABXNy", str.take(8)) - assertEquals("AHhweA==", str.takeRight(8)) - } } From 03f5a93f164b71ab3ff091bde9df76c371685c7f Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Thu, 19 Oct 2017 11:17:25 -0400 Subject: [PATCH 179/789] Downgrade Apache commons-lang3 to fix Java 6 --- build.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index 5757d2c10..572b09969 100644 --- a/build.sbt +++ b/build.sbt @@ -41,7 +41,7 @@ lazy val xml = crossProject.in(file(".")) libraryDependencies += "junit" % "junit" % "4.11" % "test", libraryDependencies += "com.novocode" % "junit-interface" % "0.10" % "test", - libraryDependencies += "org.apache.commons" % "commons-lang3" % "3.6" % "test", + libraryDependencies += "org.apache.commons" % "commons-lang3" % "3.5" % "test", libraryDependencies += ("org.scala-lang" % "scala-compiler" % scalaVersion.value % "test").exclude("org.scala-lang.modules", s"scala-xml_${scalaVersion.value}") ) .jsSettings( From 58ff98bb6b842cbb98d3207ee6525899e206cf48 Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Thu, 19 Oct 2017 15:29:24 -0400 Subject: [PATCH 180/789] Downgrade Scala.js to 0.6.19 to fix Java 6 --- project/plugins.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/plugins.sbt b/project/plugins.sbt index 76cc17c5c..5b07efadc 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,3 +1,3 @@ addSbtPlugin("org.scala-lang.modules" % "sbt-scala-module" % "1.0.12") -addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.20") +addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.19") From 3eb5453ef81bedf184417c0b136b9602cd07b6e1 Mon Sep 17 00:00:00 2001 From: Andrew W Date: Tue, 7 Nov 2017 16:56:50 +1100 Subject: [PATCH 181/789] Spelling fix --- shared/src/main/scala/scala/xml/Node.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shared/src/main/scala/scala/xml/Node.scala b/shared/src/main/scala/scala/xml/Node.scala index 96f6d0ce3..31afe3141 100755 --- a/shared/src/main/scala/scala/xml/Node.scala +++ b/shared/src/main/scala/scala/xml/Node.scala @@ -123,7 +123,7 @@ abstract class Node extends NodeSeq { child.toList.flatMap { x => x :: x.descendant } /** - * Descendant axis (all descendants of this node, including thisa node) + * Descendant axis (all descendants of this node, including this node) * includes all text nodes, element nodes, comments and processing instructions. */ def descendant_or_self: List[Node] = this :: descendant From d810bbf68afc4287904b23a5a6c0d9c3f7333532 Mon Sep 17 00:00:00 2001 From: shado23 Date: Thu, 16 Nov 2017 19:08:06 +0100 Subject: [PATCH 182/789] Use a ThreadLocal to allow reusing parser instances Currently scala-xml creates a new SAXParser instance every time. This is not very good for performance, but explained by the fact that SAXParser is not thread safe. We can greatly increase performance by using a ThreadLocal, giving each thread their own instance. --- .../scala/scala/xml/factory/XMLLoader.scala | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/shared/src/main/scala/scala/xml/factory/XMLLoader.scala b/shared/src/main/scala/scala/xml/factory/XMLLoader.scala index 0604282ea..c759e599e 100644 --- a/shared/src/main/scala/scala/xml/factory/XMLLoader.scala +++ b/shared/src/main/scala/scala/xml/factory/XMLLoader.scala @@ -23,13 +23,18 @@ trait XMLLoader[T <: Node] { import scala.xml.Source._ def adapter: FactoryAdapter = new NoBindingFactoryAdapter() - /* Override this to use a different SAXParser. */ - def parser: SAXParser = { - val f = SAXParserFactory.newInstance() - f.setNamespaceAware(false) - f.newSAXParser() + private lazy val parserInstance = new ThreadLocal[SAXParser] { + override def initialValue = { + val parser = SAXParserFactory.newInstance() + + parser.setNamespaceAware(false) + parser.newSAXParser() + } } + /* Override this to use a different SAXParser. */ + def parser: SAXParser = parserInstance.get + /** * Loads XML from the given InputSource, using the supplied parser. * The methods available in scala.xml.XML use the XML parser in the JDK. @@ -58,4 +63,4 @@ trait XMLLoader[T <: Node] { /** Loads XML from the given String. */ def loadString(string: String): T = loadXML(fromString(string), parser) -} +} \ No newline at end of file From 0b6d2f101c9fe806c9151cb054e6fbc4969afda2 Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Mon, 9 Oct 2017 17:49:51 -0400 Subject: [PATCH 183/789] Improve high-level api docs --- shared/src/main/scala/scala/xml/Elem.scala | 11 +++- shared/src/main/scala/scala/xml/Node.scala | 9 ++- .../src/main/scala/scala/xml/dtd/Decl.scala | 11 ++++ shared/src/main/scala/scala/xml/package.scala | 64 +++++++++++++++++++ 4 files changed, 92 insertions(+), 3 deletions(-) diff --git a/shared/src/main/scala/scala/xml/Elem.scala b/shared/src/main/scala/scala/xml/Elem.scala index 37d53bcc4..ae02bfa66 100755 --- a/shared/src/main/scala/scala/xml/Elem.scala +++ b/shared/src/main/scala/scala/xml/Elem.scala @@ -66,8 +66,15 @@ object Elem { } /** - * The case class `Elem` extends the `Node` class, - * providing an immutable data object representing an XML element. + * An immutable data object representing an XML element. + * + * Child elements can be other [[Elem]]s or any one of the other [[Node]] types. + * + * XML attributes are implemented with the [[scala.xml.MetaData]] base + * class. + * + * Optional XML namespace scope is represented by + * [[scala.xml.NamespaceBinding]]. * * @param prefix namespace prefix (may be null, but not the empty string) * @param label the element name diff --git a/shared/src/main/scala/scala/xml/Node.scala b/shared/src/main/scala/scala/xml/Node.scala index 31afe3141..ac9ab6080 100755 --- a/shared/src/main/scala/scala/xml/Node.scala +++ b/shared/src/main/scala/scala/xml/Node.scala @@ -27,9 +27,16 @@ object Node { } /** - * An abstract class representing XML with nodes of a labelled tree. + * An abstract class representing XML with nodes of a labeled tree. * This class contains an implementation of a subset of XPath for navigation. * + * - [[scala.xml.Comment]] — XML comment + * - [[scala.xml.Elem]] — XML element + * - [[scala.xml.EntityRef]] — XML entity + * - [[scala.xml.PCData]] — Character data section (CDATA) + * - [[scala.xml.ProcInstr]] — Processing instruction (PI) + * - [[scala.xml.Text]] — Stand-alone parsed character data + * * @author Burak Emir and others * @version 1.1 */ diff --git a/shared/src/main/scala/scala/xml/dtd/Decl.scala b/shared/src/main/scala/scala/xml/dtd/Decl.scala index 94e9e9d23..8c78e5a8e 100644 --- a/shared/src/main/scala/scala/xml/dtd/Decl.scala +++ b/shared/src/main/scala/scala/xml/dtd/Decl.scala @@ -12,6 +12,17 @@ package dtd import Utility.sbToString +/** + * XML declarations + * + * - [[scala.xml.dtd.AttListDecl]] — Attribute list declaration (ATTLIST) + * - [[scala.xml.dtd.AttrDecl]] — Attribute declaration + * - [[scala.xml.dtd.ElemDecl]] — Element declaration (ELEMENT) + * - [[scala.xml.dtd.ParameterEntityDecl]] — Parameter entity list (ENTITY %) + * - [[scala.xml.dtd.ParsedEntityDecl]] — Parsed general entity list (ENTITY) + * - [[scala.xml.dtd.PEReference]] — Parsed entity reference + * - [[scala.xml.dtd.UnparsedEntityDecl]] — Unparsed entity list (ENTITY NDATA) + */ sealed abstract class Decl sealed abstract class MarkupDecl extends Decl { diff --git a/shared/src/main/scala/scala/xml/package.scala b/shared/src/main/scala/scala/xml/package.scala index 18d37cf98..6eacc37d6 100644 --- a/shared/src/main/scala/scala/xml/package.scala +++ b/shared/src/main/scala/scala/xml/package.scala @@ -8,6 +8,70 @@ package scala +/** + * This library provides support for the XML literal syntax in Scala programs. + * {{{ + * val planets: scala.xml.Elem = + * + * Earth + * 5.9742e24 + * 6378.14e3 + * + * + * Mars + * 0.64191e24 + * 3397.0e3 + * + * + * }}} + * + * Additionally, you can mix Scala expressions in your XML elements by + * using the curly brace notation: + * + * {{{ + * val sunMass = 1.99e30 + * val sunRadius = 6.96e8 + * val star = + * Sun + * { sunMass } + * { sunRadius } + * { 4 * Math.PI * Math.pow(sunRadius, 2) } + * { 4/3 * Math.PI * Math.pow(sunRadius, 3) } + * + * }}} + * + * An XML element, for example `` and ``, is + * represented in this library as a case class, [[scala.xml.Elem]]. + * + * The sub-elements of XML values share a common base class, + * [[scala.xml.Node]]. + * + * However, the non-element declarations found in XML files share a + * different common base class, [[scala.xml.dtd.Decl]]. Additionally, + * document type declarations are represented by a different trait, + * [[scala.xml.dtd.DTD]]. + * + * For reading and writing XML data to and from files, see + * [[scala.xml.XML]]. The default parser of XML data is the + * [[http://xerces.apache.org/ Xerces]] parser and is provided in Java + * by [[javax.xml.parsers.SAXParser]]. + * + * A less greedy XML reader can return data as a sequential collection + * of events, see [[scala.xml.pull.XMLEventReader]]. + * + * For more control of the input, use the parser written in Scala that + * is provided, [[scala.xml.parsing.ConstructingParser]]. + * + * For working with XHTML input, use [[scala.xml.parsing.XhtmlParser]]. + * + * For more control of the output, use the [[scala.xml.PrettyPrinter]]. + * + * Utility methods for working with XML data are provided in + * [[scala.xml.Utility]]. + * + * XML values in Scala are immutable, but you can traverse and + * transform XML data with a [[scala.xml.transform.RuleTransformer]]. + */ package object xml { val XercesClassName = "org.apache.xerces.parsers.SAXParser" From 68e21873218757d50ffb5bd9bcfb665ee98cfe00 Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Mon, 9 Oct 2017 17:51:10 -0400 Subject: [PATCH 184/789] Remove out-of-date version from docs --- shared/src/main/scala/scala/xml/Attribute.scala | 2 -- shared/src/main/scala/scala/xml/Document.scala | 1 - shared/src/main/scala/scala/xml/EntityRef.scala | 1 - shared/src/main/scala/scala/xml/Group.scala | 1 - shared/src/main/scala/scala/xml/NamespaceBinding.scala | 1 - shared/src/main/scala/scala/xml/Node.scala | 2 -- shared/src/main/scala/scala/xml/NodeBuffer.scala | 1 - shared/src/main/scala/scala/xml/NodeSeq.scala | 2 -- shared/src/main/scala/scala/xml/Null.scala | 1 - shared/src/main/scala/scala/xml/PCData.scala | 2 -- shared/src/main/scala/scala/xml/PrettyPrinter.scala | 2 -- shared/src/main/scala/scala/xml/QNode.scala | 1 - shared/src/main/scala/scala/xml/Text.scala | 1 - shared/src/main/scala/scala/xml/Unparsed.scala | 1 - shared/src/main/scala/scala/xml/XML.scala | 1 - shared/src/main/scala/scala/xml/dtd/impl/Base.scala | 1 - shared/src/main/scala/scala/xml/dtd/impl/DetWordAutom.scala | 1 - shared/src/main/scala/scala/xml/dtd/impl/Inclusion.scala | 1 - .../src/main/scala/scala/xml/dtd/impl/PointedHedgeExp.scala | 1 - shared/src/main/scala/scala/xml/dtd/impl/SyntaxError.scala | 1 - shared/src/main/scala/scala/xml/dtd/impl/WordBerrySethi.scala | 1 - shared/src/main/scala/scala/xml/dtd/impl/WordExp.scala | 1 - .../src/main/scala/scala/xml/factory/LoggedNodeFactory.scala | 1 - .../main/scala/scala/xml/parsing/ConstructingHandler.scala | 1 - shared/src/main/scala/scala/xml/parsing/ExternalSources.scala | 1 - shared/src/main/scala/scala/xml/parsing/MarkupHandler.scala | 4 +--- shared/src/main/scala/scala/xml/parsing/MarkupParser.scala | 1 - .../src/main/scala/scala/xml/transform/BasicTransformer.scala | 1 - shared/src/main/scala/scala/xml/transform/RewriteRule.scala | 1 - 29 files changed, 1 insertion(+), 36 deletions(-) diff --git a/shared/src/main/scala/scala/xml/Attribute.scala b/shared/src/main/scala/scala/xml/Attribute.scala index c31c430f6..4c3fd62e8 100644 --- a/shared/src/main/scala/scala/xml/Attribute.scala +++ b/shared/src/main/scala/scala/xml/Attribute.scala @@ -14,7 +14,6 @@ package xml * convenient construction and deconstruction. * * @author Burak Emir - * @version 1.0 */ object Attribute { def unapply(x: Attribute) = x match { @@ -47,7 +46,6 @@ object Attribute { * [[scala.xml.PrefixedAttribute]] and [[scala.xml.UnprefixedAttribute]]. * * @author Burak Emir - * @version 1.0 */ abstract trait Attribute extends MetaData { def pre: String // will be null if unprefixed diff --git a/shared/src/main/scala/scala/xml/Document.scala b/shared/src/main/scala/scala/xml/Document.scala index a6a9a4f69..f6c077468 100644 --- a/shared/src/main/scala/scala/xml/Document.scala +++ b/shared/src/main/scala/scala/xml/Document.scala @@ -16,7 +16,6 @@ package xml * Also plays the role of an `XMLEvent` for pull parsing. * * @author Burak Emir - * @version 1.0, 26/04/2005 */ @SerialVersionUID(-2289320563321795109L) class Document extends NodeSeq with pull.XMLEvent with Serializable { diff --git a/shared/src/main/scala/scala/xml/EntityRef.scala b/shared/src/main/scala/scala/xml/EntityRef.scala index 0d31591ba..55846a4db 100644 --- a/shared/src/main/scala/scala/xml/EntityRef.scala +++ b/shared/src/main/scala/scala/xml/EntityRef.scala @@ -13,7 +13,6 @@ package xml * The class `EntityRef` implements an XML node for entity references. * * @author Burak Emir - * @version 1.0 * @param entityName the name of the entity reference, for example `amp`. */ case class EntityRef(entityName: String) extends SpecialNode { diff --git a/shared/src/main/scala/scala/xml/Group.scala b/shared/src/main/scala/scala/xml/Group.scala index 8691ae54e..1b9ff7608 100644 --- a/shared/src/main/scala/scala/xml/Group.scala +++ b/shared/src/main/scala/scala/xml/Group.scala @@ -13,7 +13,6 @@ package xml * A hack to group XML nodes in one node for output. * * @author Burak Emir - * @version 1.0 */ final case class Group(nodes: Seq[Node]) extends Node { override def theSeq = nodes diff --git a/shared/src/main/scala/scala/xml/NamespaceBinding.scala b/shared/src/main/scala/scala/xml/NamespaceBinding.scala index 6a5fb174a..419be451e 100644 --- a/shared/src/main/scala/scala/xml/NamespaceBinding.scala +++ b/shared/src/main/scala/scala/xml/NamespaceBinding.scala @@ -18,7 +18,6 @@ import Utility.sbToString * prefix nor uri may be empty, which is not checked. * * @author Burak Emir - * @version 1.0 */ @SerialVersionUID(0 - 2518644165573446725L) case class NamespaceBinding(prefix: String, uri: String, parent: NamespaceBinding) extends AnyRef with Equality { diff --git a/shared/src/main/scala/scala/xml/Node.scala b/shared/src/main/scala/scala/xml/Node.scala index ac9ab6080..5431efb5d 100755 --- a/shared/src/main/scala/scala/xml/Node.scala +++ b/shared/src/main/scala/scala/xml/Node.scala @@ -14,7 +14,6 @@ package xml * convenient deconstruction. * * @author Burak Emir - * @version 1.0 */ object Node { /** the constant empty attribute sequence */ @@ -38,7 +37,6 @@ object Node { * - [[scala.xml.Text]] — Stand-alone parsed character data * * @author Burak Emir and others - * @version 1.1 */ abstract class Node extends NodeSeq { diff --git a/shared/src/main/scala/scala/xml/NodeBuffer.scala b/shared/src/main/scala/scala/xml/NodeBuffer.scala index 6362f57ec..0a27aa818 100644 --- a/shared/src/main/scala/scala/xml/NodeBuffer.scala +++ b/shared/src/main/scala/scala/xml/NodeBuffer.scala @@ -18,7 +18,6 @@ package xml * Calling the hashcode function will result in a runtime error. * * @author Burak Emir - * @version 1.0 */ class NodeBuffer extends scala.collection.mutable.ArrayBuffer[Node] { diff --git a/shared/src/main/scala/scala/xml/NodeSeq.scala b/shared/src/main/scala/scala/xml/NodeSeq.scala index 7092bb974..cd6957127 100644 --- a/shared/src/main/scala/scala/xml/NodeSeq.scala +++ b/shared/src/main/scala/scala/xml/NodeSeq.scala @@ -18,7 +18,6 @@ import scala.language.implicitConversions * This object ... * * @author Burak Emir - * @version 1.0 */ object NodeSeq { final val Empty = fromSeq(Nil) @@ -40,7 +39,6 @@ object NodeSeq { * and comprehension methods. * * @author Burak Emir - * @version 1.0 */ abstract class NodeSeq extends AbstractSeq[Node] with immutable.Seq[Node] with SeqLike[Node, NodeSeq] with Equality with Serializable { diff --git a/shared/src/main/scala/scala/xml/Null.scala b/shared/src/main/scala/scala/xml/Null.scala index 46243f69d..a557ff630 100644 --- a/shared/src/main/scala/scala/xml/Null.scala +++ b/shared/src/main/scala/scala/xml/Null.scala @@ -18,7 +18,6 @@ import scala.collection.Iterator * sort of a linked list of tails. * * @author Burak Emir - * @version 1.0 */ case object Null extends MetaData { override def iterator = Iterator.empty diff --git a/shared/src/main/scala/scala/xml/PCData.scala b/shared/src/main/scala/scala/xml/PCData.scala index 5b6546e8e..f44931733 100644 --- a/shared/src/main/scala/scala/xml/PCData.scala +++ b/shared/src/main/scala/scala/xml/PCData.scala @@ -15,7 +15,6 @@ package xml * sections in the input and is to be preserved as CDATA section in the output. * * @author Burak Emir - * @version 1.0 */ class PCData(data: String) extends Atom[String](data) { @@ -35,7 +34,6 @@ class PCData(data: String) extends Atom[String](data) { * convenient construction and deconstruction. * * @author Burak Emir - * @version 1.0 */ object PCData { def apply(data: String) = new PCData(data) diff --git a/shared/src/main/scala/scala/xml/PrettyPrinter.scala b/shared/src/main/scala/scala/xml/PrettyPrinter.scala index 2da75a160..4a481ce59 100755 --- a/shared/src/main/scala/scala/xml/PrettyPrinter.scala +++ b/shared/src/main/scala/scala/xml/PrettyPrinter.scala @@ -18,8 +18,6 @@ import Utility.sbToString * XML nodes. * * @author Burak Emir - * @version 1.0 - * * @param width the width to fit the output into * @param step indentation */ diff --git a/shared/src/main/scala/scala/xml/QNode.scala b/shared/src/main/scala/scala/xml/QNode.scala index 0ec3c7cc6..f5cb2428d 100644 --- a/shared/src/main/scala/scala/xml/QNode.scala +++ b/shared/src/main/scala/scala/xml/QNode.scala @@ -14,7 +14,6 @@ package xml * its namespace URI * * @author Burak Emir - * @version 1.0 */ object QNode { def unapplySeq(n: Node) = Some((n.scope.getURI(n.prefix), n.label, n.attributes, n.child)) diff --git a/shared/src/main/scala/scala/xml/Text.scala b/shared/src/main/scala/scala/xml/Text.scala index 6240e418a..6986b6f03 100644 --- a/shared/src/main/scala/scala/xml/Text.scala +++ b/shared/src/main/scala/scala/xml/Text.scala @@ -31,7 +31,6 @@ class Text(data: String) extends Atom[String](data) { * convenient construction and deconstruction. * * @author Burak Emir - * @version 1.0 */ object Text { def apply(data: String) = new Text(data) diff --git a/shared/src/main/scala/scala/xml/Unparsed.scala b/shared/src/main/scala/scala/xml/Unparsed.scala index 20141076b..1c1061834 100644 --- a/shared/src/main/scala/scala/xml/Unparsed.scala +++ b/shared/src/main/scala/scala/xml/Unparsed.scala @@ -31,7 +31,6 @@ class Unparsed(data: String) extends Atom[String](data) { * convenient construction and deconstruction. * * @author Burak Emir - * @version 1.0 */ object Unparsed { def apply(data: String) = new Unparsed(data) diff --git a/shared/src/main/scala/scala/xml/XML.scala b/shared/src/main/scala/scala/xml/XML.scala index 96df9c513..70630e31d 100755 --- a/shared/src/main/scala/scala/xml/XML.scala +++ b/shared/src/main/scala/scala/xml/XML.scala @@ -54,7 +54,6 @@ object MinimizeMode extends Enumeration { * when XML is handled using `Symbol` nodes. * * @author Burak Emir - * @version 1.0, 25/04/2005 */ object XML extends XMLLoader[Elem] { val xml = "xml" diff --git a/shared/src/main/scala/scala/xml/dtd/impl/Base.scala b/shared/src/main/scala/scala/xml/dtd/impl/Base.scala index 62f20531e..946df40b7 100644 --- a/shared/src/main/scala/scala/xml/dtd/impl/Base.scala +++ b/shared/src/main/scala/scala/xml/dtd/impl/Base.scala @@ -13,7 +13,6 @@ package xml.dtd.impl * Basic regular expressions. * * @author Burak Emir - * @version 1.0 */ @deprecated("This class will be removed", "2.10.0") diff --git a/shared/src/main/scala/scala/xml/dtd/impl/DetWordAutom.scala b/shared/src/main/scala/scala/xml/dtd/impl/DetWordAutom.scala index 5484b72cd..68be9a37b 100644 --- a/shared/src/main/scala/scala/xml/dtd/impl/DetWordAutom.scala +++ b/shared/src/main/scala/scala/xml/dtd/impl/DetWordAutom.scala @@ -18,7 +18,6 @@ package xml.dtd.impl * the partial function 'finals' is defined. * * @author Burak Emir - * @version 1.0 */ // TODO: still used in ContentModel -- @deprecated("This class will be removed", "2.10.0") private[dtd] abstract class DetWordAutom[T <: AnyRef] { diff --git a/shared/src/main/scala/scala/xml/dtd/impl/Inclusion.scala b/shared/src/main/scala/scala/xml/dtd/impl/Inclusion.scala index ac36bb8cd..71bdb0502 100644 --- a/shared/src/main/scala/scala/xml/dtd/impl/Inclusion.scala +++ b/shared/src/main/scala/scala/xml/dtd/impl/Inclusion.scala @@ -14,7 +14,6 @@ package xml.dtd.impl * inspired by the ''AMoRE automata library''. * * @author Burak Emir - * @version 1.0 */ @deprecated("This class will be removed", "2.10.0") private[dtd] trait Inclusion[A <: AnyRef] { diff --git a/shared/src/main/scala/scala/xml/dtd/impl/PointedHedgeExp.scala b/shared/src/main/scala/scala/xml/dtd/impl/PointedHedgeExp.scala index b18cf60e3..aad4e1531 100644 --- a/shared/src/main/scala/scala/xml/dtd/impl/PointedHedgeExp.scala +++ b/shared/src/main/scala/scala/xml/dtd/impl/PointedHedgeExp.scala @@ -13,7 +13,6 @@ package xml.dtd.impl * Pointed regular hedge expressions, a useful subclass of regular hedge expressions. * * @author Burak Emir - * @version 1.0 */ @deprecated("This class will be removed", "2.10.0") private[dtd] abstract class PointedHedgeExp extends Base { diff --git a/shared/src/main/scala/scala/xml/dtd/impl/SyntaxError.scala b/shared/src/main/scala/scala/xml/dtd/impl/SyntaxError.scala index 13ec44213..5716a84c9 100644 --- a/shared/src/main/scala/scala/xml/dtd/impl/SyntaxError.scala +++ b/shared/src/main/scala/scala/xml/dtd/impl/SyntaxError.scala @@ -14,7 +14,6 @@ package xml.dtd.impl * syntactically incorrect expression is detected. * * @author Burak Emir - * @version 1.0 */ @deprecated("This class will be removed", "2.10.0") private[dtd] class SyntaxError(e: String) extends RuntimeException(e) diff --git a/shared/src/main/scala/scala/xml/dtd/impl/WordBerrySethi.scala b/shared/src/main/scala/scala/xml/dtd/impl/WordBerrySethi.scala index 8ab87daf5..e52a6f9ec 100644 --- a/shared/src/main/scala/scala/xml/dtd/impl/WordBerrySethi.scala +++ b/shared/src/main/scala/scala/xml/dtd/impl/WordBerrySethi.scala @@ -16,7 +16,6 @@ import scala.collection.{ immutable, mutable } * celebrated position automata construction (also called ''Berry-Sethi'' or ''Glushkov''). * * @author Burak Emir - * @version 1.0 */ // TODO: still used in ContentModel -- @deprecated("This class will be removed", "2.10.0") @deprecated("This class will be removed", "2.10.0") diff --git a/shared/src/main/scala/scala/xml/dtd/impl/WordExp.scala b/shared/src/main/scala/scala/xml/dtd/impl/WordExp.scala index 23a59433a..664d7cb5e 100644 --- a/shared/src/main/scala/scala/xml/dtd/impl/WordExp.scala +++ b/shared/src/main/scala/scala/xml/dtd/impl/WordExp.scala @@ -35,7 +35,6 @@ package xml.dtd.impl * }}} * * @author Burak Emir - * @version 1.0 */ // TODO: still used in ContentModel -- @deprecated("This class will be removed", "2.10.0") private[dtd] abstract class WordExp extends Base { diff --git a/shared/src/main/scala/scala/xml/factory/LoggedNodeFactory.scala b/shared/src/main/scala/scala/xml/factory/LoggedNodeFactory.scala index 26473b980..cc7e01809 100644 --- a/shared/src/main/scala/scala/xml/factory/LoggedNodeFactory.scala +++ b/shared/src/main/scala/scala/xml/factory/LoggedNodeFactory.scala @@ -28,7 +28,6 @@ package factory * }}} * * @author Burak Emir - * @version 1.0 */ @deprecated("This trait will be removed.", "2.11") trait LoggedNodeFactory[A <: Node] extends NodeFactory[A] { diff --git a/shared/src/main/scala/scala/xml/parsing/ConstructingHandler.scala b/shared/src/main/scala/scala/xml/parsing/ConstructingHandler.scala index a945694b3..cf8adde5b 100755 --- a/shared/src/main/scala/scala/xml/parsing/ConstructingHandler.scala +++ b/shared/src/main/scala/scala/xml/parsing/ConstructingHandler.scala @@ -14,7 +14,6 @@ package parsing * Implementation of MarkupHandler that constructs nodes. * * @author Burak Emir - * @version 1.0 */ abstract class ConstructingHandler extends MarkupHandler { val preserveWS: Boolean diff --git a/shared/src/main/scala/scala/xml/parsing/ExternalSources.scala b/shared/src/main/scala/scala/xml/parsing/ExternalSources.scala index 80707b3b9..89acc5959 100644 --- a/shared/src/main/scala/scala/xml/parsing/ExternalSources.scala +++ b/shared/src/main/scala/scala/xml/parsing/ExternalSources.scala @@ -17,7 +17,6 @@ import scala.io.Source /** * @author Burak Emir - * @version 1.0 */ trait ExternalSources { self: ExternalSources with MarkupParser with MarkupHandler => diff --git a/shared/src/main/scala/scala/xml/parsing/MarkupHandler.scala b/shared/src/main/scala/scala/xml/parsing/MarkupHandler.scala index e8d393984..d94d582b1 100755 --- a/shared/src/main/scala/scala/xml/parsing/MarkupHandler.scala +++ b/shared/src/main/scala/scala/xml/parsing/MarkupHandler.scala @@ -16,11 +16,9 @@ import scala.xml.dtd._ /** * class that handles markup - provides callback methods to MarkupParser. - * the default is nonvalidating behaviour + * the default is nonvalidating behaviour * * @author Burak Emir - * @version 1.0 - * * @todo can we ignore more entity declarations (i.e. those with extIDs)? * @todo expanding entity references */ diff --git a/shared/src/main/scala/scala/xml/parsing/MarkupParser.scala b/shared/src/main/scala/scala/xml/parsing/MarkupParser.scala index a0831249b..4e70d2570 100755 --- a/shared/src/main/scala/scala/xml/parsing/MarkupParser.scala +++ b/shared/src/main/scala/scala/xml/parsing/MarkupParser.scala @@ -25,7 +25,6 @@ import Utility.Escapes.{ pairs => unescape } * collected using side-effects. * * @author Burak Emir - * @version 1.0 */ trait MarkupParser extends MarkupParserCommon with TokenTests { self: MarkupParser with MarkupHandler => diff --git a/shared/src/main/scala/scala/xml/transform/BasicTransformer.scala b/shared/src/main/scala/scala/xml/transform/BasicTransformer.scala index 1fe78e478..528f30eb5 100644 --- a/shared/src/main/scala/scala/xml/transform/BasicTransformer.scala +++ b/shared/src/main/scala/scala/xml/transform/BasicTransformer.scala @@ -14,7 +14,6 @@ package transform * A class for XML transformations. * * @author Burak Emir - * @version 1.0 */ abstract class BasicTransformer extends Function1[Node, Node] { protected def unchanged(n: Node, ns: Seq[Node]) = diff --git a/shared/src/main/scala/scala/xml/transform/RewriteRule.scala b/shared/src/main/scala/scala/xml/transform/RewriteRule.scala index c0b6041de..b960d149a 100644 --- a/shared/src/main/scala/scala/xml/transform/RewriteRule.scala +++ b/shared/src/main/scala/scala/xml/transform/RewriteRule.scala @@ -16,7 +16,6 @@ package transform * is not applied. * * @author Burak Emir - * @version 1.0 */ abstract class RewriteRule extends BasicTransformer { /** a name for this rewrite rule */ From 97e7d7ade1d76489b670428ea17387e84289f999 Mon Sep 17 00:00:00 2001 From: Olaf Tomczak Date: Mon, 29 Jan 2018 15:05:44 +0100 Subject: [PATCH 185/789] Fix ignored stripComments parameter of Utility.serialize --- shared/src/main/scala/scala/xml/Utility.scala | 2 +- shared/src/test/scala/scala/xml/UtilityTest.scala | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/shared/src/main/scala/scala/xml/Utility.scala b/shared/src/main/scala/scala/xml/Utility.scala index 117c62aa4..539bcd5cd 100755 --- a/shared/src/main/scala/scala/xml/Utility.scala +++ b/shared/src/main/scala/scala/xml/Utility.scala @@ -201,7 +201,7 @@ object Utility extends AnyRef with parsing.TokenTests { minimizeTags: MinimizeMode.Value = MinimizeMode.Default): StringBuilder = { x match { - case c: Comment if !stripComments => c buildString sb + case c: Comment => if (!stripComments) c buildString sb; sb case s: SpecialNode => s buildString sb case g: Group => for (c <- g.nodes) serialize(c, g.scope, sb, stripComments, decodeEntities, preserveWhitespace, minimizeTags); sb diff --git a/shared/src/test/scala/scala/xml/UtilityTest.scala b/shared/src/test/scala/scala/xml/UtilityTest.scala index 5c7d39496..eac05075b 100644 --- a/shared/src/test/scala/scala/xml/UtilityTest.scala +++ b/shared/src/test/scala/scala/xml/UtilityTest.scala @@ -56,4 +56,11 @@ class UtilityTest { assertEquals("", Utility.serialize(x, minimizeTags = MinimizeMode.Always).toString) } + @Test + def issue183: Unit = { + val x = + assertEquals("", Utility.serialize(x, stripComments = true).toString) + assertEquals("", Utility.serialize(x, stripComments = false).toString) + } + } From 20782e8bf43f4c027552beb5c9ec1b6e57b4a213 Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Wed, 10 Jan 2018 10:48:04 -0500 Subject: [PATCH 186/789] Fix exclude rule for circular dependency --- build.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index 572b09969..99388d132 100644 --- a/build.sbt +++ b/build.sbt @@ -42,7 +42,7 @@ lazy val xml = crossProject.in(file(".")) libraryDependencies += "junit" % "junit" % "4.11" % "test", libraryDependencies += "com.novocode" % "junit-interface" % "0.10" % "test", libraryDependencies += "org.apache.commons" % "commons-lang3" % "3.5" % "test", - libraryDependencies += ("org.scala-lang" % "scala-compiler" % scalaVersion.value % "test").exclude("org.scala-lang.modules", s"scala-xml_${scalaVersion.value}") + libraryDependencies += ("org.scala-lang" % "scala-compiler" % scalaVersion.value % "test").exclude("org.scala-lang.modules", s"scala-xml_${scalaBinaryVersion.value}") ) .jsSettings( // Scala.js cannot run forked tests From af65cfdad7de0bb25971e424638c0cc47170341b Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Wed, 31 Jan 2018 22:08:46 -0500 Subject: [PATCH 187/789] Increment scala to 2.11.12, 2.12.4 and 2.13.0-M3 --- build.sbt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/build.sbt b/build.sbt index 99388d132..2cacdc18f 100644 --- a/build.sbt +++ b/build.sbt @@ -1,9 +1,9 @@ import ScalaModulePlugin._ scalaVersionsByJvm in ThisBuild := { - val v211 = "2.11.11" - val v212 = "2.12.3" - val v213 = "2.13.0-M2" + val v211 = "2.11.12" + val v212 = "2.12.4" + val v213 = "2.13.0-M3" Map( 6 -> List(v211 -> true), 7 -> List(v211 -> false), From fb4e4e8e6fa195106bc347543f0ddacbfbc3115c Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Wed, 31 Jan 2018 22:23:25 -0500 Subject: [PATCH 188/789] Update scala-js to 0.6.20 to fix 2.13.0-M3 --- project/plugins.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/plugins.sbt b/project/plugins.sbt index 5b07efadc..ddba7a8b5 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,3 +1,3 @@ addSbtPlugin("org.scala-lang.modules" % "sbt-scala-module" % "1.0.12") -addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.19") +addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.22") From ac9f01449c34a963b6f8aa4a597f1a7d8ad4a619 Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Thu, 1 Feb 2018 12:59:39 -0500 Subject: [PATCH 189/789] Update copyright to 2018 --- LICENSE.md | 4 ++-- shared/src/main/scala/scala/xml/Atom.scala | 2 +- shared/src/main/scala/scala/xml/Attribute.scala | 2 +- shared/src/main/scala/scala/xml/Comment.scala | 2 +- shared/src/main/scala/scala/xml/Document.scala | 2 +- shared/src/main/scala/scala/xml/Elem.scala | 2 +- shared/src/main/scala/scala/xml/EntityRef.scala | 2 +- shared/src/main/scala/scala/xml/Equality.scala | 2 +- shared/src/main/scala/scala/xml/Group.scala | 2 +- .../main/scala/scala/xml/MalformedAttributeException.scala | 2 +- shared/src/main/scala/scala/xml/MetaData.scala | 2 +- shared/src/main/scala/scala/xml/NamespaceBinding.scala | 2 +- shared/src/main/scala/scala/xml/Node.scala | 2 +- shared/src/main/scala/scala/xml/NodeBuffer.scala | 2 +- shared/src/main/scala/scala/xml/NodeSeq.scala | 2 +- shared/src/main/scala/scala/xml/Null.scala | 2 +- shared/src/main/scala/scala/xml/PCData.scala | 2 +- shared/src/main/scala/scala/xml/PrefixedAttribute.scala | 2 +- shared/src/main/scala/scala/xml/PrettyPrinter.scala | 2 +- shared/src/main/scala/scala/xml/ProcInstr.scala | 2 +- shared/src/main/scala/scala/xml/QNode.scala | 2 +- shared/src/main/scala/scala/xml/SpecialNode.scala | 2 +- shared/src/main/scala/scala/xml/Text.scala | 2 +- shared/src/main/scala/scala/xml/TextBuffer.scala | 2 +- shared/src/main/scala/scala/xml/TopScope.scala | 2 +- shared/src/main/scala/scala/xml/TypeSymbol.scala | 2 +- shared/src/main/scala/scala/xml/Unparsed.scala | 2 +- shared/src/main/scala/scala/xml/UnprefixedAttribute.scala | 2 +- shared/src/main/scala/scala/xml/Utility.scala | 2 +- shared/src/main/scala/scala/xml/XML.scala | 2 +- shared/src/main/scala/scala/xml/dtd/ContentModel.scala | 2 +- shared/src/main/scala/scala/xml/dtd/ContentModelParser.scala | 2 +- shared/src/main/scala/scala/xml/dtd/DTD.scala | 2 +- shared/src/main/scala/scala/xml/dtd/Decl.scala | 2 +- shared/src/main/scala/scala/xml/dtd/DocType.scala | 2 +- shared/src/main/scala/scala/xml/dtd/ElementValidator.scala | 2 +- shared/src/main/scala/scala/xml/dtd/ExternalID.scala | 2 +- shared/src/main/scala/scala/xml/dtd/Scanner.scala | 2 +- shared/src/main/scala/scala/xml/dtd/Tokens.scala | 2 +- shared/src/main/scala/scala/xml/dtd/ValidationException.scala | 2 +- shared/src/main/scala/scala/xml/dtd/impl/Base.scala | 2 +- shared/src/main/scala/scala/xml/dtd/impl/BaseBerrySethi.scala | 2 +- shared/src/main/scala/scala/xml/dtd/impl/DetWordAutom.scala | 2 +- shared/src/main/scala/scala/xml/dtd/impl/Inclusion.scala | 2 +- .../src/main/scala/scala/xml/dtd/impl/NondetWordAutom.scala | 2 +- .../src/main/scala/scala/xml/dtd/impl/PointedHedgeExp.scala | 2 +- .../main/scala/scala/xml/dtd/impl/SubsetConstruction.scala | 2 +- shared/src/main/scala/scala/xml/dtd/impl/SyntaxError.scala | 2 +- shared/src/main/scala/scala/xml/dtd/impl/WordBerrySethi.scala | 2 +- shared/src/main/scala/scala/xml/dtd/impl/WordExp.scala | 2 +- shared/src/main/scala/scala/xml/factory/Binder.scala | 2 +- .../src/main/scala/scala/xml/factory/LoggedNodeFactory.scala | 2 +- shared/src/main/scala/scala/xml/factory/NodeFactory.scala | 2 +- shared/src/main/scala/scala/xml/factory/XMLLoader.scala | 2 +- .../scala/scala/xml/include/CircularIncludeException.scala | 2 +- .../scala/xml/include/UnavailableResourceException.scala | 2 +- .../src/main/scala/scala/xml/include/XIncludeException.scala | 2 +- .../main/scala/scala/xml/include/sax/EncodingHeuristics.scala | 2 +- .../src/main/scala/scala/xml/include/sax/XIncludeFilter.scala | 2 +- shared/src/main/scala/scala/xml/include/sax/XIncluder.scala | 2 +- shared/src/main/scala/scala/xml/package.scala | 2 +- .../main/scala/scala/xml/parsing/ConstructingHandler.scala | 2 +- .../src/main/scala/scala/xml/parsing/ConstructingParser.scala | 2 +- .../main/scala/scala/xml/parsing/DefaultMarkupHandler.scala | 2 +- shared/src/main/scala/scala/xml/parsing/ExternalSources.scala | 2 +- shared/src/main/scala/scala/xml/parsing/FactoryAdapter.scala | 2 +- shared/src/main/scala/scala/xml/parsing/FatalError.scala | 2 +- shared/src/main/scala/scala/xml/parsing/MarkupHandler.scala | 2 +- shared/src/main/scala/scala/xml/parsing/MarkupParser.scala | 2 +- .../src/main/scala/scala/xml/parsing/MarkupParserCommon.scala | 2 +- .../scala/scala/xml/parsing/NoBindingFactoryAdapter.scala | 2 +- shared/src/main/scala/scala/xml/parsing/TokenTests.scala | 2 +- .../scala/scala/xml/parsing/ValidatingMarkupHandler.scala | 2 +- shared/src/main/scala/scala/xml/parsing/XhtmlEntities.scala | 2 +- shared/src/main/scala/scala/xml/parsing/XhtmlParser.scala | 2 +- .../main/scala/scala/xml/persistent/CachedFileStorage.scala | 2 +- shared/src/main/scala/scala/xml/persistent/Index.scala | 2 +- shared/src/main/scala/scala/xml/persistent/SetStorage.scala | 2 +- shared/src/main/scala/scala/xml/pull/XMLEvent.scala | 2 +- shared/src/main/scala/scala/xml/pull/XMLEventReader.scala | 2 +- .../src/main/scala/scala/xml/transform/BasicTransformer.scala | 2 +- shared/src/main/scala/scala/xml/transform/RewriteRule.scala | 2 +- .../src/main/scala/scala/xml/transform/RuleTransformer.scala | 2 +- 83 files changed, 84 insertions(+), 84 deletions(-) diff --git a/LICENSE.md b/LICENSE.md index e69f60003..0858ac98f 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -1,5 +1,5 @@ -Copyright (c) 2002-2017 EPFL -Copyright (c) 2011-2017 Lightbend, Inc. +Copyright (c) 2002-2018 EPFL +Copyright (c) 2011-2018 Lightbend, Inc. All rights reserved. diff --git a/shared/src/main/scala/scala/xml/Atom.scala b/shared/src/main/scala/scala/xml/Atom.scala index 9af64c274..b8ee13397 100644 --- a/shared/src/main/scala/scala/xml/Atom.scala +++ b/shared/src/main/scala/scala/xml/Atom.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2017, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2003-2018, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/Attribute.scala b/shared/src/main/scala/scala/xml/Attribute.scala index 4c3fd62e8..271d6c198 100644 --- a/shared/src/main/scala/scala/xml/Attribute.scala +++ b/shared/src/main/scala/scala/xml/Attribute.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2017, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2003-2018, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/Comment.scala b/shared/src/main/scala/scala/xml/Comment.scala index b13adde91..24f7c1d99 100644 --- a/shared/src/main/scala/scala/xml/Comment.scala +++ b/shared/src/main/scala/scala/xml/Comment.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2017, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2003-2018, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/Document.scala b/shared/src/main/scala/scala/xml/Document.scala index f6c077468..672f0284d 100644 --- a/shared/src/main/scala/scala/xml/Document.scala +++ b/shared/src/main/scala/scala/xml/Document.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2017, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2003-2018, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/Elem.scala b/shared/src/main/scala/scala/xml/Elem.scala index ae02bfa66..47275317a 100755 --- a/shared/src/main/scala/scala/xml/Elem.scala +++ b/shared/src/main/scala/scala/xml/Elem.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2002-2017, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2002-2018, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/EntityRef.scala b/shared/src/main/scala/scala/xml/EntityRef.scala index 55846a4db..06d855460 100644 --- a/shared/src/main/scala/scala/xml/EntityRef.scala +++ b/shared/src/main/scala/scala/xml/EntityRef.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2017, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2003-2018, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/Equality.scala b/shared/src/main/scala/scala/xml/Equality.scala index 4ee4cb4e0..44d6a8d4b 100644 --- a/shared/src/main/scala/scala/xml/Equality.scala +++ b/shared/src/main/scala/scala/xml/Equality.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2017, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2003-2018, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/Group.scala b/shared/src/main/scala/scala/xml/Group.scala index 1b9ff7608..a539530d8 100644 --- a/shared/src/main/scala/scala/xml/Group.scala +++ b/shared/src/main/scala/scala/xml/Group.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2017, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2003-2018, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/MalformedAttributeException.scala b/shared/src/main/scala/scala/xml/MalformedAttributeException.scala index 12a76257d..3609639b2 100644 --- a/shared/src/main/scala/scala/xml/MalformedAttributeException.scala +++ b/shared/src/main/scala/scala/xml/MalformedAttributeException.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2017, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2003-2018, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/MetaData.scala b/shared/src/main/scala/scala/xml/MetaData.scala index 8d92892fa..7240d2139 100644 --- a/shared/src/main/scala/scala/xml/MetaData.scala +++ b/shared/src/main/scala/scala/xml/MetaData.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2017, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2003-2018, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/NamespaceBinding.scala b/shared/src/main/scala/scala/xml/NamespaceBinding.scala index 419be451e..ae97ac50d 100644 --- a/shared/src/main/scala/scala/xml/NamespaceBinding.scala +++ b/shared/src/main/scala/scala/xml/NamespaceBinding.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2002-2017, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2002-2018, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/Node.scala b/shared/src/main/scala/scala/xml/Node.scala index 5431efb5d..57ed966e3 100755 --- a/shared/src/main/scala/scala/xml/Node.scala +++ b/shared/src/main/scala/scala/xml/Node.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2017, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2003-2018, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/NodeBuffer.scala b/shared/src/main/scala/scala/xml/NodeBuffer.scala index 0a27aa818..84692b264 100644 --- a/shared/src/main/scala/scala/xml/NodeBuffer.scala +++ b/shared/src/main/scala/scala/xml/NodeBuffer.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2017, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2003-2018, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/NodeSeq.scala b/shared/src/main/scala/scala/xml/NodeSeq.scala index cd6957127..bc88aca19 100644 --- a/shared/src/main/scala/scala/xml/NodeSeq.scala +++ b/shared/src/main/scala/scala/xml/NodeSeq.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2017, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2003-2018, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/Null.scala b/shared/src/main/scala/scala/xml/Null.scala index a557ff630..9d6a5c9af 100644 --- a/shared/src/main/scala/scala/xml/Null.scala +++ b/shared/src/main/scala/scala/xml/Null.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2017, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2003-2018, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/PCData.scala b/shared/src/main/scala/scala/xml/PCData.scala index f44931733..5b8ee07c2 100644 --- a/shared/src/main/scala/scala/xml/PCData.scala +++ b/shared/src/main/scala/scala/xml/PCData.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2017, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2003-2018, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/PrefixedAttribute.scala b/shared/src/main/scala/scala/xml/PrefixedAttribute.scala index 9f695275a..f269ba748 100644 --- a/shared/src/main/scala/scala/xml/PrefixedAttribute.scala +++ b/shared/src/main/scala/scala/xml/PrefixedAttribute.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2017, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2003-2018, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/PrettyPrinter.scala b/shared/src/main/scala/scala/xml/PrettyPrinter.scala index 4a481ce59..2669dbe18 100755 --- a/shared/src/main/scala/scala/xml/PrettyPrinter.scala +++ b/shared/src/main/scala/scala/xml/PrettyPrinter.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2017, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2003-2018, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/ProcInstr.scala b/shared/src/main/scala/scala/xml/ProcInstr.scala index 648f58c79..f7511966f 100644 --- a/shared/src/main/scala/scala/xml/ProcInstr.scala +++ b/shared/src/main/scala/scala/xml/ProcInstr.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2017, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2003-2018, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/QNode.scala b/shared/src/main/scala/scala/xml/QNode.scala index f5cb2428d..3d41d2e79 100644 --- a/shared/src/main/scala/scala/xml/QNode.scala +++ b/shared/src/main/scala/scala/xml/QNode.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2017, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2003-2018, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/SpecialNode.scala b/shared/src/main/scala/scala/xml/SpecialNode.scala index 3105ee24b..5b88e8564 100644 --- a/shared/src/main/scala/scala/xml/SpecialNode.scala +++ b/shared/src/main/scala/scala/xml/SpecialNode.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2017, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2003-2018, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/Text.scala b/shared/src/main/scala/scala/xml/Text.scala index 6986b6f03..7f3debc53 100644 --- a/shared/src/main/scala/scala/xml/Text.scala +++ b/shared/src/main/scala/scala/xml/Text.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2017, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2003-2018, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/TextBuffer.scala b/shared/src/main/scala/scala/xml/TextBuffer.scala index 8f3dcc58c..0206b2e3e 100644 --- a/shared/src/main/scala/scala/xml/TextBuffer.scala +++ b/shared/src/main/scala/scala/xml/TextBuffer.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2017, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2003-2018, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/TopScope.scala b/shared/src/main/scala/scala/xml/TopScope.scala index b5a95c043..64da11b23 100644 --- a/shared/src/main/scala/scala/xml/TopScope.scala +++ b/shared/src/main/scala/scala/xml/TopScope.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2002-2017, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2002-2018, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/TypeSymbol.scala b/shared/src/main/scala/scala/xml/TypeSymbol.scala index 9081ba300..4e9b0ff0e 100644 --- a/shared/src/main/scala/scala/xml/TypeSymbol.scala +++ b/shared/src/main/scala/scala/xml/TypeSymbol.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2002-2017, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2002-2018, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/Unparsed.scala b/shared/src/main/scala/scala/xml/Unparsed.scala index 1c1061834..4b1ae2db8 100644 --- a/shared/src/main/scala/scala/xml/Unparsed.scala +++ b/shared/src/main/scala/scala/xml/Unparsed.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2017, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2003-2018, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/UnprefixedAttribute.scala b/shared/src/main/scala/scala/xml/UnprefixedAttribute.scala index 9ee0a9b14..db89b8913 100644 --- a/shared/src/main/scala/scala/xml/UnprefixedAttribute.scala +++ b/shared/src/main/scala/scala/xml/UnprefixedAttribute.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2002-2017, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2002-2018, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/Utility.scala b/shared/src/main/scala/scala/xml/Utility.scala index 539bcd5cd..f7290ed1b 100755 --- a/shared/src/main/scala/scala/xml/Utility.scala +++ b/shared/src/main/scala/scala/xml/Utility.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2017, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2003-2018, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/XML.scala b/shared/src/main/scala/scala/xml/XML.scala index 70630e31d..092a76889 100755 --- a/shared/src/main/scala/scala/xml/XML.scala +++ b/shared/src/main/scala/scala/xml/XML.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2017, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2003-2018, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/dtd/ContentModel.scala b/shared/src/main/scala/scala/xml/dtd/ContentModel.scala index acec798c9..97c8c36d5 100644 --- a/shared/src/main/scala/scala/xml/dtd/ContentModel.scala +++ b/shared/src/main/scala/scala/xml/dtd/ContentModel.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2002-2017, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2002-2018, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/dtd/ContentModelParser.scala b/shared/src/main/scala/scala/xml/dtd/ContentModelParser.scala index 24dc57ee1..cd0b03cbe 100644 --- a/shared/src/main/scala/scala/xml/dtd/ContentModelParser.scala +++ b/shared/src/main/scala/scala/xml/dtd/ContentModelParser.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2002-2017, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2002-2018, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://www.scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/dtd/DTD.scala b/shared/src/main/scala/scala/xml/dtd/DTD.scala index 5648b025b..51ab31226 100644 --- a/shared/src/main/scala/scala/xml/dtd/DTD.scala +++ b/shared/src/main/scala/scala/xml/dtd/DTD.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2002-2017, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2002-2018, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/dtd/Decl.scala b/shared/src/main/scala/scala/xml/dtd/Decl.scala index 8c78e5a8e..5348349df 100644 --- a/shared/src/main/scala/scala/xml/dtd/Decl.scala +++ b/shared/src/main/scala/scala/xml/dtd/Decl.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** - ** / __/ __// _ | / / / _ | (c) 2003-2017, LAMP/EPFL ** + ** / __/ __// _ | / / / _ | (c) 2003-2018, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://www.scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/dtd/DocType.scala b/shared/src/main/scala/scala/xml/dtd/DocType.scala index 822b32eaf..f78403440 100644 --- a/shared/src/main/scala/scala/xml/dtd/DocType.scala +++ b/shared/src/main/scala/scala/xml/dtd/DocType.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2017, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2003-2018, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/dtd/ElementValidator.scala b/shared/src/main/scala/scala/xml/dtd/ElementValidator.scala index e57279f76..7dd2700a9 100644 --- a/shared/src/main/scala/scala/xml/dtd/ElementValidator.scala +++ b/shared/src/main/scala/scala/xml/dtd/ElementValidator.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2002-2017, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2002-2018, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://www.scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/dtd/ExternalID.scala b/shared/src/main/scala/scala/xml/dtd/ExternalID.scala index a60ce1caf..3b8ef63f6 100644 --- a/shared/src/main/scala/scala/xml/dtd/ExternalID.scala +++ b/shared/src/main/scala/scala/xml/dtd/ExternalID.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2017, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2003-2018, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://www.scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/dtd/Scanner.scala b/shared/src/main/scala/scala/xml/dtd/Scanner.scala index 1252af153..e9f4f6595 100644 --- a/shared/src/main/scala/scala/xml/dtd/Scanner.scala +++ b/shared/src/main/scala/scala/xml/dtd/Scanner.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2002-2017, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2002-2018, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/dtd/Tokens.scala b/shared/src/main/scala/scala/xml/dtd/Tokens.scala index 65905ddb4..b2ff19f42 100644 --- a/shared/src/main/scala/scala/xml/dtd/Tokens.scala +++ b/shared/src/main/scala/scala/xml/dtd/Tokens.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2002-2017, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2002-2018, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://www.scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/dtd/ValidationException.scala b/shared/src/main/scala/scala/xml/dtd/ValidationException.scala index 941ba7ef7..a79aea75b 100644 --- a/shared/src/main/scala/scala/xml/dtd/ValidationException.scala +++ b/shared/src/main/scala/scala/xml/dtd/ValidationException.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2002-2017, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2002-2018, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://www.scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/dtd/impl/Base.scala b/shared/src/main/scala/scala/xml/dtd/impl/Base.scala index 946df40b7..13c19911f 100644 --- a/shared/src/main/scala/scala/xml/dtd/impl/Base.scala +++ b/shared/src/main/scala/scala/xml/dtd/impl/Base.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2017, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2003-2018, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/dtd/impl/BaseBerrySethi.scala b/shared/src/main/scala/scala/xml/dtd/impl/BaseBerrySethi.scala index 31c372586..e7c68e2ed 100644 --- a/shared/src/main/scala/scala/xml/dtd/impl/BaseBerrySethi.scala +++ b/shared/src/main/scala/scala/xml/dtd/impl/BaseBerrySethi.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2017, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2003-2018, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/dtd/impl/DetWordAutom.scala b/shared/src/main/scala/scala/xml/dtd/impl/DetWordAutom.scala index 68be9a37b..dcd026fe6 100644 --- a/shared/src/main/scala/scala/xml/dtd/impl/DetWordAutom.scala +++ b/shared/src/main/scala/scala/xml/dtd/impl/DetWordAutom.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2017, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2003-2018, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/dtd/impl/Inclusion.scala b/shared/src/main/scala/scala/xml/dtd/impl/Inclusion.scala index 71bdb0502..0f1e201b0 100644 --- a/shared/src/main/scala/scala/xml/dtd/impl/Inclusion.scala +++ b/shared/src/main/scala/scala/xml/dtd/impl/Inclusion.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2017, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2003-2018, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/dtd/impl/NondetWordAutom.scala b/shared/src/main/scala/scala/xml/dtd/impl/NondetWordAutom.scala index ba8dfad9d..07beed479 100644 --- a/shared/src/main/scala/scala/xml/dtd/impl/NondetWordAutom.scala +++ b/shared/src/main/scala/scala/xml/dtd/impl/NondetWordAutom.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2017, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2003-2018, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/dtd/impl/PointedHedgeExp.scala b/shared/src/main/scala/scala/xml/dtd/impl/PointedHedgeExp.scala index aad4e1531..c6560ac07 100644 --- a/shared/src/main/scala/scala/xml/dtd/impl/PointedHedgeExp.scala +++ b/shared/src/main/scala/scala/xml/dtd/impl/PointedHedgeExp.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2017, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2003-2018, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/dtd/impl/SubsetConstruction.scala b/shared/src/main/scala/scala/xml/dtd/impl/SubsetConstruction.scala index 93ca0cfcd..7f7fd9373 100644 --- a/shared/src/main/scala/scala/xml/dtd/impl/SubsetConstruction.scala +++ b/shared/src/main/scala/scala/xml/dtd/impl/SubsetConstruction.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2017, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2003-2018, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/dtd/impl/SyntaxError.scala b/shared/src/main/scala/scala/xml/dtd/impl/SyntaxError.scala index 5716a84c9..10c41dddb 100644 --- a/shared/src/main/scala/scala/xml/dtd/impl/SyntaxError.scala +++ b/shared/src/main/scala/scala/xml/dtd/impl/SyntaxError.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2017, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2003-2018, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/dtd/impl/WordBerrySethi.scala b/shared/src/main/scala/scala/xml/dtd/impl/WordBerrySethi.scala index e52a6f9ec..7cfb7ae35 100644 --- a/shared/src/main/scala/scala/xml/dtd/impl/WordBerrySethi.scala +++ b/shared/src/main/scala/scala/xml/dtd/impl/WordBerrySethi.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2017, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2003-2018, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/dtd/impl/WordExp.scala b/shared/src/main/scala/scala/xml/dtd/impl/WordExp.scala index 664d7cb5e..e30fe1164 100644 --- a/shared/src/main/scala/scala/xml/dtd/impl/WordExp.scala +++ b/shared/src/main/scala/scala/xml/dtd/impl/WordExp.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2017, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2003-2018, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/factory/Binder.scala b/shared/src/main/scala/scala/xml/factory/Binder.scala index e865bfce1..3453a6253 100755 --- a/shared/src/main/scala/scala/xml/factory/Binder.scala +++ b/shared/src/main/scala/scala/xml/factory/Binder.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2002-2017, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2002-2018, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/factory/LoggedNodeFactory.scala b/shared/src/main/scala/scala/xml/factory/LoggedNodeFactory.scala index cc7e01809..e8189eb7f 100644 --- a/shared/src/main/scala/scala/xml/factory/LoggedNodeFactory.scala +++ b/shared/src/main/scala/scala/xml/factory/LoggedNodeFactory.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2002-2017, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2002-2018, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/factory/NodeFactory.scala b/shared/src/main/scala/scala/xml/factory/NodeFactory.scala index 36cb2c723..283fd8fd5 100644 --- a/shared/src/main/scala/scala/xml/factory/NodeFactory.scala +++ b/shared/src/main/scala/scala/xml/factory/NodeFactory.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2017, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2003-2018, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/factory/XMLLoader.scala b/shared/src/main/scala/scala/xml/factory/XMLLoader.scala index 0604282ea..58e2260f9 100644 --- a/shared/src/main/scala/scala/xml/factory/XMLLoader.scala +++ b/shared/src/main/scala/scala/xml/factory/XMLLoader.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2017, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2003-2018, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/include/CircularIncludeException.scala b/shared/src/main/scala/scala/xml/include/CircularIncludeException.scala index eba534127..cdc73f39c 100644 --- a/shared/src/main/scala/scala/xml/include/CircularIncludeException.scala +++ b/shared/src/main/scala/scala/xml/include/CircularIncludeException.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2002-2017, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2002-2018, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/include/UnavailableResourceException.scala b/shared/src/main/scala/scala/xml/include/UnavailableResourceException.scala index aa069d7a5..db2ee7f5d 100644 --- a/shared/src/main/scala/scala/xml/include/UnavailableResourceException.scala +++ b/shared/src/main/scala/scala/xml/include/UnavailableResourceException.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2002-2017, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2002-2018, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/include/XIncludeException.scala b/shared/src/main/scala/scala/xml/include/XIncludeException.scala index 76ee2bee2..d91bcc1ab 100644 --- a/shared/src/main/scala/scala/xml/include/XIncludeException.scala +++ b/shared/src/main/scala/scala/xml/include/XIncludeException.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2002-2017, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2002-2018, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/include/sax/EncodingHeuristics.scala b/shared/src/main/scala/scala/xml/include/sax/EncodingHeuristics.scala index a105037f0..220d0cbf5 100644 --- a/shared/src/main/scala/scala/xml/include/sax/EncodingHeuristics.scala +++ b/shared/src/main/scala/scala/xml/include/sax/EncodingHeuristics.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2002-2017, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2002-2018, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/include/sax/XIncludeFilter.scala b/shared/src/main/scala/scala/xml/include/sax/XIncludeFilter.scala index 49d901c8c..997152feb 100644 --- a/shared/src/main/scala/scala/xml/include/sax/XIncludeFilter.scala +++ b/shared/src/main/scala/scala/xml/include/sax/XIncludeFilter.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2002-2017, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2002-2018, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/include/sax/XIncluder.scala b/shared/src/main/scala/scala/xml/include/sax/XIncluder.scala index ae1cd9dd0..ee8375cbf 100644 --- a/shared/src/main/scala/scala/xml/include/sax/XIncluder.scala +++ b/shared/src/main/scala/scala/xml/include/sax/XIncluder.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2002-2017, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2002-2018, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/package.scala b/shared/src/main/scala/scala/xml/package.scala index 6eacc37d6..8d28c2989 100644 --- a/shared/src/main/scala/scala/xml/package.scala +++ b/shared/src/main/scala/scala/xml/package.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2017, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2003-2018, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/parsing/ConstructingHandler.scala b/shared/src/main/scala/scala/xml/parsing/ConstructingHandler.scala index cf8adde5b..5fa7905fd 100755 --- a/shared/src/main/scala/scala/xml/parsing/ConstructingHandler.scala +++ b/shared/src/main/scala/scala/xml/parsing/ConstructingHandler.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2002-2017, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2002-2018, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/parsing/ConstructingParser.scala b/shared/src/main/scala/scala/xml/parsing/ConstructingParser.scala index 1e980c27b..59fc3986d 100644 --- a/shared/src/main/scala/scala/xml/parsing/ConstructingParser.scala +++ b/shared/src/main/scala/scala/xml/parsing/ConstructingParser.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2017, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2003-2018, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/parsing/DefaultMarkupHandler.scala b/shared/src/main/scala/scala/xml/parsing/DefaultMarkupHandler.scala index eb0d0489f..3f866510b 100755 --- a/shared/src/main/scala/scala/xml/parsing/DefaultMarkupHandler.scala +++ b/shared/src/main/scala/scala/xml/parsing/DefaultMarkupHandler.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2002-2017, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2002-2018, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/parsing/ExternalSources.scala b/shared/src/main/scala/scala/xml/parsing/ExternalSources.scala index 89acc5959..fe7983a87 100644 --- a/shared/src/main/scala/scala/xml/parsing/ExternalSources.scala +++ b/shared/src/main/scala/scala/xml/parsing/ExternalSources.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2017, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2003-2018, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/parsing/FactoryAdapter.scala b/shared/src/main/scala/scala/xml/parsing/FactoryAdapter.scala index a8b5c887f..f89800907 100644 --- a/shared/src/main/scala/scala/xml/parsing/FactoryAdapter.scala +++ b/shared/src/main/scala/scala/xml/parsing/FactoryAdapter.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2017, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2003-2018, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/parsing/FatalError.scala b/shared/src/main/scala/scala/xml/parsing/FatalError.scala index e389c975f..21397bf5d 100644 --- a/shared/src/main/scala/scala/xml/parsing/FatalError.scala +++ b/shared/src/main/scala/scala/xml/parsing/FatalError.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2002-2017, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2002-2018, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/parsing/MarkupHandler.scala b/shared/src/main/scala/scala/xml/parsing/MarkupHandler.scala index d94d582b1..4e03d9022 100755 --- a/shared/src/main/scala/scala/xml/parsing/MarkupHandler.scala +++ b/shared/src/main/scala/scala/xml/parsing/MarkupHandler.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2017, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2003-2018, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/parsing/MarkupParser.scala b/shared/src/main/scala/scala/xml/parsing/MarkupParser.scala index 4e70d2570..84b63a686 100755 --- a/shared/src/main/scala/scala/xml/parsing/MarkupParser.scala +++ b/shared/src/main/scala/scala/xml/parsing/MarkupParser.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2017, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2003-2018, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/parsing/MarkupParserCommon.scala b/shared/src/main/scala/scala/xml/parsing/MarkupParserCommon.scala index 9a64bb077..5b263656e 100644 --- a/shared/src/main/scala/scala/xml/parsing/MarkupParserCommon.scala +++ b/shared/src/main/scala/scala/xml/parsing/MarkupParserCommon.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2017, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2003-2018, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/parsing/NoBindingFactoryAdapter.scala b/shared/src/main/scala/scala/xml/parsing/NoBindingFactoryAdapter.scala index 6142041e0..92675897d 100644 --- a/shared/src/main/scala/scala/xml/parsing/NoBindingFactoryAdapter.scala +++ b/shared/src/main/scala/scala/xml/parsing/NoBindingFactoryAdapter.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2017, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2003-2018, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/parsing/TokenTests.scala b/shared/src/main/scala/scala/xml/parsing/TokenTests.scala index 32149bd14..5e277dcde 100644 --- a/shared/src/main/scala/scala/xml/parsing/TokenTests.scala +++ b/shared/src/main/scala/scala/xml/parsing/TokenTests.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2017, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2003-2018, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/parsing/ValidatingMarkupHandler.scala b/shared/src/main/scala/scala/xml/parsing/ValidatingMarkupHandler.scala index e9001181b..0efdb99a2 100644 --- a/shared/src/main/scala/scala/xml/parsing/ValidatingMarkupHandler.scala +++ b/shared/src/main/scala/scala/xml/parsing/ValidatingMarkupHandler.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2002-2017, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2002-2018, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/parsing/XhtmlEntities.scala b/shared/src/main/scala/scala/xml/parsing/XhtmlEntities.scala index 02814e28a..3b35e2bce 100644 --- a/shared/src/main/scala/scala/xml/parsing/XhtmlEntities.scala +++ b/shared/src/main/scala/scala/xml/parsing/XhtmlEntities.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2017, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2003-2018, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/parsing/XhtmlParser.scala b/shared/src/main/scala/scala/xml/parsing/XhtmlParser.scala index 3c1d72ffd..9655e7553 100644 --- a/shared/src/main/scala/scala/xml/parsing/XhtmlParser.scala +++ b/shared/src/main/scala/scala/xml/parsing/XhtmlParser.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2017, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2003-2018, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/persistent/CachedFileStorage.scala b/shared/src/main/scala/scala/xml/persistent/CachedFileStorage.scala index e697fc75c..0b73acd8b 100644 --- a/shared/src/main/scala/scala/xml/persistent/CachedFileStorage.scala +++ b/shared/src/main/scala/scala/xml/persistent/CachedFileStorage.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2002-2017, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2002-2018, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/persistent/Index.scala b/shared/src/main/scala/scala/xml/persistent/Index.scala index cdd07af86..0c22ddd36 100644 --- a/shared/src/main/scala/scala/xml/persistent/Index.scala +++ b/shared/src/main/scala/scala/xml/persistent/Index.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2002-2017, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2002-2018, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/persistent/SetStorage.scala b/shared/src/main/scala/scala/xml/persistent/SetStorage.scala index 52d4d68fe..a138df0e2 100644 --- a/shared/src/main/scala/scala/xml/persistent/SetStorage.scala +++ b/shared/src/main/scala/scala/xml/persistent/SetStorage.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2002-2017, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2002-2018, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/pull/XMLEvent.scala b/shared/src/main/scala/scala/xml/pull/XMLEvent.scala index 57cc61989..afa63ee0b 100644 --- a/shared/src/main/scala/scala/xml/pull/XMLEvent.scala +++ b/shared/src/main/scala/scala/xml/pull/XMLEvent.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2017, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2003-2018, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/pull/XMLEventReader.scala b/shared/src/main/scala/scala/xml/pull/XMLEventReader.scala index c8981f0a6..8d0a20387 100755 --- a/shared/src/main/scala/scala/xml/pull/XMLEventReader.scala +++ b/shared/src/main/scala/scala/xml/pull/XMLEventReader.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2017, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2003-2018, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/transform/BasicTransformer.scala b/shared/src/main/scala/scala/xml/transform/BasicTransformer.scala index 528f30eb5..fd0d9560f 100644 --- a/shared/src/main/scala/scala/xml/transform/BasicTransformer.scala +++ b/shared/src/main/scala/scala/xml/transform/BasicTransformer.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2002-2017, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2002-2018, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/transform/RewriteRule.scala b/shared/src/main/scala/scala/xml/transform/RewriteRule.scala index b960d149a..c6b9df923 100644 --- a/shared/src/main/scala/scala/xml/transform/RewriteRule.scala +++ b/shared/src/main/scala/scala/xml/transform/RewriteRule.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2002-2017, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2002-2018, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/transform/RuleTransformer.scala b/shared/src/main/scala/scala/xml/transform/RuleTransformer.scala index 3458bd57e..c9a57f17d 100644 --- a/shared/src/main/scala/scala/xml/transform/RuleTransformer.scala +++ b/shared/src/main/scala/scala/xml/transform/RuleTransformer.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2002-2017, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2002-2018, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** From ac9f76993416004f357ef94b87d1b40c34c85700 Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Thu, 1 Feb 2018 19:19:46 -0500 Subject: [PATCH 190/789] Improve UtilityTest.trim Also fixes defect in scalajs 0.6.22 and scala 2.13.0-M3 --- shared/src/test/scala/scala/xml/UtilityTest.scala | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/shared/src/test/scala/scala/xml/UtilityTest.scala b/shared/src/test/scala/scala/xml/UtilityTest.scala index eac05075b..263740266 100644 --- a/shared/src/test/scala/scala/xml/UtilityTest.scala +++ b/shared/src/test/scala/scala/xml/UtilityTest.scala @@ -18,13 +18,13 @@ class UtilityTest {
val y = xml.Utility.trim(x) - assertEquals(1, y match { case => 1 }) + assertTrue(y match { case => true }) val x2 = a b b a val y2 = xml.Utility.trim(x2) - assertEquals(2, y2 match { case a b b a => 2 }) + assertTrue(y2 match { case a b b a => true }) } @Test From 393b216c290cc6a8269afaf7f95f7ade9f56777e Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Mon, 23 Oct 2017 11:00:07 -0400 Subject: [PATCH 191/789] Add Java 9 to Travis --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 9fce93b77..57da53855 100644 --- a/.travis.yml +++ b/.travis.yml @@ -22,6 +22,7 @@ addons: jdk: - openjdk6 - oraclejdk8 + - oraclejdk9 notifications: email: adriaan.moors@lightbend.com From 00d920f5c510555a1179543fd990e6b28f23d97d Mon Sep 17 00:00:00 2001 From: xuwei-k <6b656e6a69@gmail.com> Date: Sun, 24 Dec 2017 18:01:15 +0900 Subject: [PATCH 192/789] Fix sbtApiMappings for Java 9 --- build.sbt | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/build.sbt b/build.sbt index 2cacdc18f..bdc8d5399 100644 --- a/build.sbt +++ b/build.sbt @@ -27,11 +27,18 @@ lazy val xml = crossProject.in(file(".")) apiMappings ++= Map( scalaInstance.value.libraryJar - -> url(s"http://www.scala-lang.org/api/${scalaVersion.value}/"), + -> url(s"http://www.scala-lang.org/api/${scalaVersion.value}/") + ) ++ { // http://stackoverflow.com/questions/16934488 - file(System.getProperty("sun.boot.class.path").split(java.io.File.pathSeparator).filter(_.endsWith(java.io.File.separator + "rt.jar")).head) - -> url("http://docs.oracle.com/javase/8/docs/api") - ) + Option(System.getProperty("sun.boot.class.path")).flatMap { classPath => + classPath.split(java.io.File.pathSeparator).filter(_.endsWith(java.io.File.separator + "rt.jar")).headOption + }.map { jarPath => + Map( + file(jarPath) + -> url("http://docs.oracle.com/javase/8/docs/api") + ) + } getOrElse(Map.empty) + } ) .jvmSettings( OsgiKeys.exportPackage := Seq(s"scala.xml.*;version=${version.value}"), From c155532c80dc164d93bbc2e77b1557d0a960244d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Doeraene?= Date: Wed, 10 Jan 2018 08:47:56 -0500 Subject: [PATCH 193/789] Fix apiMappings for JDK9 with jrt: hack Based on scala-js/scala-js@98973d4 --- build.sbt | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index bdc8d5399..dd2cfc0b4 100644 --- a/build.sbt +++ b/build.sbt @@ -37,7 +37,13 @@ lazy val xml = crossProject.in(file(".")) file(jarPath) -> url("http://docs.oracle.com/javase/8/docs/api") ) - } getOrElse(Map.empty) + } getOrElse { + // If everything fails, jam in the Java 9 base module. + Map( + file("/modules/java.base") + -> url("http://docs.oracle.com/javase/9/docs/api") + ) + } } ) .jvmSettings( From 41e3c1c2454c54757230fd779ab328731f85a5c7 Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Wed, 10 Jan 2018 08:49:00 -0500 Subject: [PATCH 194/789] Add java.xml module to apiMappings for Java 9 --- build.sbt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/build.sbt b/build.sbt index dd2cfc0b4..629f66247 100644 --- a/build.sbt +++ b/build.sbt @@ -41,7 +41,10 @@ lazy val xml = crossProject.in(file(".")) // If everything fails, jam in the Java 9 base module. Map( file("/modules/java.base") + -> url("http://docs.oracle.com/javase/9/docs/api"), + file("/modules/java.xml") -> url("http://docs.oracle.com/javase/9/docs/api") + ) } } From 598fe78e28fa0cb6acf27a32dada8b3477734d19 Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Wed, 31 Jan 2018 15:10:24 -0500 Subject: [PATCH 195/789] Increment sbt to 0.13.17 --- project/build.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/build.properties b/project/build.properties index c091b86ca..133a8f197 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version=0.13.16 +sbt.version=0.13.17 From f4f51aa187859fbdcdaa704a22817511df3434da Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Mon, 5 Feb 2018 17:06:17 -0500 Subject: [PATCH 196/789] Update JUnit 4.12 and junit-interface 0.11 --- build.sbt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build.sbt b/build.sbt index 629f66247..b63b3c6ad 100644 --- a/build.sbt +++ b/build.sbt @@ -55,8 +55,8 @@ lazy val xml = crossProject.in(file(".")) // there is currently no previous released JS version, therefore MiMa is enabled only on JVM mimaPreviousVersion := Some("1.0.6"), - libraryDependencies += "junit" % "junit" % "4.11" % "test", - libraryDependencies += "com.novocode" % "junit-interface" % "0.10" % "test", + libraryDependencies += "junit" % "junit" % "4.12" % "test", + libraryDependencies += "com.novocode" % "junit-interface" % "0.11" % "test", libraryDependencies += "org.apache.commons" % "commons-lang3" % "3.5" % "test", libraryDependencies += ("org.scala-lang" % "scala-compiler" % scalaVersion.value % "test").exclude("org.scala-lang.modules", s"scala-xml_${scalaBinaryVersion.value}") ) From c6e78d22417ae5f9034b0ed45083fd8a654ea2d4 Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Fri, 16 Feb 2018 13:09:36 -0500 Subject: [PATCH 197/789] Fix UTF-8 test on JDK6 In particular, on a Mac the file.encoding is MacRoman scala> sys.props.get("file.encoding") res0: Option[String] = Some(MacRoman) --- jvm/src/test/scala/scala/xml/XMLTest.scala | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/jvm/src/test/scala/scala/xml/XMLTest.scala b/jvm/src/test/scala/scala/xml/XMLTest.scala index ed35b8aaf..60ca3bc73 100644 --- a/jvm/src/test/scala/scala/xml/XMLTest.scala +++ b/jvm/src/test/scala/scala/xml/XMLTest.scala @@ -309,16 +309,16 @@ class XMLTestJVM { // com.sun.org.apache.xerces.internal.impl.io.MalformedByteSequenceException: // Invalid byte 1 of 1-byte UTF-8 sequence. // scala.xml.XML.save("foo.xml", xml) - // scala.xml.XML.loadFile("foo.xml").toString) + // scala.xml.XML.loadFile("foo.xml").toString val outputStream = new java.io.ByteArrayOutputStream - val streamWriter = new java.io.OutputStreamWriter(outputStream, XML.encoding) + val streamWriter = new java.io.OutputStreamWriter(outputStream, "UTF-8") XML.write(streamWriter, xml, XML.encoding, false, null) streamWriter.flush val inputStream = new java.io.ByteArrayInputStream(outputStream.toByteArray) - val streamReader = new java.io.InputStreamReader(inputStream) + val streamReader = new java.io.InputStreamReader(inputStream, XML.encoding) assertEquals(xml.toString, XML.load(streamReader).toString) } From 3cd00aadfc2ea434ba96768e25c1d0e1ecf0cf24 Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Sat, 17 Feb 2018 10:47:03 -0500 Subject: [PATCH 198/789] Move Google copyright to file header The copyright should just be in the file header for the Elem and MetaData objects and classes, and not in their documentation. Currently, these copyright notices are showing up in the HTML api docs (scaladoc) for those elements. The rest of the library doesn't do this, so it's probably worth moving it out, rather than pasting copyright notices everywhere in the api docs for consistency. According to the original author of scala-xml, Burak Emir: The patch was built in 20% time while I was already working for Google, using Google's resources. The patch was formally reviewed and approved and Google is ok with it being part of Scala and people using, distributing, etc... it under the Scala license. That is why the copyright notice is there. See "committed to open source" in https://abc.xyz/investor/other/google-code-of-conduct.html --- shared/src/main/scala/scala/xml/Elem.scala | 8 ++------ shared/src/main/scala/scala/xml/MetaData.scala | 9 ++------- 2 files changed, 4 insertions(+), 13 deletions(-) diff --git a/shared/src/main/scala/scala/xml/Elem.scala b/shared/src/main/scala/scala/xml/Elem.scala index 47275317a..4c308017e 100755 --- a/shared/src/main/scala/scala/xml/Elem.scala +++ b/shared/src/main/scala/scala/xml/Elem.scala @@ -4,6 +4,8 @@ ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** +** Copyright 2008 Google Inc. ** +** All Rights Reserved. ** \* */ package scala @@ -14,9 +16,6 @@ package xml * convenient construction and deconstruction. It is possible to deconstruct * any `Node` instance (that is not a `SpecialNode` or a `Group`) using the * syntax `case Elem(prefix, label, attribs, scope, child @ _*) => ...` - * - * Copyright 2008 Google Inc. All Rights Reserved. - * @author Burak Emir */ object Elem { /** @@ -83,9 +82,6 @@ object Elem { * @param minimizeEmpty `true` if this element should be serialized as minimized (i.e. "<el/>") when * empty; `false` if it should be written out in long form. * @param child the children of this node - * - * Copyright 2008 Google Inc. All Rights Reserved. - * @author Burak Emir */ class Elem( override val prefix: String, diff --git a/shared/src/main/scala/scala/xml/MetaData.scala b/shared/src/main/scala/scala/xml/MetaData.scala index 7240d2139..48e7173d9 100644 --- a/shared/src/main/scala/scala/xml/MetaData.scala +++ b/shared/src/main/scala/scala/xml/MetaData.scala @@ -4,6 +4,8 @@ ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** +** Copyright 2008 Google Inc. ** +** All Rights Reserved. ** \* */ package scala @@ -13,10 +15,6 @@ import Utility.sbToString import scala.annotation.tailrec import scala.collection.AbstractIterable -/** - * Copyright 2008 Google Inc. All Rights Reserved. - * @author Burak Emir - */ object MetaData { /** * appends all attributes from new_tail to attribs, without attempting to @@ -78,9 +76,6 @@ object MetaData { * * Namespace URIs are obtained by using the namespace scope of the element * owning this attribute (see `getNamespace`). - * - * Copyright 2008 Google Inc. All Rights Reserved. - * @author Burak Emir */ abstract class MetaData extends AbstractIterable[MetaData] From be53fbb8148a35abd763b3fb1e004f69483e7257 Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Tue, 20 Feb 2018 13:02:08 -0500 Subject: [PATCH 199/789] Bump version for next release --- build.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index b63b3c6ad..e35bd9747 100644 --- a/build.sbt +++ b/build.sbt @@ -20,7 +20,7 @@ lazy val xml = crossProject.in(file(".")) .jvmSettings(scalaModuleSettingsJVM) .settings( name := "scala-xml", - version := "1.1.0-SNAPSHOT", + version := "1.1.1-SNAPSHOT", scalacOptions ++= "-deprecation:false -feature -Xlint:-stars-align,-nullary-unit,_".split("\\s+").to[Seq], scalacOptions in Test += "-Xxml:coalescing", From d1429678e999aebb1f98861f31475d2fe5a5e269 Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Tue, 20 Feb 2018 13:02:31 -0500 Subject: [PATCH 200/789] Update maven badge for 2.13 builds --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 21e24dd3b..3e2d6fc31 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ scala-xml [![Travis](https://img.shields.io/travis/scala/scala-xml.svg)](https://travis-ci.org/scala/scala-xml) [![latest release for 2.11](https://img.shields.io/maven-central/v/org.scala-lang.modules/scala-xml_2.11.svg?label=scala+2.11)](http://mvnrepository.com/artifact/org.scala-lang.modules/scala-xml_2.11) [![latest release for 2.12](https://img.shields.io/maven-central/v/org.scala-lang.modules/scala-xml_2.12.svg?label=scala+2.12)](http://mvnrepository.com/artifact/org.scala-lang.modules/scala-xml_2.12) -[![latest release for 2.13.0-M2](https://img.shields.io/maven-central/v/org.scala-lang.modules/scala-xml_2.13.0-M2.svg?label=scala+2.13.0-M2)](http://mvnrepository.com/artifact/org.scala-lang.modules/scala-xml_2.13.0-M2) +[![latest release for 2.13.0-M3](https://img.shields.io/maven-central/v/org.scala-lang.modules/scala-xml_2.13.0-M3.svg?label=scala+2.13.0-M3)](http://mvnrepository.com/artifact/org.scala-lang.modules/scala-xml_2.13.0-M3) [![Gitter](https://badges.gitter.im/Join+Chat.svg)](https://gitter.im/scala/scala-xml) ========= From 782a4e1d1f5efec9f441399b8d99cc7947d6bc90 Mon Sep 17 00:00:00 2001 From: Seth Tisue Date: Wed, 21 Feb 2018 09:01:32 -0800 Subject: [PATCH 201/789] discuss issue situation in README fixes #62 --- README.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/README.md b/README.md index 3e2d6fc31..33fd765c1 100644 --- a/README.md +++ b/README.md @@ -24,6 +24,13 @@ If you are cross-building a project that uses scala-xml with both Scala 2.10 and This library is community-maintained. The lead maintainers are [@aaron_s_hawley](https://github.com/ashawley) and [@biswanaths](https://github.com/biswanaths). +## Issues + +Many old issues from the Scala JIRA issue tracker have been migrated +here, but not all of them. Community assistance identifying and +migrating still-relevant issues is welcome. See [this +page](https://github.com/scala/scala-xml/issues/62) for details. + ## Security best practices The XML spec has some features that are best turned off, to avoid unsavory things like file system access, DoS attacks,... Issue [#17](https://github.com/scala/scala-xml/issues/17) tracks the recommended way of configuring the XML parser used by scala-xml to avoid these. This is by no means an exhaustive list. We'll be happy to incorporate your suggestions -- just comment on the ticket! From 93caa1a4771aa06dc056d9c0f3ed351fcc0a3e36 Mon Sep 17 00:00:00 2001 From: shado23 Date: Thu, 22 Feb 2018 18:02:59 +0100 Subject: [PATCH 202/789] Set safe defaults for parser settings The library should be safe by default and potentially unsafe features should be explicitly enabled by the user if needed. --- .../main/scala/scala/xml/factory/XMLLoader.scala | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/shared/src/main/scala/scala/xml/factory/XMLLoader.scala b/shared/src/main/scala/scala/xml/factory/XMLLoader.scala index 58e2260f9..8d5a6a935 100644 --- a/shared/src/main/scala/scala/xml/factory/XMLLoader.scala +++ b/shared/src/main/scala/scala/xml/factory/XMLLoader.scala @@ -25,9 +25,18 @@ trait XMLLoader[T <: Node] { /* Override this to use a different SAXParser. */ def parser: SAXParser = { - val f = SAXParserFactory.newInstance() - f.setNamespaceAware(false) - f.newSAXParser() + val parser = SAXParserFactory.newInstance() + + parser.setFeature("http://javax.xml.XMLConstants/feature/secure-processing", true) + parser.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false) + parser.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true) + parser.setFeature("http://xml.org/sax/features/external-parameter-entities", false) + parser.setFeature("http://xml.org/sax/features/external-general-entities", false) + parser.setFeature("http://xml.org/sax/features/resolve-dtd-uris", false) + parser.setXIncludeAware(false) + parser.setNamespaceAware(false) + + parser.newSAXParser() } /** From f78f8f66841dee698134367265d5067e4cfeccfe Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Thu, 22 Feb 2018 12:15:13 -0500 Subject: [PATCH 203/789] Add billion laughs attack to test suite --- .../scala/xml/BillionLaughsAttackTest.scala | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 jvm/src/test/scala/scala/xml/BillionLaughsAttackTest.scala diff --git a/jvm/src/test/scala/scala/xml/BillionLaughsAttackTest.scala b/jvm/src/test/scala/scala/xml/BillionLaughsAttackTest.scala new file mode 100644 index 000000000..88e1e99b2 --- /dev/null +++ b/jvm/src/test/scala/scala/xml/BillionLaughsAttackTest.scala @@ -0,0 +1,36 @@ +package scala.xml + +import org.junit.Test + +class BillionLaughsAttackTest { + + /** + * org.xml.sax.SAXParseException: JAXP00010001: The parser has + * encountered more than "64000" entity expansions in this document; + * this is the limit imposed by the JDK. + */ + @Test(expected=classOf[org.xml.sax.SAXParseException]) + def lolzTest: Unit = { + XML.loadString(lolz) + } + + // Copied from https://msdn.microsoft.com/en-us/magazine/ee335713.aspx + val lolz = + """ + | + | + | + | + | + | + | + | + | + | + | + |]> + |&lol9; + |""".stripMargin + +} From 3c1523b6c3ae011cc84fadcd995d4438f20679f2 Mon Sep 17 00:00:00 2001 From: xuwei-k <6b656e6a69@gmail.com> Date: Mon, 9 Apr 2018 17:19:45 +0900 Subject: [PATCH 204/789] add -Xfuture option. fix procedure syntax warnings --- build.sbt | 2 +- jvm/src/test/scala/scala/xml/XMLTest.scala | 2 +- .../scala/xml/pull/XMLEventReaderTest.scala | 2 +- .../src/main/scala/scala/xml/Attribute.scala | 2 +- .../scala/scala/xml/NamespaceBinding.scala | 4 +-- .../main/scala/scala/xml/PrettyPrinter.scala | 10 +++--- shared/src/main/scala/scala/xml/Utility.scala | 2 +- shared/src/main/scala/scala/xml/XML.scala | 2 +- .../scala/scala/xml/dtd/ContentModel.scala | 2 +- .../src/main/scala/scala/xml/dtd/Decl.scala | 2 +- .../scala/xml/dtd/ElementValidator.scala | 2 +- .../main/scala/scala/xml/dtd/Scanner.scala | 8 ++--- .../xml/dtd/impl/SubsetConstruction.scala | 4 +-- .../scala/xml/dtd/impl/WordBerrySethi.scala | 6 ++-- .../scala/xml/include/XIncludeException.scala | 2 +- .../xml/include/sax/XIncludeFilter.scala | 26 +++++++------- .../scala/xml/include/sax/XIncluder.scala | 36 +++++++++---------- .../scala/xml/parsing/FactoryAdapter.scala | 2 +- .../scala/xml/parsing/MarkupHandler.scala | 2 +- .../scala/xml/parsing/MarkupParser.scala | 24 ++++++------- .../xml/parsing/MarkupParserCommon.scala | 6 ++-- .../xml/parsing/ValidatingMarkupHandler.scala | 14 ++++---- .../scala/scala/xml/pull/XMLEventReader.scala | 6 ++-- shared/src/test/scala/scala/xml/XMLTest.scala | 8 ++--- 24 files changed, 88 insertions(+), 88 deletions(-) diff --git a/build.sbt b/build.sbt index e35bd9747..1a8017cb3 100644 --- a/build.sbt +++ b/build.sbt @@ -22,7 +22,7 @@ lazy val xml = crossProject.in(file(".")) name := "scala-xml", version := "1.1.1-SNAPSHOT", - scalacOptions ++= "-deprecation:false -feature -Xlint:-stars-align,-nullary-unit,_".split("\\s+").to[Seq], + scalacOptions ++= "-deprecation:false -Xfuture -feature -Xlint:-stars-align,-nullary-unit,_".split("\\s+").to[Seq], scalacOptions in Test += "-Xxml:coalescing", apiMappings ++= Map( diff --git a/jvm/src/test/scala/scala/xml/XMLTest.scala b/jvm/src/test/scala/scala/xml/XMLTest.scala index 60ca3bc73..fac1c9362 100644 --- a/jvm/src/test/scala/scala/xml/XMLTest.scala +++ b/jvm/src/test/scala/scala/xml/XMLTest.scala @@ -199,7 +199,7 @@ class XMLTestJVM { new java.io.ObjectInputStream(new java.io.ByteArrayInputStream(buffer)) in.readObject().asInstanceOf[A] } - def check[A, B](x: A, y: B) { + def check[A, B](x: A, y: B): Unit = { // println("x = " + x) // println("y = " + y) // println("x equals y: " + (x equals y) + ", y equals x: " + (y equals x)) diff --git a/jvm/src/test/scala/scala/xml/pull/XMLEventReaderTest.scala b/jvm/src/test/scala/scala/xml/pull/XMLEventReaderTest.scala index 49df7d56f..0c869d4f5 100644 --- a/jvm/src/test/scala/scala/xml/pull/XMLEventReaderTest.scala +++ b/jvm/src/test/scala/scala/xml/pull/XMLEventReaderTest.scala @@ -13,7 +13,7 @@ class XMLEventReaderTest { private def toSource(s: String) = new Source { val iter = s.iterator - override def reportError(pos: Int, msg: String, out: java.io.PrintStream = Console.err) {} + override def reportError(pos: Int, msg: String, out: java.io.PrintStream = Console.err): Unit = {} } @Test diff --git a/shared/src/main/scala/scala/xml/Attribute.scala b/shared/src/main/scala/scala/xml/Attribute.scala index 271d6c198..d8ca107fb 100644 --- a/shared/src/main/scala/scala/xml/Attribute.scala +++ b/shared/src/main/scala/scala/xml/Attribute.scala @@ -88,7 +88,7 @@ abstract trait Attribute extends MetaData { /** * Appends string representation of only this attribute to stringbuffer. */ - protected def toString1(sb: StringBuilder) { + protected def toString1(sb: StringBuilder): Unit = { if (value == null) return if (isPrefixed) diff --git a/shared/src/main/scala/scala/xml/NamespaceBinding.scala b/shared/src/main/scala/scala/xml/NamespaceBinding.scala index ae97ac50d..7bc2ca43d 100644 --- a/shared/src/main/scala/scala/xml/NamespaceBinding.scala +++ b/shared/src/main/scala/scala/xml/NamespaceBinding.scala @@ -67,11 +67,11 @@ case class NamespaceBinding(prefix: String, uri: String, parent: NamespaceBindin def buildString(stop: NamespaceBinding): String = sbToString(buildString(_, stop)) - def buildString(sb: StringBuilder, stop: NamespaceBinding) { + def buildString(sb: StringBuilder, stop: NamespaceBinding): Unit = { shadowRedefined(stop).doBuildString(sb, stop) } - private def doBuildString(sb: StringBuilder, stop: NamespaceBinding) { + private def doBuildString(sb: StringBuilder, stop: NamespaceBinding): Unit = { if (List(null, stop, TopScope).contains(this)) return val s = " xmlns%s=\"%s\"".format( diff --git a/shared/src/main/scala/scala/xml/PrettyPrinter.scala b/shared/src/main/scala/scala/xml/PrettyPrinter.scala index 2669dbe18..6cb3f6cdb 100755 --- a/shared/src/main/scala/scala/xml/PrettyPrinter.scala +++ b/shared/src/main/scala/scala/xml/PrettyPrinter.scala @@ -95,7 +95,7 @@ class PrettyPrinter(width: Int, step: Int, minimizeEmpty: Boolean) { } protected def leafTag(n: Node) = { - def mkLeaf(sb: StringBuilder) { + def mkLeaf(sb: StringBuilder): Unit = { sb append '<' n nameToString sb n.attributes buildString sb @@ -106,7 +106,7 @@ class PrettyPrinter(width: Int, step: Int, minimizeEmpty: Boolean) { protected def startTag(n: Node, pscope: NamespaceBinding): (String, Int) = { var i = 0 - def mkStart(sb: StringBuilder) { + def mkStart(sb: StringBuilder): Unit = { sb append '<' n nameToString sb i = sb.length + 1 @@ -118,7 +118,7 @@ class PrettyPrinter(width: Int, step: Int, minimizeEmpty: Boolean) { } protected def endTag(n: Node) = { - def mkEnd(sb: StringBuilder) { + def mkEnd(sb: StringBuilder): Unit = { sb append "' @@ -203,11 +203,11 @@ class PrettyPrinter(width: Int, step: Int, minimizeEmpty: Boolean) { * @param n the node to be serialized * @param sb the stringbuffer to append to */ - def format(n: Node, sb: StringBuilder) { // entry point + def format(n: Node, sb: StringBuilder): Unit = { // entry point format(n, TopScope, sb) } - def format(n: Node, pscope: NamespaceBinding, sb: StringBuilder) { // entry point + def format(n: Node, pscope: NamespaceBinding, sb: StringBuilder): Unit = { // entry point var lastwasbreak = false reset() traverse(n, pscope, 0) diff --git a/shared/src/main/scala/scala/xml/Utility.scala b/shared/src/main/scala/scala/xml/Utility.scala index f7290ed1b..ce14fbc85 100755 --- a/shared/src/main/scala/scala/xml/Utility.scala +++ b/shared/src/main/scala/scala/xml/Utility.scala @@ -138,7 +138,7 @@ object Utility extends AnyRef with parsing.TokenTests { /** * Adds all namespaces in node to set. */ - def collectNamespaces(n: Node, set: mutable.Set[String]) { + def collectNamespaces(n: Node, set: mutable.Set[String]): Unit = { if (n.doCollectNamespaces) { set += n.namespace for (a <- n.attributes) a match { diff --git a/shared/src/main/scala/scala/xml/XML.scala b/shared/src/main/scala/scala/xml/XML.scala index 092a76889..0b99ca816 100755 --- a/shared/src/main/scala/scala/xml/XML.scala +++ b/shared/src/main/scala/scala/xml/XML.scala @@ -107,7 +107,7 @@ object XML extends XMLLoader[Elem] { * @param xmlDecl if true, write xml declaration * @param doctype if not null, write doctype declaration */ - final def write(w: java.io.Writer, node: Node, enc: String, xmlDecl: Boolean, doctype: dtd.DocType, minimizeTags: MinimizeMode.Value = MinimizeMode.Default) { + final def write(w: java.io.Writer, node: Node, enc: String, xmlDecl: Boolean, doctype: dtd.DocType, minimizeTags: MinimizeMode.Value = MinimizeMode.Default): Unit = { /* TODO: optimize by giving writer parameter to toXML*/ if (xmlDecl) w.write("\n") if (doctype ne null) w.write(doctype.toString() + "\n") diff --git a/shared/src/main/scala/scala/xml/dtd/ContentModel.scala b/shared/src/main/scala/scala/xml/dtd/ContentModel.scala index 97c8c36d5..32d07c6c1 100644 --- a/shared/src/main/scala/scala/xml/dtd/ContentModel.scala +++ b/shared/src/main/scala/scala/xml/dtd/ContentModel.scala @@ -54,7 +54,7 @@ object ContentModel extends WordExp { def buildString(r: RegExp): String = sbToString(buildString(r, _)) /* precond: rs.length >= 1 */ - private def buildString(rs: Seq[RegExp], sb: StringBuilder, sep: Char) { + private def buildString(rs: Seq[RegExp], sb: StringBuilder, sep: Char): Unit = { buildString(rs.head, sb) for (z <- rs.tail) { sb append sep diff --git a/shared/src/main/scala/scala/xml/dtd/Decl.scala b/shared/src/main/scala/scala/xml/dtd/Decl.scala index 5348349df..b8cd9209c 100644 --- a/shared/src/main/scala/scala/xml/dtd/Decl.scala +++ b/shared/src/main/scala/scala/xml/dtd/Decl.scala @@ -103,7 +103,7 @@ sealed abstract class EntityDef { } case class IntDef(value: String) extends EntityDef { - private def validateValue() { + private def validateValue(): Unit = { var tmp = value var ix = tmp indexOf '%' while (ix != -1) { diff --git a/shared/src/main/scala/scala/xml/dtd/ElementValidator.scala b/shared/src/main/scala/scala/xml/dtd/ElementValidator.scala index 7dd2700a9..4d5ff979d 100644 --- a/shared/src/main/scala/scala/xml/dtd/ElementValidator.scala +++ b/shared/src/main/scala/scala/xml/dtd/ElementValidator.scala @@ -45,7 +45,7 @@ class ElementValidator() extends Function1[Node, Boolean] { def getContentModel = contentModel /** set meta data, enabling attribute validation */ - def setMetaData(adecls: List[AttrDecl]) { this.adecls = adecls } + def setMetaData(adecls: List[AttrDecl]): Unit = { this.adecls = adecls } def getIterable(nodes: Seq[Node], skipPCDATA: Boolean): Iterable[ElemName] = { def isAllWhitespace(a: Atom[_]) = cond(a.data) { case s: String if s.trim == "" => true } diff --git a/shared/src/main/scala/scala/xml/dtd/Scanner.scala b/shared/src/main/scala/scala/xml/dtd/Scanner.scala index e9f4f6595..24160cddc 100644 --- a/shared/src/main/scala/scala/xml/dtd/Scanner.scala +++ b/shared/src/main/scala/scala/xml/dtd/Scanner.scala @@ -25,7 +25,7 @@ class Scanner extends Tokens with parsing.TokenTests { private var c: Char = 'z' /** initializes the scanner on input s */ - final def initScanner(s: String) { + final def initScanner(s: String): Unit = { value = "" it = (s).iterator token = 1 + END @@ -34,7 +34,7 @@ class Scanner extends Tokens with parsing.TokenTests { } /** scans the next token */ - final def nextToken() { + final def nextToken(): Unit = { if (token != END) token = readToken } @@ -44,11 +44,11 @@ class Scanner extends Tokens with parsing.TokenTests { final def next() = if (it.hasNext) c = it.next() else c = ENDCH - final def acc(d: Char) { + final def acc(d: Char): Unit = { if (c == d) next() else scala.sys.error("expected '" + d + "' found '" + c + "' !") } - final def accS(ds: Seq[Char]) { ds foreach acc } + final def accS(ds: Seq[Char]): Unit = { ds foreach acc } final def readToken: Int = if (isSpace(c)) { diff --git a/shared/src/main/scala/scala/xml/dtd/impl/SubsetConstruction.scala b/shared/src/main/scala/scala/xml/dtd/impl/SubsetConstruction.scala index 7f7fd9373..6b74839fd 100644 --- a/shared/src/main/scala/scala/xml/dtd/impl/SubsetConstruction.scala +++ b/shared/src/main/scala/scala/xml/dtd/impl/SubsetConstruction.scala @@ -36,11 +36,11 @@ private[dtd] class SubsetConstruction[T <: AnyRef](val nfa: NondetWordAutom[T]) rest.push(sink, q0) - def addFinal(q: immutable.BitSet) { + def addFinal(q: immutable.BitSet): Unit = { if (nfa containsFinal q) finals = finals.updated(q, selectTag(q, nfa.finals)) } - def add(Q: immutable.BitSet) { + def add(Q: immutable.BitSet): Unit = { if (!states(Q)) { states += Q rest push Q diff --git a/shared/src/main/scala/scala/xml/dtd/impl/WordBerrySethi.scala b/shared/src/main/scala/scala/xml/dtd/impl/WordBerrySethi.scala index 7cfb7ae35..e96cd1299 100644 --- a/shared/src/main/scala/scala/xml/dtd/impl/WordBerrySethi.scala +++ b/shared/src/main/scala/scala/xml/dtd/impl/WordBerrySethi.scala @@ -73,7 +73,7 @@ private[dtd] abstract class WordBerrySethi extends BaseBerrySethi { */ /** Called at the leaves of the regexp */ - protected def seenLabel(r: RegExp, i: Int, label: _labelT) { + protected def seenLabel(r: RegExp, i: Int, label: _labelT): Unit = { labelAt = labelAt.updated(i, label) this.labels += label } @@ -92,7 +92,7 @@ private[dtd] abstract class WordBerrySethi extends BaseBerrySethi { case _ => super.traverse(r) } - protected def makeTransition(src: Int, dest: Int, label: _labelT) { + protected def makeTransition(src: Int, dest: Int, label: _labelT): Unit = { val q = deltaq(src) q.update(label, dest :: q.getOrElse(label, Nil)) } @@ -109,7 +109,7 @@ private[dtd] abstract class WordBerrySethi extends BaseBerrySethi { this.initials = Set(0) } - protected def initializeAutom() { + protected def initializeAutom(): Unit = { finals = immutable.Map.empty[Int, Int] // final states deltaq = new Array[mutable.HashMap[_labelT, List[Int]]](pos) // delta defaultq = new Array[List[Int]](pos) // default transitions diff --git a/shared/src/main/scala/scala/xml/include/XIncludeException.scala b/shared/src/main/scala/scala/xml/include/XIncludeException.scala index d91bcc1ab..4b684ffef 100644 --- a/shared/src/main/scala/scala/xml/include/XIncludeException.scala +++ b/shared/src/main/scala/scala/xml/include/XIncludeException.scala @@ -39,7 +39,7 @@ class XIncludeException(message: String) extends Exception(message) { * @param nestedException the underlying exception which * caused the XIncludeException to be thrown */ - def setRootCause(nestedException: Throwable) { + def setRootCause(nestedException: Throwable): Unit = { this.rootCause = nestedException } diff --git a/shared/src/main/scala/scala/xml/include/sax/XIncludeFilter.scala b/shared/src/main/scala/scala/xml/include/sax/XIncludeFilter.scala index 997152feb..770d1025b 100644 --- a/shared/src/main/scala/scala/xml/include/sax/XIncludeFilter.scala +++ b/shared/src/main/scala/scala/xml/include/sax/XIncludeFilter.scala @@ -86,7 +86,7 @@ class XIncludeFilter extends XMLFilterImpl { // what if this isn't called???? // do I need to check this in startDocument() and push something // there???? - override def setDocumentLocator(locator: Locator) { + override def setDocumentLocator(locator: Locator): Unit = { locators push locator val base = locator.getSystemId() try { @@ -113,7 +113,7 @@ class XIncludeFilter extends XMLFilterImpl { */ def insideIncludeElement(): Boolean = level != 0 - override def startElement(uri: String, localName: String, qName: String, atts1: Attributes) { + override def startElement(uri: String, localName: String, qName: String, atts1: Attributes): Unit = { var atts = atts1 if (level == 0) { // We're not inside an xi:include element @@ -169,7 +169,7 @@ class XIncludeFilter extends XMLFilterImpl { } } - override def endElement(uri: String, localName: String, qName: String) { + override def endElement(uri: String, localName: String, qName: String): Unit = { if (uri.equals(XINCLUDE_NAMESPACE) && localName.equals("include")) { level -= 1 @@ -181,13 +181,13 @@ class XIncludeFilter extends XMLFilterImpl { private var depth = 0 - override def startDocument() { + override def startDocument(): Unit = { level = 0 if (depth == 0) super.startDocument() depth += 1 } - override def endDocument() { + override def endDocument(): Unit = { locators.pop() bases.pop() // pop the URL for the document itself depth -= 1 @@ -195,27 +195,27 @@ class XIncludeFilter extends XMLFilterImpl { } // how do prefix mappings move across documents???? - override def startPrefixMapping(prefix: String, uri: String) { + override def startPrefixMapping(prefix: String, uri: String): Unit = { if (level == 0) super.startPrefixMapping(prefix, uri) } - override def endPrefixMapping(prefix: String) { + override def endPrefixMapping(prefix: String): Unit = { if (level == 0) super.endPrefixMapping(prefix) } - override def characters(ch: Array[Char], start: Int, length: Int) { + override def characters(ch: Array[Char], start: Int, length: Int): Unit = { if (level == 0) super.characters(ch, start, length) } - override def ignorableWhitespace(ch: Array[Char], start: Int, length: Int) { + override def ignorableWhitespace(ch: Array[Char], start: Int, length: Int): Unit = { if (level == 0) super.ignorableWhitespace(ch, start, length) } - override def processingInstruction(target: String, data: String) { + override def processingInstruction(target: String, data: String): Unit = { if (level == 0) super.processingInstruction(target, data) } - override def skippedEntity(name: String) { + override def skippedEntity(name: String): Unit = { if (level == 0) super.skippedEntity(name) } @@ -252,7 +252,7 @@ class XIncludeFilter extends XMLFilterImpl { * be downloaded from the specified URL * or if the encoding is not recognized */ - private def includeTextDocument(url: String, encoding1: String) { + private def includeTextDocument(url: String, encoding1: String): Unit = { var encoding = encoding1 if (encoding == null || encoding.trim().equals("")) encoding = "UTF-8" var source: URL = null @@ -318,7 +318,7 @@ class XIncludeFilter extends XMLFilterImpl { * @throws SAXException if the requested document cannot * be downloaded from the specified URL. */ - private def includeXMLDocument(url: String) { + private def includeXMLDocument(url: String): Unit = { val source = try new URL(bases.peek(), url) catch { diff --git a/shared/src/main/scala/scala/xml/include/sax/XIncluder.scala b/shared/src/main/scala/scala/xml/include/sax/XIncluder.scala index ee8375cbf..dfc9408ba 100644 --- a/shared/src/main/scala/scala/xml/include/sax/XIncluder.scala +++ b/shared/src/main/scala/scala/xml/include/sax/XIncluder.scala @@ -25,9 +25,9 @@ class XIncluder(outs: OutputStream, encoding: String) extends ContentHandler wit var out = new OutputStreamWriter(outs, encoding) - def setDocumentLocator(locator: Locator) {} + def setDocumentLocator(locator: Locator): Unit = {} - def startDocument() { + def startDocument(): Unit = { try { out.write("\r\n") @@ -37,7 +37,7 @@ class XIncluder(outs: OutputStream, encoding: String) extends ContentHandler wit } } - def endDocument() { + def endDocument(): Unit = { try { out.flush() } catch { @@ -46,9 +46,9 @@ class XIncluder(outs: OutputStream, encoding: String) extends ContentHandler wit } } - def startPrefixMapping(prefix: String, uri: String) {} + def startPrefixMapping(prefix: String, uri: String): Unit = {} - def endPrefixMapping(prefix: String) {} + def endPrefixMapping(prefix: String): Unit = {} def startElement(namespaceURI: String, localName: String, qualifiedName: String, atts: Attributes) = { try { @@ -71,7 +71,7 @@ class XIncluder(outs: OutputStream, encoding: String) extends ContentHandler wit } } - def endElement(namespaceURI: String, localName: String, qualifiedName: String) { + def endElement(namespaceURI: String, localName: String, qualifiedName: String): Unit = { try { out.write("") } catch { @@ -82,7 +82,7 @@ class XIncluder(outs: OutputStream, encoding: String) extends ContentHandler wit // need to escape characters that are not in the given // encoding using character references???? - def characters(ch: Array[Char], start: Int, length: Int) { + def characters(ch: Array[Char], start: Int, length: Int): Unit = { try { var i = 0; while (i < length) { val c = ch(start + i) @@ -101,12 +101,12 @@ class XIncluder(outs: OutputStream, encoding: String) extends ContentHandler wit } } - def ignorableWhitespace(ch: Array[Char], start: Int, length: Int) { + def ignorableWhitespace(ch: Array[Char], start: Int, length: Int): Unit = { this.characters(ch, start, length) } // do I need to escape text in PI???? - def processingInstruction(target: String, data: String) { + def processingInstruction(target: String, data: String): Unit = { try { out.write("") } catch { @@ -115,7 +115,7 @@ class XIncluder(outs: OutputStream, encoding: String) extends ContentHandler wit } } - def skippedEntity(name: String) { + def skippedEntity(name: String): Unit = { try { out.write("&" + name + ";") } catch { @@ -128,7 +128,7 @@ class XIncluder(outs: OutputStream, encoding: String) extends ContentHandler wit private var inDTD: Boolean = false private val entities = new mutable.Stack[String]() - def startDTD(name: String, publicID: String, systemID: String) { + def startDTD(name: String, publicID: String, systemID: String): Unit = { inDTD = true // if this is the source document, output a DOCTYPE declaration if (entities.isEmpty) { @@ -143,28 +143,28 @@ class XIncluder(outs: OutputStream, encoding: String) extends ContentHandler wit } } } - def endDTD() {} + def endDTD(): Unit = {} - def startEntity(name: String) { + def startEntity(name: String): Unit = { entities push name } - def endEntity(name: String) { + def endEntity(name: String): Unit = { entities.pop() } - def startCDATA() {} - def endCDATA() {} + def startCDATA(): Unit = {} + def endCDATA(): Unit = {} // Just need this reference so we can ask if a comment is // inside an include element or not private var filter: XIncludeFilter = null - def setFilter(filter: XIncludeFilter) { + def setFilter(filter: XIncludeFilter): Unit = { this.filter = filter } - def comment(ch: Array[Char], start: Int, length: Int) { + def comment(ch: Array[Char], start: Int, length: Int): Unit = { if (!inDTD && !filter.insideIncludeElement()) { try { out.write("", Utility.serialize(x, stripComments = false).toString) } + val printableAscii: Seq[Char] = { + (' ' to '/') ++ // Punctuation + ('0' to '9') ++ // Digits + (':' to '@') ++ // Punctuation (cont.) + ('A' to 'Z') ++ // Uppercase + ('[' to '`') ++ // Punctuation (cont.) + ('a' to 'z') ++ // Lowercase + ('{' to '~') // Punctuation (cont.) + } + + val escapedChars: Seq[Char] = + Utility.Escapes.escMap.keys.toSeq + + @Test + def escapePrintablesTest: Unit = { + for { + char <- (printableAscii.diff(escapedChars)) + } yield { + assertEquals(char.toString, Utility.escape(char.toString)) + } + } + + @Test + def escapeEscapablesTest: Unit = { + for { + char <- escapedChars + } yield { + assertNotEquals(char.toString, Utility.escape(char.toString)) + } + } + + @Test + def escapeAsciiControlCharsTest: Unit = { + + /* Escapes that Scala (Java) doesn't support. + * \u0007 -> \a (bell) + * \u001B -> \e (escape) + * \u000B -> \v (vertical tab) + * \u007F -> DEL (delete) + */ + val input = " \u0007\b\u001B\f\n\r\t\u000B\u007F" + + val expect = " \n\r\t\u007F" + + val result = Utility.escape(input) + + assertEquals(printfc(expect), printfc(result)) // Pretty, + assertEquals(expect, result) // but verify. + } + + @Test + def escapeUnicodeExtendedControlCodesTest: Unit = { + for { + char <- ('\u0080' to '\u009f') // Extended control codes (C1) + } yield { + assertEquals(char.toString, Utility.escape(char.toString)) + } + } + + @Test + def escapeUnicodeTwoBytesTest: Unit = { + for { + char <- ('\u00A0' to '\u07FF') // Two bytes (cont.) + } yield { + assertEquals(char.toString, Utility.escape(char.toString)) + } + } + + @Test + def escapeUnicodeThreeBytesTest: Unit = { + for { + char <- ('\u0800' to '\uFFFF') // Three bytes + } yield { + assertEquals(char.toString, Utility.escape(char.toString)) + } + } + + /** + * Human-readable character printing + * + * Think of `od -c` of unix od(1) command. + * + * Or think of `printf("%c", i)` in C, but a little better. + */ + def printfc(str: String) = { + str.map(prettyChar).mkString + } + + /** + * Visual representation of characters that enhances output of + * failed test assertions. + */ + val prettyChar: Map[Char,String] = Map( + '\u0000' -> "\\0", // Null + '\u0001' -> "^A", // Start of header + '\u0002' -> "^B", // Start of text + '\u0003' -> "^C", // End of text + '\u0004' -> "^D", // End of transmission + '\u0005' -> "^E", // Enquiry + '\u0006' -> "^F", // Acknowledgment + '\u0007' -> "\\a", // Bell (^G) + '\b' -> "\\b", // Backspace (^H) + '\t' -> "\\t", // Tab (^I) + '\n' -> "\\n", // Newline (^J) + '\u000B' -> "\\v", // Vertical tab (^K) + '\f' -> "\\f", // Form feed (^L) + '\r' -> "\\r", // Carriage return (^M) + '\u000E' -> "^N", // Shift out + '\u000F' -> "^O", // Shift in + '\u0010' -> "^P", // Data link escape + '\u0011' -> "^Q", // DC1 (XON) + '\u0012' -> "^R", // DC2 + '\u0013' -> "^S", // DC3 (XOFF) + '\u0014' -> "^T", // DC4 + '\u0015' -> "^U", // Negative acknowledgment + '\u0016' -> "^V", // Synchronous idle + '\u0017' -> "^W", // End of transmission block + '\u0018' -> "^X", // Cancel + '\u0019' -> "^Y", // End of medium + '\u001A' -> "^Z", // Substitute + '\u001B' -> "\\e", // Escape + '\u001C' -> "^\\", // File separator + '\u001D' -> "^]", // Group separator + '\u001E' -> "^^", // Record separator + '\u001F' -> "^_", // Unit separator + '\u007F' -> "^?" // Delete + ).toMap.withDefault { + key: Char => key.toString + } } From 4a2dba7362f12930af7554c16648a1e4e0a796a1 Mon Sep 17 00:00:00 2001 From: Manish Date: Sun, 18 Mar 2018 09:41:09 +0530 Subject: [PATCH 210/789] Fix for #193:deprecate XMLEventReader --- shared/src/main/scala/scala/xml/pull/XMLEvent.scala | 1 + shared/src/main/scala/scala/xml/pull/XMLEventReader.scala | 1 + 2 files changed, 2 insertions(+) diff --git a/shared/src/main/scala/scala/xml/pull/XMLEvent.scala b/shared/src/main/scala/scala/xml/pull/XMLEvent.scala index afa63ee0b..7d8cd4eb9 100644 --- a/shared/src/main/scala/scala/xml/pull/XMLEvent.scala +++ b/shared/src/main/scala/scala/xml/pull/XMLEvent.scala @@ -14,6 +14,7 @@ package pull * An XML event for pull parsing. All events received during * parsing will be one of the subclasses of this trait. */ +@deprecated("Consider javax.xml.stream.events.XMLEvent instead.", "1.1.1") trait XMLEvent /** diff --git a/shared/src/main/scala/scala/xml/pull/XMLEventReader.scala b/shared/src/main/scala/scala/xml/pull/XMLEventReader.scala index fbec773e6..fee9060b2 100755 --- a/shared/src/main/scala/scala/xml/pull/XMLEventReader.scala +++ b/shared/src/main/scala/scala/xml/pull/XMLEventReader.scala @@ -24,6 +24,7 @@ import scala.xml.parsing.{ ExternalSources, MarkupHandler, MarkupParser } * @author Burak Emir * @author Paul Phillips */ +@deprecated("Consider javax.xml.stream.XMLEventReader instead.", "1.1.1") class XMLEventReader(src: Source) extends scala.collection.AbstractIterator[XMLEvent] with ProducerConsumerIterator[XMLEvent] { From 562ea8329881112f24aa5ec69953f49b237773dc Mon Sep 17 00:00:00 2001 From: Lukas Rytz Date: Thu, 22 Mar 2018 21:58:40 +0100 Subject: [PATCH 211/789] Seq => collection.Seq Preserve for binary compatability. Scala 2.13 collections rewrite defaults to immutable.Seq. --- jvm/src/test/scala/scala/xml/ReuseNodesTest.scala | 1 + jvm/src/test/scala/scala/xml/SerializationTest.scala | 1 + jvm/src/test/scala/scala/xml/XMLTest.scala | 1 + shared/src/main/scala/scala/xml/Atom.scala | 2 ++ shared/src/main/scala/scala/xml/Attribute.scala | 2 ++ shared/src/main/scala/scala/xml/Document.scala | 2 ++ shared/src/main/scala/scala/xml/Elem.scala | 2 ++ shared/src/main/scala/scala/xml/Equality.scala | 2 ++ shared/src/main/scala/scala/xml/Group.scala | 2 ++ shared/src/main/scala/scala/xml/MetaData.scala | 1 + shared/src/main/scala/scala/xml/NamespaceBinding.scala | 1 + shared/src/main/scala/scala/xml/Node.scala | 2 ++ shared/src/main/scala/scala/xml/NodeSeq.scala | 1 + shared/src/main/scala/scala/xml/Null.scala | 1 + shared/src/main/scala/scala/xml/PrefixedAttribute.scala | 2 ++ shared/src/main/scala/scala/xml/PrettyPrinter.scala | 1 + shared/src/main/scala/scala/xml/TextBuffer.scala | 1 + shared/src/main/scala/scala/xml/UnprefixedAttribute.scala | 2 ++ shared/src/main/scala/scala/xml/Utility.scala | 1 + shared/src/main/scala/scala/xml/Xhtml.scala | 1 + shared/src/main/scala/scala/xml/dtd/ContentModel.scala | 1 + shared/src/main/scala/scala/xml/dtd/DTD.scala | 1 + shared/src/main/scala/scala/xml/dtd/DocType.scala | 2 ++ shared/src/main/scala/scala/xml/dtd/ElementValidator.scala | 1 + shared/src/main/scala/scala/xml/dtd/Scanner.scala | 2 ++ shared/src/main/scala/scala/xml/dtd/impl/BaseBerrySethi.scala | 1 + shared/src/main/scala/scala/xml/dtd/impl/Inclusion.scala | 2 ++ shared/src/main/scala/scala/xml/dtd/impl/NondetWordAutom.scala | 1 + shared/src/main/scala/scala/xml/dtd/impl/WordBerrySethi.scala | 1 + shared/src/main/scala/scala/xml/factory/LoggedNodeFactory.scala | 2 ++ shared/src/main/scala/scala/xml/factory/NodeFactory.scala | 2 ++ shared/src/main/scala/scala/xml/parsing/FactoryAdapter.scala | 1 + .../src/main/scala/scala/xml/parsing/MarkupParserCommon.scala | 1 + .../main/scala/scala/xml/parsing/NoBindingFactoryAdapter.scala | 1 + shared/src/main/scala/scala/xml/parsing/TokenTests.scala | 2 ++ .../src/main/scala/scala/xml/transform/BasicTransformer.scala | 2 ++ shared/src/main/scala/scala/xml/transform/RewriteRule.scala | 2 ++ shared/src/main/scala/scala/xml/transform/RuleTransformer.scala | 2 ++ shared/src/test/scala/scala/xml/AttributeTest.scala | 1 + shared/src/test/scala/scala/xml/PatternMatching.scala | 1 + shared/src/test/scala/scala/xml/Transformers.scala | 1 + shared/src/test/scala/scala/xml/UtilityTest.scala | 1 + shared/src/test/scala/scala/xml/XMLSyntaxTest.scala | 1 + shared/src/test/scala/scala/xml/XMLTest.scala | 1 + 44 files changed, 62 insertions(+) diff --git a/jvm/src/test/scala/scala/xml/ReuseNodesTest.scala b/jvm/src/test/scala/scala/xml/ReuseNodesTest.scala index 586fb92a0..f419a1de4 100644 --- a/jvm/src/test/scala/scala/xml/ReuseNodesTest.scala +++ b/jvm/src/test/scala/scala/xml/ReuseNodesTest.scala @@ -1,6 +1,7 @@ package scala.xml import scala.xml.transform._ +import scala.collection.Seq import org.junit.Assert.assertSame import org.junit.experimental.theories.Theories import org.junit.experimental.theories.Theory diff --git a/jvm/src/test/scala/scala/xml/SerializationTest.scala b/jvm/src/test/scala/scala/xml/SerializationTest.scala index d3f4eb754..37da4c296 100644 --- a/jvm/src/test/scala/scala/xml/SerializationTest.scala +++ b/jvm/src/test/scala/scala/xml/SerializationTest.scala @@ -1,5 +1,6 @@ package scala.xml +import scala.collection.Seq import org.junit.Assert.assertEquals import org.junit.Test diff --git a/jvm/src/test/scala/scala/xml/XMLTest.scala b/jvm/src/test/scala/scala/xml/XMLTest.scala index dfd06aef1..64813c732 100644 --- a/jvm/src/test/scala/scala/xml/XMLTest.scala +++ b/jvm/src/test/scala/scala/xml/XMLTest.scala @@ -11,6 +11,7 @@ import java.io.StringWriter import java.io.ByteArrayOutputStream import java.io.StringReader import scala.collection.Iterable +import scala.collection.Seq import scala.xml.Utility.sort object XMLTestJVM { diff --git a/shared/src/main/scala/scala/xml/Atom.scala b/shared/src/main/scala/scala/xml/Atom.scala index b8ee13397..311157147 100644 --- a/shared/src/main/scala/scala/xml/Atom.scala +++ b/shared/src/main/scala/scala/xml/Atom.scala @@ -9,6 +9,8 @@ package scala package xml +import scala.collection.Seq + /** * The class `Atom` provides an XML node for text (`PCDATA`). * It is used in both non-bound and bound XML representations. diff --git a/shared/src/main/scala/scala/xml/Attribute.scala b/shared/src/main/scala/scala/xml/Attribute.scala index d8ca107fb..4423ad9ab 100644 --- a/shared/src/main/scala/scala/xml/Attribute.scala +++ b/shared/src/main/scala/scala/xml/Attribute.scala @@ -9,6 +9,8 @@ package scala package xml +import scala.collection.Seq + /** * This singleton object contains the `apply` and `unapply` methods for * convenient construction and deconstruction. diff --git a/shared/src/main/scala/scala/xml/Document.scala b/shared/src/main/scala/scala/xml/Document.scala index 672f0284d..6213e0e40 100644 --- a/shared/src/main/scala/scala/xml/Document.scala +++ b/shared/src/main/scala/scala/xml/Document.scala @@ -9,6 +9,8 @@ package scala package xml +import scala.collection.Seq + /** * A document information item (according to InfoSet spec). The comments * are copied from the Infoset spec, only augmented with some information diff --git a/shared/src/main/scala/scala/xml/Elem.scala b/shared/src/main/scala/scala/xml/Elem.scala index 4c308017e..8392255ca 100755 --- a/shared/src/main/scala/scala/xml/Elem.scala +++ b/shared/src/main/scala/scala/xml/Elem.scala @@ -11,6 +11,8 @@ package scala package xml +import scala.collection.Seq + /** * This singleton object contains the `apply` and `unapplySeq` methods for * convenient construction and deconstruction. It is possible to deconstruct diff --git a/shared/src/main/scala/scala/xml/Equality.scala b/shared/src/main/scala/scala/xml/Equality.scala index 44d6a8d4b..9f22fc2fb 100644 --- a/shared/src/main/scala/scala/xml/Equality.scala +++ b/shared/src/main/scala/scala/xml/Equality.scala @@ -9,6 +9,8 @@ package scala package xml +import scala.collection.Seq + /** * In an attempt to contain the damage being inflicted on consistency by the * ad hoc `equals` methods spread around `xml`, the logic is centralized and diff --git a/shared/src/main/scala/scala/xml/Group.scala b/shared/src/main/scala/scala/xml/Group.scala index a539530d8..dc4c19960 100644 --- a/shared/src/main/scala/scala/xml/Group.scala +++ b/shared/src/main/scala/scala/xml/Group.scala @@ -9,6 +9,8 @@ package scala package xml +import scala.collection.Seq + /** * A hack to group XML nodes in one node for output. * diff --git a/shared/src/main/scala/scala/xml/MetaData.scala b/shared/src/main/scala/scala/xml/MetaData.scala index 48e7173d9..1affff4e0 100644 --- a/shared/src/main/scala/scala/xml/MetaData.scala +++ b/shared/src/main/scala/scala/xml/MetaData.scala @@ -14,6 +14,7 @@ package xml import Utility.sbToString import scala.annotation.tailrec import scala.collection.AbstractIterable +import scala.collection.Seq object MetaData { /** diff --git a/shared/src/main/scala/scala/xml/NamespaceBinding.scala b/shared/src/main/scala/scala/xml/NamespaceBinding.scala index 7bc2ca43d..e8ad08f77 100644 --- a/shared/src/main/scala/scala/xml/NamespaceBinding.scala +++ b/shared/src/main/scala/scala/xml/NamespaceBinding.scala @@ -9,6 +9,7 @@ package scala package xml +import scala.collection.Seq import Utility.sbToString /** diff --git a/shared/src/main/scala/scala/xml/Node.scala b/shared/src/main/scala/scala/xml/Node.scala index 57ed966e3..f62edabda 100755 --- a/shared/src/main/scala/scala/xml/Node.scala +++ b/shared/src/main/scala/scala/xml/Node.scala @@ -9,6 +9,8 @@ package scala package xml +import scala.collection.Seq + /** * This singleton object contains the `unapplySeq` method for * convenient deconstruction. diff --git a/shared/src/main/scala/scala/xml/NodeSeq.scala b/shared/src/main/scala/scala/xml/NodeSeq.scala index bc88aca19..f93c6249e 100644 --- a/shared/src/main/scala/scala/xml/NodeSeq.scala +++ b/shared/src/main/scala/scala/xml/NodeSeq.scala @@ -13,6 +13,7 @@ import scala.collection.{ mutable, immutable, generic, SeqLike, AbstractSeq } import mutable.{ Builder, ListBuffer } import generic.{ CanBuildFrom } import scala.language.implicitConversions +import scala.collection.Seq /** * This object ... diff --git a/shared/src/main/scala/scala/xml/Null.scala b/shared/src/main/scala/scala/xml/Null.scala index 9d6a5c9af..6e438a53b 100644 --- a/shared/src/main/scala/scala/xml/Null.scala +++ b/shared/src/main/scala/scala/xml/Null.scala @@ -11,6 +11,7 @@ package xml import Utility.isNameStart import scala.collection.Iterator +import scala.collection.Seq /** * Essentially, every method in here is a dummy, returning Zero[T]. diff --git a/shared/src/main/scala/scala/xml/PrefixedAttribute.scala b/shared/src/main/scala/scala/xml/PrefixedAttribute.scala index f269ba748..b1408d287 100644 --- a/shared/src/main/scala/scala/xml/PrefixedAttribute.scala +++ b/shared/src/main/scala/scala/xml/PrefixedAttribute.scala @@ -9,6 +9,8 @@ package scala package xml +import scala.collection.Seq + /** * prefixed attributes always have a non-null namespace. * diff --git a/shared/src/main/scala/scala/xml/PrettyPrinter.scala b/shared/src/main/scala/scala/xml/PrettyPrinter.scala index 6cb3f6cdb..b5f41d157 100755 --- a/shared/src/main/scala/scala/xml/PrettyPrinter.scala +++ b/shared/src/main/scala/scala/xml/PrettyPrinter.scala @@ -9,6 +9,7 @@ package scala package xml +import scala.collection.Seq import Utility.sbToString /** diff --git a/shared/src/main/scala/scala/xml/TextBuffer.scala b/shared/src/main/scala/scala/xml/TextBuffer.scala index 0206b2e3e..8ab2a53e4 100644 --- a/shared/src/main/scala/scala/xml/TextBuffer.scala +++ b/shared/src/main/scala/scala/xml/TextBuffer.scala @@ -9,6 +9,7 @@ package scala package xml +import scala.collection.Seq import Utility.isSpace object TextBuffer { diff --git a/shared/src/main/scala/scala/xml/UnprefixedAttribute.scala b/shared/src/main/scala/scala/xml/UnprefixedAttribute.scala index db89b8913..d7ead87dc 100644 --- a/shared/src/main/scala/scala/xml/UnprefixedAttribute.scala +++ b/shared/src/main/scala/scala/xml/UnprefixedAttribute.scala @@ -9,6 +9,8 @@ package scala package xml +import scala.collection.Seq + /** * Unprefixed attributes have the null namespace, and no prefix field * diff --git a/shared/src/main/scala/scala/xml/Utility.scala b/shared/src/main/scala/scala/xml/Utility.scala index ce14fbc85..b40adf2d8 100755 --- a/shared/src/main/scala/scala/xml/Utility.scala +++ b/shared/src/main/scala/scala/xml/Utility.scala @@ -11,6 +11,7 @@ package xml import scala.collection.mutable import scala.language.implicitConversions +import scala.collection.Seq /** * The `Utility` object provides utility functions for processing instances diff --git a/shared/src/main/scala/scala/xml/Xhtml.scala b/shared/src/main/scala/scala/xml/Xhtml.scala index ad5fbeda0..5d89101e0 100644 --- a/shared/src/main/scala/scala/xml/Xhtml.scala +++ b/shared/src/main/scala/scala/xml/Xhtml.scala @@ -4,6 +4,7 @@ package xml import parsing.XhtmlEntities import Utility.{ sbToString, isAtomAndNotText } +import scala.collection.Seq /* (c) David Pollak 2007 WorldWide Conferencing, LLC */ diff --git a/shared/src/main/scala/scala/xml/dtd/ContentModel.scala b/shared/src/main/scala/scala/xml/dtd/ContentModel.scala index 32d07c6c1..a36674d61 100644 --- a/shared/src/main/scala/scala/xml/dtd/ContentModel.scala +++ b/shared/src/main/scala/scala/xml/dtd/ContentModel.scala @@ -10,6 +10,7 @@ package scala package xml package dtd +import scala.collection.Seq import scala.xml.dtd.impl._ import scala.xml.Utility.sbToString import PartialFunction._ diff --git a/shared/src/main/scala/scala/xml/dtd/DTD.scala b/shared/src/main/scala/scala/xml/dtd/DTD.scala index 51ab31226..f01fe5a0a 100644 --- a/shared/src/main/scala/scala/xml/dtd/DTD.scala +++ b/shared/src/main/scala/scala/xml/dtd/DTD.scala @@ -11,6 +11,7 @@ package xml package dtd import scala.collection.mutable +import scala.collection.Seq /** * A document type declaration. diff --git a/shared/src/main/scala/scala/xml/dtd/DocType.scala b/shared/src/main/scala/scala/xml/dtd/DocType.scala index f78403440..4bc78b1a2 100644 --- a/shared/src/main/scala/scala/xml/dtd/DocType.scala +++ b/shared/src/main/scala/scala/xml/dtd/DocType.scala @@ -10,6 +10,8 @@ package scala package xml package dtd +import scala.collection.Seq + /** * An XML node for document type declaration. * diff --git a/shared/src/main/scala/scala/xml/dtd/ElementValidator.scala b/shared/src/main/scala/scala/xml/dtd/ElementValidator.scala index 4d5ff979d..c30c2af17 100644 --- a/shared/src/main/scala/scala/xml/dtd/ElementValidator.scala +++ b/shared/src/main/scala/scala/xml/dtd/ElementValidator.scala @@ -12,6 +12,7 @@ package dtd import PartialFunction._ import scala.collection.mutable +import scala.collection.Seq import ContentModel.ElemName import MakeValidationException._ // @todo other exceptions diff --git a/shared/src/main/scala/scala/xml/dtd/Scanner.scala b/shared/src/main/scala/scala/xml/dtd/Scanner.scala index 24160cddc..425f3cd7f 100644 --- a/shared/src/main/scala/scala/xml/dtd/Scanner.scala +++ b/shared/src/main/scala/scala/xml/dtd/Scanner.scala @@ -10,6 +10,8 @@ package scala package xml package dtd +import scala.collection.Seq + /** * Scanner for regexps (content models in DTD element declarations) * todo: cleanup diff --git a/shared/src/main/scala/scala/xml/dtd/impl/BaseBerrySethi.scala b/shared/src/main/scala/scala/xml/dtd/impl/BaseBerrySethi.scala index e7c68e2ed..869ed9ae4 100644 --- a/shared/src/main/scala/scala/xml/dtd/impl/BaseBerrySethi.scala +++ b/shared/src/main/scala/scala/xml/dtd/impl/BaseBerrySethi.scala @@ -10,6 +10,7 @@ package scala package xml.dtd.impl import scala.collection.{ mutable, immutable } +import scala.collection.Seq // todo: replace global variable pos with acc diff --git a/shared/src/main/scala/scala/xml/dtd/impl/Inclusion.scala b/shared/src/main/scala/scala/xml/dtd/impl/Inclusion.scala index 0f1e201b0..709c2c530 100644 --- a/shared/src/main/scala/scala/xml/dtd/impl/Inclusion.scala +++ b/shared/src/main/scala/scala/xml/dtd/impl/Inclusion.scala @@ -9,6 +9,8 @@ package scala package xml.dtd.impl +import scala.collection.Seq + /** * A fast test of language inclusion between minimal automata. * inspired by the ''AMoRE automata library''. diff --git a/shared/src/main/scala/scala/xml/dtd/impl/NondetWordAutom.scala b/shared/src/main/scala/scala/xml/dtd/impl/NondetWordAutom.scala index 07beed479..09f1b1d3f 100644 --- a/shared/src/main/scala/scala/xml/dtd/impl/NondetWordAutom.scala +++ b/shared/src/main/scala/scala/xml/dtd/impl/NondetWordAutom.scala @@ -10,6 +10,7 @@ package scala package xml.dtd.impl import scala.collection.{ immutable, mutable } +import scala.collection.Seq /** * A nondeterministic automaton. States are integers, where diff --git a/shared/src/main/scala/scala/xml/dtd/impl/WordBerrySethi.scala b/shared/src/main/scala/scala/xml/dtd/impl/WordBerrySethi.scala index e96cd1299..3f0ef361f 100644 --- a/shared/src/main/scala/scala/xml/dtd/impl/WordBerrySethi.scala +++ b/shared/src/main/scala/scala/xml/dtd/impl/WordBerrySethi.scala @@ -10,6 +10,7 @@ package scala package xml.dtd.impl import scala.collection.{ immutable, mutable } +import scala.collection.Seq /** * This class turns a regular expression into a [[scala.util.automata.NondetWordAutom]] diff --git a/shared/src/main/scala/scala/xml/factory/LoggedNodeFactory.scala b/shared/src/main/scala/scala/xml/factory/LoggedNodeFactory.scala index e8189eb7f..10bf57f56 100644 --- a/shared/src/main/scala/scala/xml/factory/LoggedNodeFactory.scala +++ b/shared/src/main/scala/scala/xml/factory/LoggedNodeFactory.scala @@ -10,6 +10,8 @@ package scala package xml package factory +import scala.collection.Seq + /** * This class logs what the nodefactory is actually doing. * If you want to see what happens during loading, use it like this: diff --git a/shared/src/main/scala/scala/xml/factory/NodeFactory.scala b/shared/src/main/scala/scala/xml/factory/NodeFactory.scala index 283fd8fd5..2ca162952 100644 --- a/shared/src/main/scala/scala/xml/factory/NodeFactory.scala +++ b/shared/src/main/scala/scala/xml/factory/NodeFactory.scala @@ -10,6 +10,8 @@ package scala package xml package factory +import scala.collection.Seq + trait NodeFactory[A <: Node] { val ignoreComments = false val ignoreProcInstr = false diff --git a/shared/src/main/scala/scala/xml/parsing/FactoryAdapter.scala b/shared/src/main/scala/scala/xml/parsing/FactoryAdapter.scala index 607a0aace..d181621dd 100644 --- a/shared/src/main/scala/scala/xml/parsing/FactoryAdapter.scala +++ b/shared/src/main/scala/scala/xml/parsing/FactoryAdapter.scala @@ -11,6 +11,7 @@ package xml package parsing import scala.collection.{ mutable, Iterator } +import scala.collection.Seq import org.xml.sax.Attributes import org.xml.sax.helpers.DefaultHandler diff --git a/shared/src/main/scala/scala/xml/parsing/MarkupParserCommon.scala b/shared/src/main/scala/scala/xml/parsing/MarkupParserCommon.scala index 2685f0632..a6b2ec187 100644 --- a/shared/src/main/scala/scala/xml/parsing/MarkupParserCommon.scala +++ b/shared/src/main/scala/scala/xml/parsing/MarkupParserCommon.scala @@ -10,6 +10,7 @@ package scala package xml package parsing +import scala.collection.Seq import Utility.SU /** diff --git a/shared/src/main/scala/scala/xml/parsing/NoBindingFactoryAdapter.scala b/shared/src/main/scala/scala/xml/parsing/NoBindingFactoryAdapter.scala index 92675897d..8b0711aa0 100644 --- a/shared/src/main/scala/scala/xml/parsing/NoBindingFactoryAdapter.scala +++ b/shared/src/main/scala/scala/xml/parsing/NoBindingFactoryAdapter.scala @@ -10,6 +10,7 @@ package scala package xml package parsing +import scala.collection.Seq import factory.NodeFactory /** diff --git a/shared/src/main/scala/scala/xml/parsing/TokenTests.scala b/shared/src/main/scala/scala/xml/parsing/TokenTests.scala index 5e277dcde..3db0ece88 100644 --- a/shared/src/main/scala/scala/xml/parsing/TokenTests.scala +++ b/shared/src/main/scala/scala/xml/parsing/TokenTests.scala @@ -10,6 +10,8 @@ package scala package xml package parsing +import scala.collection.Seq + /** * Helper functions for parsing XML fragments */ diff --git a/shared/src/main/scala/scala/xml/transform/BasicTransformer.scala b/shared/src/main/scala/scala/xml/transform/BasicTransformer.scala index fd0d9560f..7d659d5f4 100644 --- a/shared/src/main/scala/scala/xml/transform/BasicTransformer.scala +++ b/shared/src/main/scala/scala/xml/transform/BasicTransformer.scala @@ -10,6 +10,8 @@ package scala package xml package transform +import scala.collection.Seq + /** * A class for XML transformations. * diff --git a/shared/src/main/scala/scala/xml/transform/RewriteRule.scala b/shared/src/main/scala/scala/xml/transform/RewriteRule.scala index c6b9df923..b9374e7e5 100644 --- a/shared/src/main/scala/scala/xml/transform/RewriteRule.scala +++ b/shared/src/main/scala/scala/xml/transform/RewriteRule.scala @@ -10,6 +10,8 @@ package scala package xml package transform +import scala.collection.Seq + /** * A RewriteRule, when applied to a term, yields either * the result of rewriting the term or the term itself if the rule diff --git a/shared/src/main/scala/scala/xml/transform/RuleTransformer.scala b/shared/src/main/scala/scala/xml/transform/RuleTransformer.scala index c9a57f17d..1b71071cb 100644 --- a/shared/src/main/scala/scala/xml/transform/RuleTransformer.scala +++ b/shared/src/main/scala/scala/xml/transform/RuleTransformer.scala @@ -10,6 +10,8 @@ package scala package xml package transform +import scala.collection.Seq + class RuleTransformer(rules: RewriteRule*) extends BasicTransformer { override def transform(n: Node): Seq[Node] = rules.foldLeft(super.transform(n)) { (res, rule) => rule transform res } diff --git a/shared/src/test/scala/scala/xml/AttributeTest.scala b/shared/src/test/scala/scala/xml/AttributeTest.scala index 8943a0a00..0b3891496 100644 --- a/shared/src/test/scala/scala/xml/AttributeTest.scala +++ b/shared/src/test/scala/scala/xml/AttributeTest.scala @@ -1,5 +1,6 @@ package scala.xml +import scala.collection.Seq import org.junit.Test import org.junit.Assert.assertEquals diff --git a/shared/src/test/scala/scala/xml/PatternMatching.scala b/shared/src/test/scala/scala/xml/PatternMatching.scala index fbf94b62b..41644cec1 100644 --- a/shared/src/test/scala/scala/xml/PatternMatching.scala +++ b/shared/src/test/scala/scala/xml/PatternMatching.scala @@ -1,5 +1,6 @@ package scala.xml +import scala.collection.Seq import org.junit.Test import org.junit.Assert.assertTrue import org.junit.Assert.assertEquals diff --git a/shared/src/test/scala/scala/xml/Transformers.scala b/shared/src/test/scala/scala/xml/Transformers.scala index 5cec41080..146a480a3 100644 --- a/shared/src/test/scala/scala/xml/Transformers.scala +++ b/shared/src/test/scala/scala/xml/Transformers.scala @@ -1,5 +1,6 @@ package scala.xml +import scala.collection.Seq import scala.xml.transform._ import org.junit.Test diff --git a/shared/src/test/scala/scala/xml/UtilityTest.scala b/shared/src/test/scala/scala/xml/UtilityTest.scala index b365294c9..44db70d67 100644 --- a/shared/src/test/scala/scala/xml/UtilityTest.scala +++ b/shared/src/test/scala/scala/xml/UtilityTest.scala @@ -1,5 +1,6 @@ package scala.xml +import scala.collection.Seq import org.junit.Test import org.junit.Assert.assertTrue import org.junit.Assert.assertEquals diff --git a/shared/src/test/scala/scala/xml/XMLSyntaxTest.scala b/shared/src/test/scala/scala/xml/XMLSyntaxTest.scala index 89b9bdbbc..913c027f0 100644 --- a/shared/src/test/scala/scala/xml/XMLSyntaxTest.scala +++ b/shared/src/test/scala/scala/xml/XMLSyntaxTest.scala @@ -1,5 +1,6 @@ package scala.xml +import scala.collection.Seq import org.junit.Test import org.junit.Assert.assertTrue import org.junit.Assert.assertFalse diff --git a/shared/src/test/scala/scala/xml/XMLTest.scala b/shared/src/test/scala/scala/xml/XMLTest.scala index 43366300b..6147f56b4 100644 --- a/shared/src/test/scala/scala/xml/XMLTest.scala +++ b/shared/src/test/scala/scala/xml/XMLTest.scala @@ -9,6 +9,7 @@ import org.junit.Assert.assertEquals // import scala.xml.parsing.ConstructingParser import java.io.StringWriter import scala.collection.Iterable +import scala.collection.Seq import scala.xml.Utility.sort object XMLTest { From 59dd7425752dfdc4dbc5fe56dddaa3c34e368b7a Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Mon, 16 Apr 2018 00:55:28 -0400 Subject: [PATCH 212/789] Convert BitSet.toSet Fix compiler error with Scala 2.13 collections rewrite: ambiguous reference to overloaded definition, both method map in trait StrictOptimizedIterableOps of type [B](f: Int => B)scala.collection.immutable.Set[B] and method map in trait SortedSetOps of type [B](f: Int => B)(implicit evidence$4: Ordering[B])scala.collection.immutable.SortedSet[B] match argument types (Int => scala.collection.immutable.BitSet) (Q map f).foldLeft(immutable.BitSet.empty)(_ ++ _) ^ --- shared/src/main/scala/scala/xml/dtd/impl/NondetWordAutom.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shared/src/main/scala/scala/xml/dtd/impl/NondetWordAutom.scala b/shared/src/main/scala/scala/xml/dtd/impl/NondetWordAutom.scala index 09f1b1d3f..91fdf86c0 100644 --- a/shared/src/main/scala/scala/xml/dtd/impl/NondetWordAutom.scala +++ b/shared/src/main/scala/scala/xml/dtd/impl/NondetWordAutom.scala @@ -48,7 +48,7 @@ private[dtd] abstract class NondetWordAutom[T <: AnyRef] { def nextDefault(Q: immutable.BitSet): immutable.BitSet = next(Q, default) private def next(Q: immutable.BitSet, f: (Int) => immutable.BitSet): immutable.BitSet = - (Q map f).foldLeft(immutable.BitSet.empty)(_ ++ _) + Q.toSet.map(f).foldLeft(immutable.BitSet.empty)(_ ++ _) private def finalStates = 0 until nstates filter isFinal override def toString = { From b1331176d45b9308f661a2a70830cda5927bfda9 Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Mon, 16 Apr 2018 00:57:50 -0400 Subject: [PATCH 213/789] Use immutable.Map and val Compiler complains after Scala 2.13 collections rewrite that value updated is not a member of scala.collection.Map --- .../scala/xml/dtd/impl/SubsetConstruction.scala | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/shared/src/main/scala/scala/xml/dtd/impl/SubsetConstruction.scala b/shared/src/main/scala/scala/xml/dtd/impl/SubsetConstruction.scala index 6b74839fd..2dddfdcec 100644 --- a/shared/src/main/scala/scala/xml/dtd/impl/SubsetConstruction.scala +++ b/shared/src/main/scala/scala/xml/dtd/impl/SubsetConstruction.scala @@ -20,8 +20,8 @@ private[dtd] class SubsetConstruction[T <: AnyRef](val nfa: NondetWordAutom[T]) def determinize: DetWordAutom[T] = { // for assigning numbers to bitsets - var indexMap = scala.collection.Map[immutable.BitSet, Int]() - var invIndexMap = scala.collection.Map[Int, immutable.BitSet]() + val indexMap = mutable.Map[immutable.BitSet, Int]() + val invIndexMap = mutable.Map[Int, immutable.BitSet]() var ix = 0 // we compute the dfa with states = bitsets @@ -30,15 +30,15 @@ private[dtd] class SubsetConstruction[T <: AnyRef](val nfa: NondetWordAutom[T]) var states = Set(q0, sink) // initial set of sets val delta = new mutable.HashMap[immutable.BitSet, mutable.HashMap[T, immutable.BitSet]] - var deftrans = mutable.Map(q0 -> sink, sink -> sink) // initial transitions - var finals: mutable.Map[immutable.BitSet, Int] = mutable.Map() + val deftrans = mutable.Map(q0 -> sink, sink -> sink) // initial transitions + val finals: mutable.Map[immutable.BitSet, Int] = mutable.Map() val rest = new mutable.Stack[immutable.BitSet] rest.push(sink, q0) def addFinal(q: immutable.BitSet): Unit = { if (nfa containsFinal q) - finals = finals.updated(q, selectTag(q, nfa.finals)) + finals(q) = selectTag(q, nfa.finals) } def add(Q: immutable.BitSet): Unit = { if (!states(Q)) { @@ -53,8 +53,8 @@ private[dtd] class SubsetConstruction[T <: AnyRef](val nfa: NondetWordAutom[T]) while (!rest.isEmpty) { val P = rest.pop() // assign a number to this bitset - indexMap = indexMap.updated(P, ix) - invIndexMap = invIndexMap.updated(ix, P) + indexMap(P) = ix + invIndexMap(ix) = P ix += 1 // make transition map @@ -69,7 +69,7 @@ private[dtd] class SubsetConstruction[T <: AnyRef](val nfa: NondetWordAutom[T]) // collect default transitions val Pdef = nfa nextDefault P - deftrans = deftrans.updated(P, Pdef) + deftrans(P) = Pdef add(Pdef) } From 4d1d67ad093a573797f1f832cd64252052a6d1f7 Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Mon, 16 Apr 2018 01:13:35 -0400 Subject: [PATCH 214/789] Use StringBuilder.setLength Compiler complains with new Scala 2.13 collection reassignment to val cbuf.length = 0 ^ --- .../scala/scala/xml/parsing/MarkupParser.scala | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/shared/src/main/scala/scala/xml/parsing/MarkupParser.scala b/shared/src/main/scala/scala/xml/parsing/MarkupParser.scala index 0bea3784e..81d5b82cc 100755 --- a/shared/src/main/scala/scala/xml/parsing/MarkupParser.scala +++ b/shared/src/main/scala/scala/xml/parsing/MarkupParser.scala @@ -358,7 +358,7 @@ trait MarkupParser extends MarkupParserCommon with TokenTests { } nextch() val str = cbuf.toString() - cbuf.length = 0 + cbuf.setLength(0) str } @@ -390,7 +390,7 @@ trait MarkupParser extends MarkupParserCommon with TokenTests { xToken("--") while (!eof) { if (ch == '-' && { sb.append(ch); nextch(); ch == '-' }) { - sb.length = sb.length - 1 + sb.setLength(sb.length - 1) nextch() xToken('>') return handle.comment(pos, sb.toString()) @@ -608,7 +608,7 @@ trait MarkupParser extends MarkupParserCommon with TokenTests { exit = eof || (ch == '<') || (ch == '&') } val str = cbuf.toString - cbuf.length = 0 + cbuf.setLength(0) str } @@ -630,7 +630,7 @@ trait MarkupParser extends MarkupParserCommon with TokenTests { } nextch() val str = cbuf.toString() - cbuf.length = 0 + cbuf.setLength(0) str } @@ -653,7 +653,7 @@ trait MarkupParser extends MarkupParserCommon with TokenTests { } nextch() val str = cbuf.toString - cbuf.length = 0 + cbuf.setLength(0) str } @@ -799,7 +799,7 @@ trait MarkupParser extends MarkupParserCommon with TokenTests { //Console.println("END["+ch+"]") nextch() val cmstr = cbuf.toString() - cbuf.length = 0 + cbuf.setLength(0) handle.elemDecl(n, cmstr) } @@ -826,7 +826,7 @@ trait MarkupParser extends MarkupParserCommon with TokenTests { nextch() } val atpe = cbuf.toString - cbuf.length = 0 + cbuf.setLength(0) val defdecl: DefaultDecl = ch match { case '\'' | '"' => @@ -846,7 +846,7 @@ trait MarkupParser extends MarkupParserCommon with TokenTests { xSpaceOpt() attList ::= AttrDecl(aname, atpe, defdecl) - cbuf.length = 0 + cbuf.setLength(0) } nextch() handle.attListDecl(n, attList.reverse) From 9b4e969b69f289311823e613c017e9ad009a1c31 Mon Sep 17 00:00:00 2001 From: Ethan Joachim Eldridge Date: Wed, 5 Oct 2016 23:46:51 -0400 Subject: [PATCH 215/789] Unit tests for Issue #73 --- .../test/scala/scala/xml/UtilityTest.scala | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/shared/src/test/scala/scala/xml/UtilityTest.scala b/shared/src/test/scala/scala/xml/UtilityTest.scala index 44db70d67..a27fb0b1a 100644 --- a/shared/src/test/scala/scala/xml/UtilityTest.scala +++ b/shared/src/test/scala/scala/xml/UtilityTest.scala @@ -194,4 +194,27 @@ class UtilityTest { ).toMap.withDefault { key: Char => key.toString } + + def issue73StartsWithAndEndsWithWSInFirst: Unit = { + val x =
{Text(" My name is ")}{Text("Harry")}
+ assertEquals(
My name is Harry
, Utility.trim(x)) + } + + @Test + def issue73EndsWithWSInLast: Unit = { + val x =
{Text("My name is ")}{Text("Harry ")}
+ assertEquals(
My name is Harry
, Utility.trim(x)) + } + + @Test + def issue73HasWSInMiddle: Unit = { + val x =
{Text("My name is")}{Text(" ")}{Text("Harry")}
+ assertEquals(
My name is Harry
, Utility.trim(x)) + } + + @Test + def issue73HasWSEverywhere: Unit = { + val x =
{Text(" My name ")}{Text(" is ")}{Text(" Harry ")}
+ assertEquals(
My name is Harry
, Utility.trim(x)) + } } From 1e3b2883c88f8824f71194072348bc59f23561fd Mon Sep 17 00:00:00 2001 From: Ethan Joachim Eldridge Date: Thu, 6 Oct 2016 00:10:47 -0400 Subject: [PATCH 216/789] Unit tests for #73 passing --- shared/src/main/scala/scala/xml/Utility.scala | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/shared/src/main/scala/scala/xml/Utility.scala b/shared/src/main/scala/scala/xml/Utility.scala index b40adf2d8..2f528e1eb 100755 --- a/shared/src/main/scala/scala/xml/Utility.scala +++ b/shared/src/main/scala/scala/xml/Utility.scala @@ -46,17 +46,28 @@ object Utility extends AnyRef with parsing.TokenTests { */ def trim(x: Node): Node = x match { case Elem(pre, lab, md, scp, child@_*) => - val children = child flatMap trimProper + val children = combineAdjacentTextNodes(child:_*) flatMap trimProper Elem(pre, lab, md, scp, children.isEmpty, children: _*) } + private def combineAdjacentTextNodes(children: Node*): Seq[Node] = { + children.foldLeft(Seq.empty[Node]) { (acc, n) => + (acc.lastOption, n) match { + case (Some(Text(l)), Text(r)) => { + acc.dropRight(1) :+ Text(l + r) + } + case _ => acc :+ n + } + } + } + /** * trim a child of an element. `Attribute` values and `Atom` nodes that * are not `Text` nodes are unaffected. */ def trimProper(x: Node): Seq[Node] = x match { case Elem(pre, lab, md, scp, child@_*) => - val children = child flatMap trimProper + val children = combineAdjacentTextNodes(child:_*) flatMap trimProper Elem(pre, lab, md, scp, children.isEmpty, children: _*) case Text(s) => new TextBuffer().append(s).toText From 361d02e1f18984e353e6eaf8df6ec40ea2e3da51 Mon Sep 17 00:00:00 2001 From: Ethan Eldridge Date: Fri, 11 May 2018 10:16:40 -0400 Subject: [PATCH 217/789] Improve combineAdjacentTextNodes logic Remove lastOption and Option matching in favor of a more elegant foldRight solution proposed by ashawley. --- shared/src/main/scala/scala/xml/Utility.scala | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/shared/src/main/scala/scala/xml/Utility.scala b/shared/src/main/scala/scala/xml/Utility.scala index 2f528e1eb..88f6e8cd0 100755 --- a/shared/src/main/scala/scala/xml/Utility.scala +++ b/shared/src/main/scala/scala/xml/Utility.scala @@ -51,13 +51,9 @@ object Utility extends AnyRef with parsing.TokenTests { } private def combineAdjacentTextNodes(children: Node*): Seq[Node] = { - children.foldLeft(Seq.empty[Node]) { (acc, n) => - (acc.lastOption, n) match { - case (Some(Text(l)), Text(r)) => { - acc.dropRight(1) :+ Text(l + r) - } - case _ => acc :+ n - } + children.foldRight(Seq.empty[Node]) { + case (Text(left), Text(right) +: accMinusLast) => Text(left + right) +: accMinusLast + case (n, acc) => n +: acc } } From 245c276f2ced5f861bd7d53154d1c977d9298721 Mon Sep 17 00:00:00 2001 From: Seth Tisue Date: Thu, 17 May 2018 18:32:25 +0200 Subject: [PATCH 218/789] use latest sbt-scala-module the release notes promise more JDK9 friendliness, which interests me in case it helps in the 2.12.x/JDK9 community build. but also just generally good to have all the modules on the latest. --- project/plugins.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/plugins.sbt b/project/plugins.sbt index ddba7a8b5..fdd0d207a 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,3 +1,3 @@ -addSbtPlugin("org.scala-lang.modules" % "sbt-scala-module" % "1.0.12") +addSbtPlugin("org.scala-lang.modules" % "sbt-scala-module" % "1.0.14") addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.22") From 526dbffb1dfe0dbb6ee1c798d8810a63c210b692 Mon Sep 17 00:00:00 2001 From: Seth Tisue Date: Fri, 18 May 2018 21:50:25 +0200 Subject: [PATCH 219/789] choose an sbt-osgi version according to JVM version since no single version works on both Java 6 and 9 --- project/plugins.sbt | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/project/plugins.sbt b/project/plugins.sbt index fdd0d207a..7974aa440 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,3 +1,10 @@ addSbtPlugin("org.scala-lang.modules" % "sbt-scala-module" % "1.0.14") +if (System.getProperty("java.version").startsWith("1.")) + Seq() +else + // override to version that works on Java 9, + // see https://github.com/scala/sbt-scala-module/issues/35 + Seq(addSbtPlugin("com.typesafe.sbt" % "sbt-osgi" % "0.9.3")) + addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.22") From 44a6c34bb044794680f4182cd3acdee060ebcaf2 Mon Sep 17 00:00:00 2001 From: Lukas Rytz Date: Fri, 18 May 2018 22:04:53 +0200 Subject: [PATCH 220/789] Unnecessary gitignore entry --- .gitignore | 2 -- 1 file changed, 2 deletions(-) diff --git a/.gitignore b/.gitignore index f236bdfa0..5a0cc72f4 100644 --- a/.gitignore +++ b/.gitignore @@ -12,8 +12,6 @@ *.jar *~ -build.properties - # target directories for ant build /build/ /dists/ From 482e50ccfb30eda6dcf4cc23d72a67b9c0b0a563 Mon Sep 17 00:00:00 2001 From: Lukas Rytz Date: Fri, 18 May 2018 22:46:23 +0200 Subject: [PATCH 221/789] No more scalaVersionsByJvm --- .travis.yml | 43 +++++++++++++++++++++---------- admin/README.md | 37 +++++++++++++------------- admin/build.sh | 53 +++++++++++++++++--------------------- admin/publish-settings.sbt | 13 +++++----- build.sbt | 27 +++++++------------ project/plugins.sbt | 9 ++++--- 6 files changed, 94 insertions(+), 88 deletions(-) diff --git a/.travis.yml b/.travis.yml index 57da53855..aec75a4d1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,8 +1,20 @@ -# opt-in to Travis's newer/faster container-based infrastructure -sudo: false - language: scala +addons: + apt: + packages: + - openjdk-6-jdk + +jdk: + - openjdk6 + - oraclejdk8 + - oraclejdk9 + +scala: + - 2.11.12 + - 2.12.4 + - 2.13.0-M3 + env: global: # PGP_PASSPHRASE @@ -11,18 +23,23 @@ env: - secure: "OpBwPc1GNvauageYOH3RscAa7wpZxgpmqDz15aigIKLNWzAhAtVUx0MleZ8rQeoqml6nrAvlnzuVHjKL2lVcjMPpjUis7bcQ5UAGK7tZK8x+qZNQxXmpXu8+pENwQA2yFaqt/xy7K5jFOrHJHTRxcPnyVG1yKakPWz53PPYUwbc=" # SONA_PASS - secure: "Xw7rI/qlML1nD2e2XwlakkhKAWNGZKqqE+Q3ntTvFpfHryl7KLCvVzJ4LIavnL6kGJaWOgy9vlSoEWn5g9nqHSfE31C/k5pY5nTMAKiwiJzfAS+r0asKXW2gmKhwtcTBkqyLVOZLCJSPVlFRQyfBJHY+Fs0L3KWcnMQgtBlyDhU=" + matrix: + - SCALAJS_VERSION= + - SCALAJS_VERSION=0.6.23 + - SCALAJS_VERSION=1.0.0-M3 -script: admin/build.sh - -addons: - apt: - packages: - - openjdk-6-jdk +matrix: + exclude: + - scala: 2.13.0-M3 + env: SCALAJS_VERSION=1.0.0-M3 + - scala: 2.12.4 + jdk: openjdk6 + - scala: 2.13.0-M3 + jdk: openjdk6 -jdk: - - openjdk6 - - oraclejdk8 - - oraclejdk9 +script: + - if [[ "$TRAVIS_JDK_VERSION" == "openjdk6" && "$TRAVIS_SCALA_VERSION" =~ 2\.11\..* || "$TRAVIS_JDK_VERSION" == "oraclejdk8" && "$TRAVIS_SCALA_VERSION" =~ 2\.1[23]\..* ]]; then export RELEASE_COMBO=true; fi + - admin/build.sh notifications: email: adriaan.moors@lightbend.com diff --git a/admin/README.md b/admin/README.md index 46626b4e5..92e96e6d2 100644 --- a/admin/README.md +++ b/admin/README.md @@ -1,11 +1,5 @@ ## Tag Driven Releasing -### Background Reading - - - http://docs.travis-ci.com/user/environment-variables/ - - http://docs.travis-ci.com/user/encryption-keys/ - - http://docs.travis-ci.com/user/encrypting-files/ - ### Initial setup for the repository To configure tag driven releases from Travis CI. @@ -13,21 +7,29 @@ To configure tag driven releases from Travis CI. 1. Generate a key pair for this repository with `./admin/genKeyPair.sh`. Edit `.travis.yml` and `admin/build.sh` as prompted. 1. Publish the public key to https://pgp.mit.edu - 1. Store other secrets as encrypted environment variables with `admin/encryptEnvVars.sh`. + 1. Store other secrets as encrypted environment variables with `./admin/encryptEnvVars.sh`. Edit `.travis.yml` as prompted. 1. Edit `.travis.yml` to use `./admin/build.sh` as the build script, and edit that script to use the tasks required for this project. - 1. Edit `build.sbt`'s `scalaVersionsByJvm in ThisBuild` to select Scala and JVM version - combinations that will be used for publishing. + Ensure that `RELEASE_COMBO` is `true` for build matrix combinations + that should be released to sonatype (when building a tag). It is important to add comments in `.travis.yml` to identify the name -of each environment variable encoded in a `:secure` section. +of each environment variable encoded in a `secure` section. After these steps, your `.travis.yml` should contain config of the form: ``` language: scala +jdk: + - openjdk6 + - oraclejdk8 + +scala: + - 2.11.12 + - 2.12.6 + env: global: # PGP_PASSPHRASE @@ -37,11 +39,9 @@ env: # SONA_PASS - secure: "XXXXXX" -script: admin/build.sh - -jdk: - - openjdk6 - - oraclejdk8 +script: + - if [[ "$TRAVIS_JDK_VERSION" == "openjdk6" && "$TRAVIS_SCALA_VERSION" =~ 2\.11\..* || "$TRAVIS_JDK_VERSION" == "oraclejdk8" && "$TRAVIS_SCALA_VERSION" =~ 2\.1[23]\..* ]]; then export RELEASE_COMBO=true; fi + - admin/build.sh notifications: email: @@ -62,10 +62,9 @@ without generating a new key. 1. Create a GitHub "Release" with a corresponding tag (e.g., `v0.1.1`) via the GitHub web interface. 1. The release will be published using the Scala and JVM version combinations specified - in `scalaVersionsByJvm` in `build.sbt`. - - If you need to release against a different Scala version, include the Scala version - and the JVM version to use in the tag name, separated by `#`s (e.g., `v0.1.1#2.13.0-M1#8`). - Note that the JVM version needs to be listed in `.travis.yml` for the build to run. + in the travis build matrix where `[ "$RELEASE_COMBO" = "true" ]`. + - If you need to release against a different Scala version, create a new commit that modifies + `.travis.yml` and push a new tag, e.g., `v1.2.3#2.13.0-M5`. The suffix after `#` is ignored. 1. Travis CI will schedule a build for this release. Review the build logs. 1. Log into https://oss.sonatype.org/ and identify the staging repository. 1. Sanity check its contents. diff --git a/admin/build.sh b/admin/build.sh index 037672bd4..f62badea7 100755 --- a/admin/build.sh +++ b/admin/build.sh @@ -9,45 +9,40 @@ set -e # Checking the local git clone would not work because git on travis does not fetch tags. # The version number to be published is extracted from the tag, e.g., v1.2.3 publishes -# version 1.2.3 using all Scala versions in build.sbt's `crossScalaVersions`. +# version 1.2.3 on all combinations of the travis matrix where `[ "$RELEASE_COMBO" = "true" ]`. -# When a new, binary incompatible Scala version becomes available, a previously released version -# can be released using that new Scala version by creating a new tag containing the Scala and the -# JVM version after hashes, e.g., v1.2.3#2.13.0-M1#8. The JVM version needs to be listed in -# `.travis.yml`, otherwise the required build doesn't run. +# In order to build a previously released version against a new (binary incompatible) Scala release, +# a new commit that modifies (and prunes) the Scala versions in .travis.yml needs to be added on top +# of the existing tag. Then a new tag can be created for that commit, e.g., `v1.2.3#2.13.0-M5`. +# Everything after the `#` in the tag name is ignored. + +if [ "$SCALAJS_VERSION" = "" ]; then + projectPrefix="xml" +else + projectPrefix="xmlJS" +fi verPat="[0-9]+\.[0-9]+\.[0-9]+(-[A-Za-z0-9-]+)?" -tagPat="^v$verPat(#$verPat#[0-9]+)?$" +tagPat="^v$verPat(#.*)?$" if [[ "$TRAVIS_TAG" =~ $tagPat ]]; then - currentJvmVer=$(java -version 2>&1 | awk -F '"' '/version/ {print $2}' | sed 's/^1\.//' | sed 's/[^0-9].*//') - tagVer=$(echo $TRAVIS_TAG | sed s/#.*// | sed s/^v//) publishVersion='set every version := "'$tagVer'"' - scalaAndJvmVer=$(echo $TRAVIS_TAG | sed s/[^#]*// | sed s/^#//) - if [ "$scalaAndJvmVer" != "" ]; then - scalaVer=$(echo $scalaAndJvmVer | sed s/#.*//) - jvmVer=$(echo $scalaAndJvmVer | sed s/[^#]*// | sed s/^#//) - if [ "$jvmVer" != "$currentJvmVer" ]; then - echo "Not publishing $TRAVIS_TAG on Java version $currentJvmVer." - exit 0 - fi - publishScalaVersion='set every ScalaModulePlugin.scalaVersionsByJvm := Map('$jvmVer' -> List("'$scalaVer'" -> true))' - echo "Releasing $tagVer using Scala $scalaVer on Java version $jvmVer." - else - echo "Releasing $tagVer on Java version $currentJvmVer according to 'scalaVersionsByJvm' in build.sbt." - fi + if [ "$RELEASE_COMBO" = "true" ]; then + currentJvmVer=$(java -version 2>&1 | awk -F '"' '/version/ {print $2}' | sed 's/^1\.//' | sed 's/[^0-9].*//') + echo "Releasing $tagVer with Scala $TRAVIS_SCALA_VERSION on Java version $currentJvmVer." - extraTarget="+publish-signed" - cat admin/gpg.sbt >> project/plugins.sbt - cp admin/publish-settings.sbt . + publishTask="$projectPrefix/publish-signed" - # Copied from the output of genKeyPair.sh - K=$encrypted_6b8d67feaab7_key - IV=$encrypted_6b8d67feaab7_iv + cat admin/gpg.sbt >> project/plugins.sbt + cp admin/publish-settings.sbt . - openssl aes-256-cbc -K $K -iv $IV -in admin/secring.asc.enc -out admin/secring.asc -d + # Copied from the output of genKeyPair.sh + K=$encrypted_6b8d67feaab7_key + IV=$encrypted_6b8d67feaab7_iv + openssl aes-256-cbc -K $K -iv $IV -in admin/secring.asc.enc -out admin/secring.asc -d + fi fi -sbt "$publishVersion" "$publishScalaVersion" clean update +test +publishLocal $extraTarget +sbt "++$TRAVIS_SCALA_VERSION" "$publishVersion" "$projectPrefix/clean" "$projectPrefix/test" "$projectPrefix/publishLocal" "$publishTask" diff --git a/admin/publish-settings.sbt b/admin/publish-settings.sbt index f763ea06c..026c6ee3e 100644 --- a/admin/publish-settings.sbt +++ b/admin/publish-settings.sbt @@ -1,9 +1,8 @@ def env(key: String) = Option(System.getenv(key)).getOrElse("") -pgpPassphrase := Some(env("PGP_PASSPHRASE").toArray) - -pgpPublicRing := file("admin/pubring.asc") - -pgpSecretRing := file("admin/secring.asc") - -credentials += Credentials("Sonatype Nexus Repository Manager", "oss.sonatype.org", env("SONA_USER"), env("SONA_PASS")) +inThisBuild(Seq( + pgpPassphrase := Some(env("PGP_PASSPHRASE").toArray), + pgpPublicRing := file("admin/pubring.asc"), + pgpSecretRing := file("admin/secring.asc"), + credentials += Credentials("Sonatype Nexus Repository Manager", "oss.sonatype.org", env("SONA_USER"), env("SONA_PASS")) +)) diff --git a/build.sbt b/build.sbt index 6ab70abbe..a1b38172d 100644 --- a/build.sbt +++ b/build.sbt @@ -1,21 +1,12 @@ +import sbtcrossproject.{crossProject, CrossType} import ScalaModulePlugin._ -scalaVersionsByJvm in ThisBuild := { - val v211 = "2.11.12" - val v212 = "2.12.4" - val v213 = "2.13.0-M3" - Map( - 6 -> List(v211 -> true), - 7 -> List(v211 -> false), - 8 -> List(v212 -> true, v213 -> true, v211 -> false), - 9 -> List(v212 -> false, v213 -> false, v211 -> false)) -} +crossScalaVersions in ThisBuild := List("2.12.6", "2.11.12", "2.13.0-M3") -lazy val root = project.in(file(".")) - .aggregate(xmlJS, xmlJVM) - .settings(disablePublishing) - -lazy val xml = crossProject.in(file(".")) +lazy val xml = crossProject(JSPlatform, JVMPlatform) + .withoutSuffixFor(JVMPlatform) + .crossType(CrossType.Full) + .in(file(".")) .settings(scalaModuleSettings) .jvmSettings(scalaModuleSettingsJVM) .settings( @@ -27,7 +18,10 @@ lazy val xml = crossProject.in(file(".")) scalacOptions ++= "-deprecation:false -feature -Xlint:-stars-align,-nullary-unit,_".split("\\s+").to[Seq], scalacOptions in Test += "-Xxml:coalescing", - mimaPreviousVersion := Some("1.1.0"), + mimaPreviousVersion := { + if (System.getenv("SCALAJS_VERSION") == "1.0.0-M3") None // No such release yet + else Some("1.1.0") + }, apiMappings ++= Map( scalaInstance.value.libraryJar @@ -48,7 +42,6 @@ lazy val xml = crossProject.in(file(".")) -> url("http://docs.oracle.com/javase/9/docs/api"), file("/modules/java.xml") -> url("http://docs.oracle.com/javase/9/docs/api") - ) } } diff --git a/project/plugins.sbt b/project/plugins.sbt index 7974aa440..0670f0eef 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,5 +1,3 @@ -addSbtPlugin("org.scala-lang.modules" % "sbt-scala-module" % "1.0.14") - if (System.getProperty("java.version").startsWith("1.")) Seq() else @@ -7,4 +5,9 @@ else // see https://github.com/scala/sbt-scala-module/issues/35 Seq(addSbtPlugin("com.typesafe.sbt" % "sbt-osgi" % "0.9.3")) -addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.22") +val scalaJSVersion = + Option(System.getenv("SCALAJS_VERSION")).filter(_.nonEmpty).getOrElse("0.6.23") + +addSbtPlugin("org.scala-js" % "sbt-scalajs" % scalaJSVersion) +addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "0.4.0") +addSbtPlugin("org.scala-lang.modules" % "sbt-scala-module" % "1.0.14") From 952cf7a04aa1fed329208b619357ba4cf5778eb6 Mon Sep 17 00:00:00 2001 From: Lukas Rytz Date: Wed, 23 May 2018 15:21:18 +0200 Subject: [PATCH 222/789] Set RELEASE_COMBO in the build script --- .travis.yml | 4 +--- admin/README.md | 4 +--- admin/build.sh | 4 ++++ 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.travis.yml b/.travis.yml index aec75a4d1..5c7cbcedf 100644 --- a/.travis.yml +++ b/.travis.yml @@ -37,9 +37,7 @@ matrix: - scala: 2.13.0-M3 jdk: openjdk6 -script: - - if [[ "$TRAVIS_JDK_VERSION" == "openjdk6" && "$TRAVIS_SCALA_VERSION" =~ 2\.11\..* || "$TRAVIS_JDK_VERSION" == "oraclejdk8" && "$TRAVIS_SCALA_VERSION" =~ 2\.1[23]\..* ]]; then export RELEASE_COMBO=true; fi - - admin/build.sh +script: admin/build.sh notifications: email: adriaan.moors@lightbend.com diff --git a/admin/README.md b/admin/README.md index 92e96e6d2..3e9d1bfa2 100644 --- a/admin/README.md +++ b/admin/README.md @@ -39,9 +39,7 @@ env: # SONA_PASS - secure: "XXXXXX" -script: - - if [[ "$TRAVIS_JDK_VERSION" == "openjdk6" && "$TRAVIS_SCALA_VERSION" =~ 2\.11\..* || "$TRAVIS_JDK_VERSION" == "oraclejdk8" && "$TRAVIS_SCALA_VERSION" =~ 2\.1[23]\..* ]]; then export RELEASE_COMBO=true; fi - - admin/build.sh +script: admin/build.sh notifications: email: diff --git a/admin/build.sh b/admin/build.sh index f62badea7..a43c88111 100755 --- a/admin/build.sh +++ b/admin/build.sh @@ -16,6 +16,10 @@ set -e # of the existing tag. Then a new tag can be created for that commit, e.g., `v1.2.3#2.13.0-M5`. # Everything after the `#` in the tag name is ignored. +if [[ "$TRAVIS_JDK_VERSION" == "openjdk6" && "$TRAVIS_SCALA_VERSION" =~ 2\.11\..* || "$TRAVIS_JDK_VERSION" == "oraclejdk8" && "$TRAVIS_SCALA_VERSION" =~ 2\.1[23]\..* ]]; then + RELEASE_COMBO=true; +fi + if [ "$SCALAJS_VERSION" = "" ]; then projectPrefix="xml" else From c2bb56ff64566e76d64c199f56c1947a0a966210 Mon Sep 17 00:00:00 2001 From: Lukas Rytz Date: Wed, 23 May 2018 16:30:05 +0200 Subject: [PATCH 223/789] Use 2.12.6 everywhere...! --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 5c7cbcedf..62b2f7341 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,7 +12,7 @@ jdk: scala: - 2.11.12 - - 2.12.4 + - 2.12.6 - 2.13.0-M3 env: @@ -32,7 +32,7 @@ matrix: exclude: - scala: 2.13.0-M3 env: SCALAJS_VERSION=1.0.0-M3 - - scala: 2.12.4 + - scala: 2.12.6 jdk: openjdk6 - scala: 2.13.0-M3 jdk: openjdk6 From bded45d17cb26099fbbff22c33cbacf96d1a472c Mon Sep 17 00:00:00 2001 From: Lukas Rytz Date: Wed, 23 May 2018 17:06:31 +0200 Subject: [PATCH 224/789] Skip sjs-1.0.0-M3 on jdk 9 --- .travis.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.travis.yml b/.travis.yml index 62b2f7341..8737e6bdd 100644 --- a/.travis.yml +++ b/.travis.yml @@ -32,6 +32,8 @@ matrix: exclude: - scala: 2.13.0-M3 env: SCALAJS_VERSION=1.0.0-M3 + - jdk: oraclejdk9 + env: SCALAJS_VERSION=1.0.0-M3 - scala: 2.12.6 jdk: openjdk6 - scala: 2.13.0-M3 From e9778d25a89c6642a39e941d8f9c158b9f6ed2d0 Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Thu, 26 Apr 2018 14:07:07 -0400 Subject: [PATCH 225/789] Add tests removed from scalac --- jvm/src/test/scala/scala/xml/XMLTest.scala | 109 ++++++++++++++++++ shared/src/test/scala/scala/xml/XMLTest.scala | 44 +++++++ 2 files changed, 153 insertions(+) diff --git a/jvm/src/test/scala/scala/xml/XMLTest.scala b/jvm/src/test/scala/scala/xml/XMLTest.scala index 64813c732..ba204d0e1 100644 --- a/jvm/src/test/scala/scala/xml/XMLTest.scala +++ b/jvm/src/test/scala/scala/xml/XMLTest.scala @@ -480,6 +480,115 @@ class XMLTestJVM { assertEquals("""
""", sort() toString) } + @UnitTest + def t8253: Unit = { + // `identity(foo)` used to match the overly permissive match in SymbolXMLBuilder + // which was intended to more specifically match `_root_.scala.xml.Text(...)` + + import reflect.runtime.universe._ // not using the XML library in compiler tests + + val ns1 = "ns1" + assertEquals(reify(ns1).tree.toString, q"ns1".toString) + assertEquals("", + """|{ + | var $tmpscope: _root_.scala.xml.NamespaceBinding = $scope; + | $tmpscope = new _root_.scala.xml.NamespaceBinding(null, "ns1", $tmpscope); + | { + | val $scope: _root_.scala.xml.NamespaceBinding = $tmpscope; + | new _root_.scala.xml.Elem(null, "sample", _root_.scala.xml.Null, $scope, true) + | } + |}""".stripMargin, + q"".toString) + assertEquals("", + """|{ + | var $tmpscope: _root_.scala.xml.NamespaceBinding = $scope; + | $tmpscope = new _root_.scala.xml.NamespaceBinding(null, ns1, $tmpscope); + | { + | val $scope: _root_.scala.xml.NamespaceBinding = $tmpscope; + | new _root_.scala.xml.Elem(null, "sample", _root_.scala.xml.Null, $scope, true) + | } + |}""".stripMargin, + q"".toString) + assertEquals("", + """|{ + | var $tmpscope: _root_.scala.xml.NamespaceBinding = $scope; + | $tmpscope = new _root_.scala.xml.NamespaceBinding("foo", "ns1", $tmpscope); + | { + | val $scope: _root_.scala.xml.NamespaceBinding = $tmpscope; + | new _root_.scala.xml.Elem(null, "sample", _root_.scala.xml.Null, $scope, true) + | } + |}""".stripMargin, + q"".toString) + assertEquals("", + """|{ + | var $tmpscope: _root_.scala.xml.NamespaceBinding = $scope; + | $tmpscope = new _root_.scala.xml.NamespaceBinding("foo", ns1, $tmpscope); + | { + | val $scope: _root_.scala.xml.NamespaceBinding = $tmpscope; + | new _root_.scala.xml.Elem(null, "sample", _root_.scala.xml.Null, $scope, true) + | } + |}""".stripMargin, + q"".toString) + } + + @UnitTest + def t8466lift: Unit = { + import scala.reflect.runtime.universe._ + + implicit val liftXmlComment = Liftable[Comment] { comment => + q"new _root_.scala.xml.Comment(${comment.commentText})" + } + liftXmlComment(Comment("foo")) + assertEquals(q"${Comment("foo")}".toString, q"".toString) + } + + @UnitTest + def t8466unlift: Unit = { + import scala.reflect.runtime.universe._ + + implicit val unliftXmlComment = Unliftable[Comment] { + case q"new _root_.scala.xml.Comment(${value: String})" => Comment(value) + } + unliftXmlComment.unapply(q"") + val q"${comment: Comment}" = q"" + assertEquals(comment.commentText, "foo") + } + + @UnitTest + def t9027: Unit = { + // used to be parsed as .println + + import reflect.runtime._, universe._ + + assertEquals( + """|{ + | { + | val $buf = new _root_.scala.xml.NodeBuffer(); + | $buf.$amp$plus(new _root_.scala.xml.Elem(null, "a", _root_.scala.xml.Null, $scope, true)); + | $buf.$amp$plus(new _root_.scala.xml.Elem(null, "b", _root_.scala.xml.Null, $scope, true)); + | $buf + | }; + | println("hello, world.") + |}""".stripMargin, + q""" + println("hello, world.")""".toString) + assertEquals( + """|{ + | { + | val $buf = new _root_.scala.xml.NodeBuffer(); + | $buf.$amp$plus(new _root_.scala.xml.Elem(null, "a", _root_.scala.xml.Null, $scope, true)); + | $buf.$amp$plus(new _root_.scala.xml.Elem(null, "b", _root_.scala.xml.Null, $scope, true)); + | $buf.$amp$plus(new _root_.scala.xml.Elem(null, "c", _root_.scala.xml.Null, $scope, true)); + | $buf + | }; + | println("hello, world.") + |}""".stripMargin, + q""" + + + println("hello, world.")""".toString) + } + @UnitTest def t9060 = { val expected = """""" diff --git a/shared/src/test/scala/scala/xml/XMLTest.scala b/shared/src/test/scala/scala/xml/XMLTest.scala index 6147f56b4..998b06dcd 100644 --- a/shared/src/test/scala/scala/xml/XMLTest.scala +++ b/shared/src/test/scala/scala/xml/XMLTest.scala @@ -369,6 +369,13 @@ Ours is the portal of hope, come as you are." """, wsdlTemplate4("service4", () => "target4") toString) } + @UnitTest + def t547: Unit = { + // ambiguous toString problem from #547 + val atom: scala.xml.Atom[Unit] = new scala.xml.Atom(()) + assertEquals(().toString, atom.toString) + } + @UnitTest def t1079 = assertFalse( == ) @@ -416,6 +423,30 @@ Ours is the portal of hope, come as you are." assertTrue( != ) } + @UnitTest + def t4124: Unit = { + val body: Node = hi + assertEquals("hi", ((body: AnyRef, "foo"): @unchecked) match { + case (node: Node, "bar") => "bye" + case (ser: Serializable, "foo") => "hi" + }) + + assertEquals("hi", ((body, "foo"): @unchecked) match { + case (node: Node, "bar") => "bye" + case (ser: Serializable, "foo") => "hi" + }) + + assertEquals("bye", ((body: AnyRef, "foo"): @unchecked) match { + case (node: Node, "foo") => "bye" + case (ser: Serializable, "foo") => "hi" + }) + + assertEquals("bye", ((body: AnyRef, "foo"): @unchecked) match { + case (node: Node, "foo") => "bye" + case (ser: Serializable, "foo") => "hi" + }) + } + @UnitTest def t5052: Unit = { assertTrue( xml_== ) @@ -438,6 +469,19 @@ Ours is the portal of hope, come as you are." assertHonorsIterableContract(.attributes) } + @UnitTest + def t5154: Unit = { + + // extra space made the pattern OK + def f = {{3}} match { case {{3}} => true } + + // lack of space used to error: illegal start of simple pattern + def g = {{3}} match { case {{3}} => true } + + assertTrue(f) + assertTrue(g) + } + @UnitTest def t5843: Unit = { val foo = scala.xml.Attribute(null, "foo", "1", scala.xml.Null) From 588690514987a6ccf6804aaf8aa2112e182625b6 Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Fri, 20 Oct 2017 11:34:03 -0400 Subject: [PATCH 226/789] Add PCData unit test --- .../src/test/scala/scala/xml/PCDataTest.scala | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 shared/src/test/scala/scala/xml/PCDataTest.scala diff --git a/shared/src/test/scala/scala/xml/PCDataTest.scala b/shared/src/test/scala/scala/xml/PCDataTest.scala new file mode 100644 index 000000000..78fd494fb --- /dev/null +++ b/shared/src/test/scala/scala/xml/PCDataTest.scala @@ -0,0 +1,37 @@ +package scala.xml + +import org.junit.Test +import org.junit.Assert.assertEquals + +class PCDataTest { + + @Test + def emptyTest = { + val pcdata = new PCData("") + assertEquals("", pcdata.toString) + } + + @Test + def bracketTest = { + val pcdata = new PCData("[]") + assertEquals("", pcdata.toString) + } + + @Test + def hellaBracketingTest = { + val pcdata = new PCData("[[[[[[[[]]]]]]]]") + assertEquals("", pcdata.toString) + } + + @Test + def simpleNestingTest = { + val pcdata = new PCData("]]>") + assertEquals("]]>", pcdata.toString) + } + + @Test + def recursiveNestingTest = { + val pcdata = new PCData("") + assertEquals("]]>", pcdata.toString) + } +} From bcde63a28135023423f31a46b97e2609c2128a48 Mon Sep 17 00:00:00 2001 From: Sam Halliday Date: Fri, 20 Oct 2017 11:36:00 -0400 Subject: [PATCH 227/789] Split CDATA containing closing triad ]]> --- shared/src/main/scala/scala/xml/PCData.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shared/src/main/scala/scala/xml/PCData.scala b/shared/src/main/scala/scala/xml/PCData.scala index 5b8ee07c2..1df109e25 100644 --- a/shared/src/main/scala/scala/xml/PCData.scala +++ b/shared/src/main/scala/scala/xml/PCData.scala @@ -26,7 +26,7 @@ class PCData(data: String) extends Atom[String](data) { * @return the input string buffer with the formatted CDATA section */ override def buildString(sb: StringBuilder): StringBuilder = - sb append "".format(data) + sb append "".format(data.replaceAll("]]>", "]]]]>")) } /** From 66ec1d6eb13ef2f58f08238b33a6bdc0fb72e9a2 Mon Sep 17 00:00:00 2001 From: Ethan Eldridge Date: Wed, 9 May 2018 01:21:55 -0400 Subject: [PATCH 228/789] Fix #213 Add threadsafe note for pretty printer --- shared/src/main/scala/scala/xml/PrettyPrinter.scala | 1 + 1 file changed, 1 insertion(+) diff --git a/shared/src/main/scala/scala/xml/PrettyPrinter.scala b/shared/src/main/scala/scala/xml/PrettyPrinter.scala index b5f41d157..cce680246 100755 --- a/shared/src/main/scala/scala/xml/PrettyPrinter.scala +++ b/shared/src/main/scala/scala/xml/PrettyPrinter.scala @@ -21,6 +21,7 @@ import Utility.sbToString * @author Burak Emir * @param width the width to fit the output into * @param step indentation + * @note This class is not threadsafe and should not be accessed by multiple threads at the same time. */ class PrettyPrinter(width: Int, step: Int, minimizeEmpty: Boolean) { From c249e21cadee89e705925ab24024a7606e35d28a Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Fri, 25 May 2018 13:10:57 -0400 Subject: [PATCH 229/789] Fix whitespace in Travis RELEASE_COMBO --- admin/build.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/admin/build.sh b/admin/build.sh index a43c88111..6a3ebf377 100755 --- a/admin/build.sh +++ b/admin/build.sh @@ -16,7 +16,8 @@ set -e # of the existing tag. Then a new tag can be created for that commit, e.g., `v1.2.3#2.13.0-M5`. # Everything after the `#` in the tag name is ignored. -if [[ "$TRAVIS_JDK_VERSION" == "openjdk6" && "$TRAVIS_SCALA_VERSION" =~ 2\.11\..* || "$TRAVIS_JDK_VERSION" == "oraclejdk8" && "$TRAVIS_SCALA_VERSION" =~ 2\.1[23]\..* ]]; then +if [[ "$TRAVIS_JDK_VERSION" == "openjdk6" && "$TRAVIS_SCALA_VERSION" =~ 2\.11\..* \ + || "$TRAVIS_JDK_VERSION" == "oraclejdk8" && "$TRAVIS_SCALA_VERSION" =~ 2\.1[23]\..* ]]; then RELEASE_COMBO=true; fi From a52febeffbfbbc2befadc0a93306cbefa688f88a Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Fri, 25 May 2018 13:18:15 -0400 Subject: [PATCH 230/789] Use shell, not sed, to parse release tag --- admin/build.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/admin/build.sh b/admin/build.sh index 6a3ebf377..5f4a84058 100755 --- a/admin/build.sh +++ b/admin/build.sh @@ -31,7 +31,9 @@ verPat="[0-9]+\.[0-9]+\.[0-9]+(-[A-Za-z0-9-]+)?" tagPat="^v$verPat(#.*)?$" if [[ "$TRAVIS_TAG" =~ $tagPat ]]; then - tagVer=$(echo $TRAVIS_TAG | sed s/#.*// | sed s/^v//) + tagVer=${TRAVIS_TAG} + tagVer=${tagVer#v} # Remove `v` at beginning. + tagVer=${tagVer%%#*} # Remove anything after `#`. publishVersion='set every version := "'$tagVer'"' if [ "$RELEASE_COMBO" = "true" ]; then From 35ea3de08e9e5df4283af2564ed1ef1575ff19b9 Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Fri, 25 May 2018 13:20:07 -0400 Subject: [PATCH 231/789] Travis doesn't runs tags twice --- admin/build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/admin/build.sh b/admin/build.sh index 5f4a84058..5c5ae5724 100755 --- a/admin/build.sh +++ b/admin/build.sh @@ -4,7 +4,7 @@ set -e # Builds of tagged revisions are published to sonatype staging. -# Travis runs a build on new revisions and on new tags, so a tagged revision is built twice. +# Travis runs a build on revisions, including on new tags. # Builds for a tag have TRAVIS_TAG defined, which we use for identifying tagged builds. # Checking the local git clone would not work because git on travis does not fetch tags. From 3fe1faef8e995608006a28d4abb4bfc27f7f0871 Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Fri, 25 May 2018 13:21:37 -0400 Subject: [PATCH 232/789] Doc empty SCALAJS_VERSION for Travis --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 8737e6bdd..ffe4efc6a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -24,6 +24,7 @@ env: # SONA_PASS - secure: "Xw7rI/qlML1nD2e2XwlakkhKAWNGZKqqE+Q3ntTvFpfHryl7KLCvVzJ4LIavnL6kGJaWOgy9vlSoEWn5g9nqHSfE31C/k5pY5nTMAKiwiJzfAS+r0asKXW2gmKhwtcTBkqyLVOZLCJSPVlFRQyfBJHY+Fs0L3KWcnMQgtBlyDhU=" matrix: + # The empty SCALAJS_VERSION will only compile for the JVM - SCALAJS_VERSION= - SCALAJS_VERSION=0.6.23 - SCALAJS_VERSION=1.0.0-M3 From 88045b2374d28a82b35f6281aaf032eee1668f9b Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Fri, 25 May 2018 13:22:37 -0400 Subject: [PATCH 233/789] Remove adriaanm from Travis notifications --- .travis.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index ffe4efc6a..11c3d500c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -42,9 +42,6 @@ matrix: script: admin/build.sh -notifications: - email: adriaan.moors@lightbend.com - before_cache: - find $HOME/.sbt -name "*.lock" | xargs rm - find $HOME/.ivy2/cache -name "ivydata-*.properties" | xargs rm From baf1b5bd5ed3bc0437cd46b234c2a66ff069cc1a Mon Sep 17 00:00:00 2001 From: Hosam Aly Date: Tue, 29 May 2018 18:11:25 +0100 Subject: [PATCH 234/789] Fix #231: Minimize empty elements with lengthy attributes --- jvm/src/test/scala/scala/xml/XMLTest.scala | 16 ++++++++++++++ .../main/scala/scala/xml/PrettyPrinter.scala | 22 ++++++++++++++----- 2 files changed, 32 insertions(+), 6 deletions(-) diff --git a/jvm/src/test/scala/scala/xml/XMLTest.scala b/jvm/src/test/scala/scala/xml/XMLTest.scala index ba204d0e1..201557503 100644 --- a/jvm/src/test/scala/scala/xml/XMLTest.scala +++ b/jvm/src/test/scala/scala/xml/XMLTest.scala @@ -749,4 +749,20 @@ class XMLTestJVM { assertEquals("\n \n", pp.format(x)) } + @UnitTest + def issue231: Unit = { + val pp = new xml.PrettyPrinter(4, 2, minimizeEmpty = true) + val x = + val formatted = pp.format(x) + assertEquals(x, XML.loadString(formatted)) + assertTrue(formatted.trim.lines.length >= 2) + } + + @UnitTest + def issue231_withoutAttributes: Unit = { + val pp = new xml.PrettyPrinter(4, 2, minimizeEmpty = true) + val x = + val formatted = pp.format(x) + assertEquals(x, XML.loadString(formatted)) + } } diff --git a/shared/src/main/scala/scala/xml/PrettyPrinter.scala b/shared/src/main/scala/scala/xml/PrettyPrinter.scala index cce680246..d202da0e6 100755 --- a/shared/src/main/scala/scala/xml/PrettyPrinter.scala +++ b/shared/src/main/scala/scala/xml/PrettyPrinter.scala @@ -160,8 +160,16 @@ class PrettyPrinter(width: Int, step: Int, minimizeEmpty: Boolean) { if (childrenAreLeaves(node) && fits(test)) { makeBox(ind, test) } else { - val (stg, len2) = startTag(node, pscope) - val etg = endTag(node) + val ((stg, len2), etg) = + if (node.child.isEmpty && minimizeEmpty) { + // force the tag to be self-closing + val firstAttribute = test.indexOf(' ') + val firstBreak = if (firstAttribute != -1) firstAttribute else test.lastIndexOf('/') + ((test, firstBreak), "") + } else { + (startTag(node, pscope), endTag(node)) + } + if (stg.length < width - cur) { // start tag fits makeBox(ind, stg) makeBreak() @@ -180,10 +188,12 @@ class PrettyPrinter(width: Int, step: Int, minimizeEmpty: Boolean) { makeBreak() } }*/ - makeBox(ind, stg.substring(len2, stg.length)) - makeBreak() - traverse(node.child.iterator, node.scope, ind + step) - makeBox(cur, etg) + makeBox(ind, stg.substring(len2, stg.length).trim) + if (etg.nonEmpty) { + makeBreak() + traverse(node.child.iterator, node.scope, ind + step) + makeBox(cur, etg) + } makeBreak() } else { // give up makeBox(ind, test) From 4940b6a1dd7184b695f60cd6647531ecf4df3dc4 Mon Sep 17 00:00:00 2001 From: terma Date: Tue, 11 Nov 2014 00:05:24 -0500 Subject: [PATCH 235/789] SI-4520 Tests for OOE in XML parser --- jvm/src/test/scala/scala/xml/XMLTest.scala | 47 +++++++++++++++++++++- 1 file changed, 46 insertions(+), 1 deletion(-) diff --git a/jvm/src/test/scala/scala/xml/XMLTest.scala b/jvm/src/test/scala/scala/xml/XMLTest.scala index 201557503..25495396a 100644 --- a/jvm/src/test/scala/scala/xml/XMLTest.scala +++ b/jvm/src/test/scala/scala/xml/XMLTest.scala @@ -633,7 +633,7 @@ class XMLTestJVM { import scala.xml.parsing._ @UnitTest def dontLoop: Unit = { - val xml = " " + val xml = " " val sink = new PrintStream(new ByteArrayOutputStream()) (Console withOut sink) { (Console withErr sink) { @@ -765,4 +765,49 @@ class XMLTestJVM { val formatted = pp.format(x) assertEquals(x, XML.loadString(formatted)) } + + @UnitTest(expected = classOf[FatalError]) + def shouldThrowFatalErrorWhenCantFindRequestedXToken { + val x = xml.parsing.ConstructingParser.fromSource(io.Source.fromString(""), false) + + x.xToken('b') + } + + @UnitTest(expected = classOf[FatalError]) + def shouldThrowFatalErrorWhenCantFindRequestedXCharData { + val x = xml.parsing.ConstructingParser.fromSource(io.Source.fromString(""), false) + + x.xCharData + } + + @UnitTest(expected = classOf[FatalError]) + def shouldThrowFatalErrorWhenCantFindRequestedXComment { + val x = xml.parsing.ConstructingParser.fromSource(io.Source.fromString(""), false) + + x.xComment + } + + @UnitTest(expected = classOf[FatalError]) + def shouldThrowFatalErrorWhenCantFindRequestedXmlProcInstr { + val x = xml.parsing.ConstructingParser.fromSource(io.Source.fromString(""), false) + + x.xmlProcInstr() + } + + @Ignore("Ignored for future fix, currently throw OOE because of infinity MarkupParserCommon:66") + @UnitTest(expected = classOf[FatalError]) + def shouldThrowFatalErrorWhenCantFindRequestedXAttributeValue { + val x = xml.parsing.ConstructingParser.fromSource(io.Source.fromString(""), false) + + x.xAttributeValue() + } + + @Ignore("Ignored for future fix, currently return unexpected result") + @UnitTest(expected = classOf[FatalError]) + def shouldThrowFatalErrorWhenCantFindRequestedXEntityValue { + val x = xml.parsing.ConstructingParser.fromSource(io.Source.fromString(""), false) + + assertEquals("a/>", x.xEntityValue()) + } + } From 6f76dd1ce872b34596de213b37506993fe023e2b Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Sun, 15 Apr 2018 12:59:07 -0400 Subject: [PATCH 236/789] Refactor Artem Stasiuk's OOE parser tests Shorten test names and minimize string literals. --- jvm/src/test/scala/scala/xml/XMLTest.scala | 33 +++++++++++----------- 1 file changed, 16 insertions(+), 17 deletions(-) diff --git a/jvm/src/test/scala/scala/xml/XMLTest.scala b/jvm/src/test/scala/scala/xml/XMLTest.scala index 25495396a..94ae21a2a 100644 --- a/jvm/src/test/scala/scala/xml/XMLTest.scala +++ b/jvm/src/test/scala/scala/xml/XMLTest.scala @@ -767,47 +767,46 @@ class XMLTestJVM { } @UnitTest(expected = classOf[FatalError]) - def shouldThrowFatalErrorWhenCantFindRequestedXToken { - val x = xml.parsing.ConstructingParser.fromSource(io.Source.fromString(""), false) - - x.xToken('b') + def xTokenFailure { + val x = xml.parsing.ConstructingParser.fromSource(io.Source.fromString("a"), false) + assertEquals((): Unit, x.xToken('b')) } @UnitTest(expected = classOf[FatalError]) - def shouldThrowFatalErrorWhenCantFindRequestedXCharData { - val x = xml.parsing.ConstructingParser.fromSource(io.Source.fromString(""), false) + def xCharDataFailure { + val x = xml.parsing.ConstructingParser.fromSource(io.Source.fromString(""), false) x.xCharData } @UnitTest(expected = classOf[FatalError]) - def shouldThrowFatalErrorWhenCantFindRequestedXComment { - val x = xml.parsing.ConstructingParser.fromSource(io.Source.fromString(""), false) + def xCommentFailure { + val x = xml.parsing.ConstructingParser.fromSource(io.Source.fromString(""), false) x.xComment } @UnitTest(expected = classOf[FatalError]) - def shouldThrowFatalErrorWhenCantFindRequestedXmlProcInstr { - val x = xml.parsing.ConstructingParser.fromSource(io.Source.fromString(""), false) + def xmlProcInstrFailure { + val x = xml.parsing.ConstructingParser.fromSource(io.Source.fromString("aa"), false) - x.xmlProcInstr() + assertEquals(new UnprefixedAttribute("aa", Text(""), Null), x.xmlProcInstr) } @Ignore("Ignored for future fix, currently throw OOE because of infinity MarkupParserCommon:66") @UnitTest(expected = classOf[FatalError]) - def shouldThrowFatalErrorWhenCantFindRequestedXAttributeValue { - val x = xml.parsing.ConstructingParser.fromSource(io.Source.fromString(""), false) + def xAttributeValueFailure { + val x = xml.parsing.ConstructingParser.fromSource(io.Source.fromString(""), false) - x.xAttributeValue() + x.xAttributeValue } @Ignore("Ignored for future fix, currently return unexpected result") @UnitTest(expected = classOf[FatalError]) - def shouldThrowFatalErrorWhenCantFindRequestedXEntityValue { - val x = xml.parsing.ConstructingParser.fromSource(io.Source.fromString(""), false) + def xEntityValueFailure { + val x = xml.parsing.ConstructingParser.fromSource(io.Source.fromString(""), false) - assertEquals("a/>", x.xEntityValue()) + x.xEntityValue } } From 239e3ede2262321b476a3d6faa96f2c6d6f828c1 Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Sun, 15 Apr 2018 13:12:07 -0400 Subject: [PATCH 237/789] Fix OOM in parser Add eof checks to: - MarkupParser.xEntityValue - MarkupParser.xComment - MarkupParser.systemLiteral - MarkupParser.pubidLiteral - MarkupParser.notationDecl - MarkupParserCommon.xAttributeValue - MarkupParserCommon.xTakeUntil --- jvm/src/test/scala/scala/xml/XMLTest.scala | 34 +++++++++++++------ .../scala/xml/parsing/MarkupParser.scala | 4 +-- .../xml/parsing/MarkupParserCommon.scala | 8 ++--- 3 files changed, 29 insertions(+), 17 deletions(-) diff --git a/jvm/src/test/scala/scala/xml/XMLTest.scala b/jvm/src/test/scala/scala/xml/XMLTest.scala index 94ae21a2a..f8e1cdec4 100644 --- a/jvm/src/test/scala/scala/xml/XMLTest.scala +++ b/jvm/src/test/scala/scala/xml/XMLTest.scala @@ -766,8 +766,8 @@ class XMLTestJVM { assertEquals(x, XML.loadString(formatted)) } - @UnitTest(expected = classOf[FatalError]) - def xTokenFailure { + @UnitTest + def xTokenTest { val x = xml.parsing.ConstructingParser.fromSource(io.Source.fromString("a"), false) assertEquals((): Unit, x.xToken('b')) } @@ -786,27 +786,39 @@ class XMLTestJVM { x.xComment } - @UnitTest(expected = classOf[FatalError]) - def xmlProcInstrFailure { + @UnitTest + def xmlProcInstrTest { val x = xml.parsing.ConstructingParser.fromSource(io.Source.fromString("aa"), false) assertEquals(new UnprefixedAttribute("aa", Text(""), Null), x.xmlProcInstr) } - @Ignore("Ignored for future fix, currently throw OOE because of infinity MarkupParserCommon:66") @UnitTest(expected = classOf[FatalError]) - def xAttributeValueFailure { + def notationDeclFailure { val x = xml.parsing.ConstructingParser.fromSource(io.Source.fromString(""), false) - x.xAttributeValue + x.notationDecl } - @Ignore("Ignored for future fix, currently return unexpected result") - @UnitTest(expected = classOf[FatalError]) - def xEntityValueFailure { + @UnitTest + def pubidLiteralTest { + val x = xml.parsing.ConstructingParser.fromSource(io.Source.fromString(""), false) + + assertEquals("", x.pubidLiteral) + } + + @UnitTest + def xAttributeValueTest { + val x = xml.parsing.ConstructingParser.fromSource(io.Source.fromString("'"), false) + + assertEquals("", x.xAttributeValue) + } + + @UnitTest + def xEntityValueTest { val x = xml.parsing.ConstructingParser.fromSource(io.Source.fromString(""), false) - x.xEntityValue + assertEquals("", x.xEntityValue) } } diff --git a/shared/src/main/scala/scala/xml/parsing/MarkupParser.scala b/shared/src/main/scala/scala/xml/parsing/MarkupParser.scala index 81d5b82cc..0b2f0d567 100755 --- a/shared/src/main/scala/scala/xml/parsing/MarkupParser.scala +++ b/shared/src/main/scala/scala/xml/parsing/MarkupParser.scala @@ -397,7 +397,7 @@ trait MarkupParser extends MarkupParserCommon with TokenTests { } else sb.append(ch) nextch() } - throw truncatedError("broken comment") + truncatedError("broken comment") } /* todo: move this into the NodeBuilder class */ @@ -928,7 +928,7 @@ trait MarkupParser extends MarkupParserCommon with TokenTests { new PublicID(pubID, sysID) } else { reportSyntaxError("PUBLIC or SYSTEM expected") - scala.sys.error("died parsing notationdecl") + truncatedError("died parsing notationdecl") } xSpaceOpt() xToken('>') diff --git a/shared/src/main/scala/scala/xml/parsing/MarkupParserCommon.scala b/shared/src/main/scala/scala/xml/parsing/MarkupParserCommon.scala index a6b2ec187..00d94a4fe 100644 --- a/shared/src/main/scala/scala/xml/parsing/MarkupParserCommon.scala +++ b/shared/src/main/scala/scala/xml/parsing/MarkupParserCommon.scala @@ -19,7 +19,7 @@ import Utility.SU * All members should be accessed through those. */ private[scala] trait MarkupParserCommon extends TokenTests { - protected def unreachable = scala.sys.error("Cannot be reached.") + protected def unreachable = truncatedError("Cannot be reached.") // type HandleType // MarkupHandler, SymbolicXMLBuilder type InputType // Source, CharArrayReader @@ -62,7 +62,7 @@ private[scala] trait MarkupParserCommon extends TokenTests { val buf = new StringBuilder while (ch != endCh && !eof) { // well-formedness constraint - if (ch == '<') return errorAndResult("'<' not allowed in attrib value", "") + if (ch == '<') reportSyntaxError("'<' not allowed in attrib value") else if (ch == SU) truncatedError("") else buf append ch_returning_nextch } @@ -241,11 +241,11 @@ private[scala] trait MarkupParserCommon extends TokenTests { val head = until.head val rest = until.tail - while (true) { + while (!eof) { if (ch == head && peek(rest)) return handler(positioner(), sb.toString) else if (ch == SU || eof) - truncatedError("") // throws TruncatedXMLControl in compiler + truncatedError(s"died parsing until $until") // throws TruncatedXMLControl in compiler sb append ch nextch() From e696ee671447c5f45801b80f18591cd8e92ee8b3 Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Sun, 15 Apr 2018 21:02:47 -0400 Subject: [PATCH 238/789] Silence test output ConstructingParser --- jvm/src/test/scala/scala/xml/XMLTest.scala | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/jvm/src/test/scala/scala/xml/XMLTest.scala b/jvm/src/test/scala/scala/xml/XMLTest.scala index f8e1cdec4..401f0e00a 100644 --- a/jvm/src/test/scala/scala/xml/XMLTest.scala +++ b/jvm/src/test/scala/scala/xml/XMLTest.scala @@ -766,57 +766,62 @@ class XMLTestJVM { assertEquals(x, XML.loadString(formatted)) } + def toSource(s: String) = new scala.io.Source { + val iter = s.iterator + override def reportError(pos: Int, msg: String, out: java.io.PrintStream = Console.err): Unit = {} + } + @UnitTest def xTokenTest { - val x = xml.parsing.ConstructingParser.fromSource(io.Source.fromString("a"), false) + val x = xml.parsing.ConstructingParser.fromSource(toSource("a"), false) assertEquals((): Unit, x.xToken('b')) } @UnitTest(expected = classOf[FatalError]) def xCharDataFailure { - val x = xml.parsing.ConstructingParser.fromSource(io.Source.fromString(""), false) + val x = xml.parsing.ConstructingParser.fromSource(toSource(""), false) x.xCharData } @UnitTest(expected = classOf[FatalError]) def xCommentFailure { - val x = xml.parsing.ConstructingParser.fromSource(io.Source.fromString(""), false) + val x = xml.parsing.ConstructingParser.fromSource(toSource(""), false) x.xComment } @UnitTest def xmlProcInstrTest { - val x = xml.parsing.ConstructingParser.fromSource(io.Source.fromString("aa"), false) + val x = xml.parsing.ConstructingParser.fromSource(toSource("aa"), false) assertEquals(new UnprefixedAttribute("aa", Text(""), Null), x.xmlProcInstr) } @UnitTest(expected = classOf[FatalError]) def notationDeclFailure { - val x = xml.parsing.ConstructingParser.fromSource(io.Source.fromString(""), false) + val x = xml.parsing.ConstructingParser.fromSource(toSource(""), false) x.notationDecl } @UnitTest def pubidLiteralTest { - val x = xml.parsing.ConstructingParser.fromSource(io.Source.fromString(""), false) + val x = xml.parsing.ConstructingParser.fromSource(toSource(""), false) assertEquals("", x.pubidLiteral) } @UnitTest def xAttributeValueTest { - val x = xml.parsing.ConstructingParser.fromSource(io.Source.fromString("'"), false) + val x = xml.parsing.ConstructingParser.fromSource(toSource("'"), false) assertEquals("", x.xAttributeValue) } @UnitTest def xEntityValueTest { - val x = xml.parsing.ConstructingParser.fromSource(io.Source.fromString(""), false) + val x = xml.parsing.ConstructingParser.fromSource(toSource(""), false) assertEquals("", x.xEntityValue) } From 6936d0543727f9fa3afe10b7ce1a5be24d5d30f5 Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Fri, 25 May 2018 13:59:27 -0400 Subject: [PATCH 239/789] Drop Scala 2.11 from Travis Java 8 and 9 --- .travis.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.travis.yml b/.travis.yml index 11c3d500c..92163102e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -35,6 +35,10 @@ matrix: env: SCALAJS_VERSION=1.0.0-M3 - jdk: oraclejdk9 env: SCALAJS_VERSION=1.0.0-M3 + - scala: 2.11.12 + jdk: oraclejdk8 + - scala: 2.11.12 + jdk: oraclejdk9 - scala: 2.12.6 jdk: openjdk6 - scala: 2.13.0-M3 From c96b34e722c473c7e8ad6ef82ebfcda4d3a7771d Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Tue, 29 May 2018 11:13:44 -0400 Subject: [PATCH 240/789] Build Scala.js 1.0 for Scala 2.11 and 2.13 --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 92163102e..fbc46d984 100644 --- a/.travis.yml +++ b/.travis.yml @@ -31,8 +31,8 @@ env: matrix: exclude: - - scala: 2.13.0-M3 - env: SCALAJS_VERSION=1.0.0-M3 + - jdk: oraclejdk9 + env: SCALAJS_VERSION=0.6.23 - jdk: oraclejdk9 env: SCALAJS_VERSION=1.0.0-M3 - scala: 2.11.12 From acab668c9da90b4217a83d926318496ce433a6a9 Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Sun, 27 May 2018 01:40:58 -0400 Subject: [PATCH 241/789] Rename vars in Utility.combineAdjacentTextNodes --- shared/src/main/scala/scala/xml/Utility.scala | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/shared/src/main/scala/scala/xml/Utility.scala b/shared/src/main/scala/scala/xml/Utility.scala index 88f6e8cd0..59169af71 100755 --- a/shared/src/main/scala/scala/xml/Utility.scala +++ b/shared/src/main/scala/scala/xml/Utility.scala @@ -52,8 +52,8 @@ object Utility extends AnyRef with parsing.TokenTests { private def combineAdjacentTextNodes(children: Node*): Seq[Node] = { children.foldRight(Seq.empty[Node]) { - case (Text(left), Text(right) +: accMinusLast) => Text(left + right) +: accMinusLast - case (n, acc) => n +: acc + case (Text(left), Text(right) +: nodes) => Text(left + right) +: nodes + case (n, nodes) => n +: nodes } } From 1a3b7518cc84a180455ccce43aa01e98334298a1 Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Sun, 27 May 2018 01:44:25 -0400 Subject: [PATCH 242/789] Drop varargs with Utility.combineAdjacentTextNodes --- shared/src/main/scala/scala/xml/Utility.scala | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/shared/src/main/scala/scala/xml/Utility.scala b/shared/src/main/scala/scala/xml/Utility.scala index 59169af71..bd974b3e7 100755 --- a/shared/src/main/scala/scala/xml/Utility.scala +++ b/shared/src/main/scala/scala/xml/Utility.scala @@ -46,11 +46,11 @@ object Utility extends AnyRef with parsing.TokenTests { */ def trim(x: Node): Node = x match { case Elem(pre, lab, md, scp, child@_*) => - val children = combineAdjacentTextNodes(child:_*) flatMap trimProper + val children = combineAdjacentTextNodes(child) flatMap trimProper Elem(pre, lab, md, scp, children.isEmpty, children: _*) } - private def combineAdjacentTextNodes(children: Node*): Seq[Node] = { + private def combineAdjacentTextNodes(children: Seq[Node]): Seq[Node] = { children.foldRight(Seq.empty[Node]) { case (Text(left), Text(right) +: nodes) => Text(left + right) +: nodes case (n, nodes) => n +: nodes @@ -63,7 +63,7 @@ object Utility extends AnyRef with parsing.TokenTests { */ def trimProper(x: Node): Seq[Node] = x match { case Elem(pre, lab, md, scp, child@_*) => - val children = combineAdjacentTextNodes(child:_*) flatMap trimProper + val children = combineAdjacentTextNodes(child) flatMap trimProper Elem(pre, lab, md, scp, children.isEmpty, children: _*) case Text(s) => new TextBuffer().append(s).toText From 9be269fa0704e9573bfa9e239d0f29958bf529ff Mon Sep 17 00:00:00 2001 From: Sean Sullivan Date: Sun, 24 Jun 2018 19:47:00 -0700 Subject: [PATCH 243/789] add 'oraclejdk10' to Travis build matrix --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index fbc46d984..2e4ab6781 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,6 +9,7 @@ jdk: - openjdk6 - oraclejdk8 - oraclejdk9 + - oraclejdk10 scala: - 2.11.12 From b41297200b29ac8291a6aeb49631cc11f52d517f Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Thu, 28 Jun 2018 17:34:35 -0400 Subject: [PATCH 244/789] Drop oraclejdk9 from Travis build --- .travis.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 2e4ab6781..78520bbb0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,7 +8,6 @@ addons: jdk: - openjdk6 - oraclejdk8 - - oraclejdk9 - oraclejdk10 scala: @@ -32,14 +31,14 @@ env: matrix: exclude: - - jdk: oraclejdk9 + - jdk: oraclejdk10 env: SCALAJS_VERSION=0.6.23 - - jdk: oraclejdk9 + - jdk: oraclejdk10 env: SCALAJS_VERSION=1.0.0-M3 - scala: 2.11.12 jdk: oraclejdk8 - scala: 2.11.12 - jdk: oraclejdk9 + jdk: oraclejdk10 - scala: 2.12.6 jdk: openjdk6 - scala: 2.13.0-M3 From 4c632e845f06962ec05169dc7de04c1c504733ae Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Sat, 14 Jul 2018 16:01:19 -0400 Subject: [PATCH 245/789] Clarify doc for NodeSeq projection The confusion is that element searches with \ only operate on the current element's children, while \\ operates on the self, as well. --- shared/src/main/scala/scala/xml/NodeSeq.scala | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/shared/src/main/scala/scala/xml/NodeSeq.scala b/shared/src/main/scala/scala/xml/NodeSeq.scala index f93c6249e..fe071488f 100644 --- a/shared/src/main/scala/scala/xml/NodeSeq.scala +++ b/shared/src/main/scala/scala/xml/NodeSeq.scala @@ -78,10 +78,10 @@ abstract class NodeSeq extends AbstractSeq[Node] with immutable.Seq[Node] with S /** * Projection function, which returns elements of `this` sequence based * on the string `that`. Use: - * - `this \ "foo"` to get a list of all elements that are labelled with `"foo"`; - * - `\ "_"` to get a list of all elements (wildcard); - * - `ns \ "@foo"` to get the unprefixed attribute `"foo"`; - * - `ns \ "@{uri}foo"` to get the prefixed attribute `"pre:foo"` whose + * - `this \ "foo"` to get a list of all children that are labelled with `"foo"`; + * - `this \ "_"` to get a list of all child elements (wildcard); + * - `this \ "@foo"` to get the unprefixed attribute `"foo"` of `this`; + * - `this \ "@{uri}foo"` to get the prefixed attribute `"pre:foo"` whose * prefix `"pre"` is resolved to the namespace `"uri"`. * * For attribute projections, the resulting [[scala.xml.NodeSeq]] attribute @@ -125,10 +125,11 @@ abstract class NodeSeq extends AbstractSeq[Node] with immutable.Seq[Node] with S /** * Projection function, which returns elements of `this` sequence and of * all its subsequences, based on the string `that`. Use: - * - `this \\ 'foo` to get a list of all elements that are labelled with `"foo"`; - * - `\\ "_"` to get a list of all elements (wildcard); - * - `ns \\ "@foo"` to get the unprefixed attribute `"foo"`; - * - `ns \\ "@{uri}foo"` to get each prefixed attribute `"pre:foo"` whose + * - `this \\ "foo" to get a list of all elements that are labelled with `"foo"`, + * including `this`; + * - `this \\ "_"` to get a list of all elements (wildcard), including `this`; + * - `this \\ "@foo"` to get all unprefixed attributes `"foo"`; + * - `this \\ "@{uri}foo"` to get all prefixed attribute `"pre:foo"` whose * prefix `"pre"` is resolved to the namespace `"uri"`. * * For attribute projections, the resulting [[scala.xml.NodeSeq]] attribute From 968c572201beb0de9fb15fb247117ad8fab35b0d Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Sun, 15 Jul 2018 14:17:30 -0400 Subject: [PATCH 246/789] Change comment whitespace for PrettyPrinter --- shared/src/main/scala/scala/xml/PrettyPrinter.scala | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/shared/src/main/scala/scala/xml/PrettyPrinter.scala b/shared/src/main/scala/scala/xml/PrettyPrinter.scala index d202da0e6..13fbd85fb 100755 --- a/shared/src/main/scala/scala/xml/PrettyPrinter.scala +++ b/shared/src/main/scala/scala/xml/PrettyPrinter.scala @@ -19,9 +19,10 @@ import Utility.sbToString * XML nodes. * * @author Burak Emir - * @param width the width to fit the output into - * @param step indentation - * @note This class is not threadsafe and should not be accessed by multiple threads at the same time. + * @param width the width to fit the output into + * @param step indentation + * @note This class is not threadsafe and should not be accessed by + * multiple threads at the same time. */ class PrettyPrinter(width: Int, step: Int, minimizeEmpty: Boolean) { From 102cef38021d6c5a8324e07174f32d06df9d02f3 Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Sun, 15 Jul 2018 14:19:51 -0400 Subject: [PATCH 247/789] Document minimizeEmpty in PrettyPrinter --- shared/src/main/scala/scala/xml/PrettyPrinter.scala | 1 + 1 file changed, 1 insertion(+) diff --git a/shared/src/main/scala/scala/xml/PrettyPrinter.scala b/shared/src/main/scala/scala/xml/PrettyPrinter.scala index 13fbd85fb..01545d61a 100755 --- a/shared/src/main/scala/scala/xml/PrettyPrinter.scala +++ b/shared/src/main/scala/scala/xml/PrettyPrinter.scala @@ -21,6 +21,7 @@ import Utility.sbToString * @author Burak Emir * @param width the width to fit the output into * @param step indentation + * @param minimizeEmpty self-close empty tags * @note This class is not threadsafe and should not be accessed by * multiple threads at the same time. */ From 88334188a85b819a0b9aaf4e38ccbc40e91df874 Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Mon, 16 Jul 2018 12:18:19 -0400 Subject: [PATCH 248/789] Add more tests for PrettyPrinter --- jvm/src/test/scala/scala/xml/XMLTest.scala | 50 +++++++++++++++++++++- 1 file changed, 49 insertions(+), 1 deletion(-) diff --git a/jvm/src/test/scala/scala/xml/XMLTest.scala b/jvm/src/test/scala/scala/xml/XMLTest.scala index 401f0e00a..37d45bccc 100644 --- a/jvm/src/test/scala/scala/xml/XMLTest.scala +++ b/jvm/src/test/scala/scala/xml/XMLTest.scala @@ -754,16 +754,64 @@ class XMLTestJVM { val pp = new xml.PrettyPrinter(4, 2, minimizeEmpty = true) val x = val formatted = pp.format(x) + val expected = + """| + |""".stripMargin assertEquals(x, XML.loadString(formatted)) - assertTrue(formatted.trim.lines.length >= 2) + assertEquals(expected, formatted) } @UnitTest def issue231_withoutAttributes: Unit = { val pp = new xml.PrettyPrinter(4, 2, minimizeEmpty = true) val x = + val expected = + """| + |""".stripMargin val formatted = pp.format(x) assertEquals(x, XML.loadString(formatted)) + assertEquals(expected, formatted) + } + + @UnitTest + def issue231_children: Unit = { + val pp = new xml.PrettyPrinter(4, 2, minimizeEmpty = true) + val x = + val formatted = pp.format(x) + val expected = + """| + | + | + | + | + | + | + |""".stripMargin + assertEquals(expected, formatted) + } + + @UnitTest + def issue231_elementText: Unit = { + val pp = new xml.PrettyPrinter(4, 2, minimizeEmpty = true) + val x = xy + val formatted = pp.format(x) + val expected = + """| + | x + | + | + | y + | + | + |""".stripMargin + assertEquals(expected, formatted) } def toSource(s: String) = new scala.io.Source { From 296a9484b540c30254c38966422181c31d2f83fc Mon Sep 17 00:00:00 2001 From: Seth Tisue Date: Tue, 17 Jul 2018 11:35:23 -0700 Subject: [PATCH 249/789] remove maintainer we haven't heard from @biswanaths in quite a long time now --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 33fd765c1..ac0063667 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ If you are cross-building a project that uses scala-xml with both Scala 2.10 and ## Maintenance status -This library is community-maintained. The lead maintainers are [@aaron_s_hawley](https://github.com/ashawley) and [@biswanaths](https://github.com/biswanaths). +This library is community-maintained. The lead maintainer is [@aaron_s_hawley](https://github.com/ashawley). ## Issues From afa7a76627cb8a913804f3d54402d279c8602a72 Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Mon, 16 Jul 2018 12:28:23 -0400 Subject: [PATCH 250/789] Link to contributor guide Add CONTRIBUTING.md file and mention in README. --- CONTRIBUTING.md | 10 ++++++++++ README.md | 2 ++ 2 files changed, 12 insertions(+) create mode 100644 CONTRIBUTING.md diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 000000000..6c3b9de32 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,10 @@ +Contributing +============ + +Please see the wiki for the scala-xml contributor guide: + +https://github.com/scala/scala-xml/wiki/Contributor-guide + +Thank you, + +The Scala XML maintainers diff --git a/README.md b/README.md index ac0063667..34b0ffc48 100644 --- a/README.md +++ b/README.md @@ -24,6 +24,8 @@ If you are cross-building a project that uses scala-xml with both Scala 2.10 and This library is community-maintained. The lead maintainer is [@aaron_s_hawley](https://github.com/ashawley). +Contributors are welcome, and should read the [contributor guide](https://github.com/scala/scala-xml/wiki/Contributor-guide) on the wiki. + ## Issues Many old issues from the Scala JIRA issue tracker have been migrated From 7a1aa2fc868a1a9406b3491b2dae13e52c8261d8 Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Wed, 18 Jul 2018 09:46:11 -0400 Subject: [PATCH 251/789] Fixes to copyright header --- shared/src/main/scala/scala/xml/Xhtml.scala | 7 +++++++ shared/src/main/scala/scala/xml/dtd/Decl.scala | 12 ++++++------ .../scala/scala/xml/factory/LoggedNodeFactory.scala | 2 +- .../main/scala/scala/xml/factory/NodeFactory.scala | 2 +- .../src/main/scala/scala/xml/factory/XMLLoader.scala | 2 +- .../main/scala/scala/xml/parsing/FatalError.scala | 2 +- .../scala/xml/parsing/NoBindingFactoryAdapter.scala | 2 +- shared/src/main/scala/scala/xml/pull/package.scala | 8 ++++++++ 8 files changed, 26 insertions(+), 11 deletions(-) diff --git a/shared/src/main/scala/scala/xml/Xhtml.scala b/shared/src/main/scala/scala/xml/Xhtml.scala index 5d89101e0..8d4ab2698 100644 --- a/shared/src/main/scala/scala/xml/Xhtml.scala +++ b/shared/src/main/scala/scala/xml/Xhtml.scala @@ -1,3 +1,10 @@ +/* __ *\ +** ________ ___ / / ___ Scala API ** +** / __/ __// _ | / / / _ | (c) 2003-2018, LAMP/EPFL ** +** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** +** /____/\___/_/ |_/____/_/ | | ** +** |/ ** +\* */ package scala package xml diff --git a/shared/src/main/scala/scala/xml/dtd/Decl.scala b/shared/src/main/scala/scala/xml/dtd/Decl.scala index b8cd9209c..1d5994a50 100644 --- a/shared/src/main/scala/scala/xml/dtd/Decl.scala +++ b/shared/src/main/scala/scala/xml/dtd/Decl.scala @@ -1,10 +1,10 @@ /* __ *\ - ** ________ ___ / / ___ Scala API ** - ** / __/ __// _ | / / / _ | (c) 2003-2018, LAMP/EPFL ** - ** __\ \/ /__/ __ |/ /__/ __ | http://www.scala-lang.org/ ** - ** /____/\___/_/ |_/____/_/ | | ** - ** |/ ** - \* */ +** ________ ___ / / ___ Scala API ** +** / __/ __// _ | / / / _ | (c) 2003-2018, LAMP/EPFL ** +** __\ \/ /__/ __ |/ /__/ __ | http://www.scala-lang.org/ ** +** /____/\___/_/ |_/____/_/ | | ** +** |/ ** +\* */ package scala package xml diff --git a/shared/src/main/scala/scala/xml/factory/LoggedNodeFactory.scala b/shared/src/main/scala/scala/xml/factory/LoggedNodeFactory.scala index 10bf57f56..afe3c15ec 100644 --- a/shared/src/main/scala/scala/xml/factory/LoggedNodeFactory.scala +++ b/shared/src/main/scala/scala/xml/factory/LoggedNodeFactory.scala @@ -1,7 +1,7 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** ** / __/ __// _ | / / / _ | (c) 2002-2018, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | ** +** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** \* */ diff --git a/shared/src/main/scala/scala/xml/factory/NodeFactory.scala b/shared/src/main/scala/scala/xml/factory/NodeFactory.scala index 2ca162952..d03961a8f 100644 --- a/shared/src/main/scala/scala/xml/factory/NodeFactory.scala +++ b/shared/src/main/scala/scala/xml/factory/NodeFactory.scala @@ -1,7 +1,7 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** ** / __/ __// _ | / / / _ | (c) 2003-2018, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | ** +** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** \* */ diff --git a/shared/src/main/scala/scala/xml/factory/XMLLoader.scala b/shared/src/main/scala/scala/xml/factory/XMLLoader.scala index 58e2260f9..4bddd2df6 100644 --- a/shared/src/main/scala/scala/xml/factory/XMLLoader.scala +++ b/shared/src/main/scala/scala/xml/factory/XMLLoader.scala @@ -1,7 +1,7 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** ** / __/ __// _ | / / / _ | (c) 2003-2018, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | ** +** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** \* */ diff --git a/shared/src/main/scala/scala/xml/parsing/FatalError.scala b/shared/src/main/scala/scala/xml/parsing/FatalError.scala index 21397bf5d..f913ec53d 100644 --- a/shared/src/main/scala/scala/xml/parsing/FatalError.scala +++ b/shared/src/main/scala/scala/xml/parsing/FatalError.scala @@ -1,7 +1,7 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** ** / __/ __// _ | / / / _ | (c) 2002-2018, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | ** +** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** \* */ diff --git a/shared/src/main/scala/scala/xml/parsing/NoBindingFactoryAdapter.scala b/shared/src/main/scala/scala/xml/parsing/NoBindingFactoryAdapter.scala index 8b0711aa0..3e1d83a40 100644 --- a/shared/src/main/scala/scala/xml/parsing/NoBindingFactoryAdapter.scala +++ b/shared/src/main/scala/scala/xml/parsing/NoBindingFactoryAdapter.scala @@ -1,7 +1,7 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** ** / __/ __// _ | / / / _ | (c) 2003-2018, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | ** +** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** \* */ diff --git a/shared/src/main/scala/scala/xml/pull/package.scala b/shared/src/main/scala/scala/xml/pull/package.scala index 0e3019446..cd50823df 100644 --- a/shared/src/main/scala/scala/xml/pull/package.scala +++ b/shared/src/main/scala/scala/xml/pull/package.scala @@ -1,3 +1,11 @@ +/* __ *\ +** ________ ___ / / ___ Scala API ** +** / __/ __// _ | / / / _ | (c) 2003-2018, LAMP/EPFL ** +** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** +** /____/\___/_/ |_/____/_/ | | ** +** |/ ** +\* */ + package scala package xml From 9256c90d6e5feda9dc1cf50b8c2d086e653a65bd Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Thu, 26 Jul 2018 04:50:59 -0400 Subject: [PATCH 252/789] Add jdk_switcher Travis hack The openjdk6 build was still running on Java 8. This is a copy of the same change Seth Tisue made on 8-Jun-2018 to scala-parser-combinators. --- .travis.yml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 78520bbb0..629df76af 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,6 +5,9 @@ addons: packages: - openjdk-6-jdk +# Needed for openjdk6 +sudo: required + jdk: - openjdk6 - oraclejdk8 @@ -44,7 +47,11 @@ matrix: - scala: 2.13.0-M3 jdk: openjdk6 -script: admin/build.sh +script: + # work around https://github.com/travis-ci/travis-ci/issues/9713 + - if [[ $JAVA_HOME = *java-6* ]]; then jdk_switcher use openjdk6; fi + - java -version + - admin/build.sh before_cache: - find $HOME/.sbt -name "*.lock" | xargs rm From bd32be41ecd49d46303f6015e13c70f0fccd037e Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Mon, 30 Jul 2018 14:59:04 -0400 Subject: [PATCH 253/789] Configure sbt repos for JDK6 --- .sbtrepos | 8 ++++++++ admin/build.sh | 7 ++++++- 2 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 .sbtrepos diff --git a/.sbtrepos b/.sbtrepos new file mode 100644 index 000000000..07c21ad68 --- /dev/null +++ b/.sbtrepos @@ -0,0 +1,8 @@ +[repositories] + local + local-preloaded-ivy: file:///${sbt.preloaded-${sbt.global.base-${user.home}/.sbt}/preloaded/}, [organization]/[module]/[revision]/[type]s/[artifact](-[classifier]).[ext] + local-preloaded: file:///${sbt.preloaded-${sbt.global.base-${user.home}/.sbt}/preloaded/} + maven-central: https://repo1.maven.org/maven2/ + sonatype-public: https://oss.sonatype.org/content/repositories/public + typesafe-ivy-releases: https://repo.typesafe.com/typesafe/ivy-releases/, [organization]/[module]/(scala_[scalaVersion]/)(sbt_[sbtVersion]/)[revision]/[type]s/[artifact](-[classifier]).[ext], bootOnly + sbt-ivy-releases: https://repo.scala-sbt.org/scalasbt/sbt-plugin-releases/, [organization]/[module]/(scala_[scalaVersion]/)(sbt_[sbtVersion]/)[revision]/[type]s/[artifact](-[classifier]).[ext], bootOnly diff --git a/admin/build.sh b/admin/build.sh index 5c5ae5724..2ebd80311 100755 --- a/admin/build.sh +++ b/admin/build.sh @@ -52,4 +52,9 @@ if [[ "$TRAVIS_TAG" =~ $tagPat ]]; then fi fi -sbt "++$TRAVIS_SCALA_VERSION" "$publishVersion" "$projectPrefix/clean" "$projectPrefix/test" "$projectPrefix/publishLocal" "$publishTask" +# Maven Central and Bintray are unreachable over HTTPS +if [[ "$TRAVIS_JDK_VERSION" == "openjdk6" ]]; then + SBTOPTS="-Dsbt.override.build.repos=true -Dsbt.repository.config=./.sbtrepos" +fi + +sbt $SBTOPTS "++$TRAVIS_SCALA_VERSION" "$publishVersion" "$projectPrefix/clean" "$projectPrefix/test" "$projectPrefix/publishLocal" "$publishTask" From 7962fbc2a4fd50aeea073f7140f4f738bca7fa7a Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Mon, 30 Jul 2018 14:59:12 -0400 Subject: [PATCH 254/789] Switch to http for sbt resolvers --- .sbtrepos | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.sbtrepos b/.sbtrepos index 07c21ad68..b9e49c484 100644 --- a/.sbtrepos +++ b/.sbtrepos @@ -2,7 +2,7 @@ local local-preloaded-ivy: file:///${sbt.preloaded-${sbt.global.base-${user.home}/.sbt}/preloaded/}, [organization]/[module]/[revision]/[type]s/[artifact](-[classifier]).[ext] local-preloaded: file:///${sbt.preloaded-${sbt.global.base-${user.home}/.sbt}/preloaded/} - maven-central: https://repo1.maven.org/maven2/ - sonatype-public: https://oss.sonatype.org/content/repositories/public - typesafe-ivy-releases: https://repo.typesafe.com/typesafe/ivy-releases/, [organization]/[module]/(scala_[scalaVersion]/)(sbt_[sbtVersion]/)[revision]/[type]s/[artifact](-[classifier]).[ext], bootOnly - sbt-ivy-releases: https://repo.scala-sbt.org/scalasbt/sbt-plugin-releases/, [organization]/[module]/(scala_[scalaVersion]/)(sbt_[sbtVersion]/)[revision]/[type]s/[artifact](-[classifier]).[ext], bootOnly + maven-central: http://repo1.maven.org/maven2/ + sonatype-public: http://oss.sonatype.org/content/repositories/public + typesafe-ivy-releases: http://repo.typesafe.com/typesafe/ivy-releases/, [organization]/[module]/(scala_[scalaVersion]/)(sbt_[sbtVersion]/)[revision]/[type]s/[artifact](-[classifier]).[ext], bootOnly + sbt-ivy-releases: http://repo.scala-sbt.org/scalasbt/sbt-plugin-releases/, [organization]/[module]/(scala_[scalaVersion]/)(sbt_[sbtVersion]/)[revision]/[type]s/[artifact](-[classifier]).[ext], bootOnly From 3c441bc774c4366d59ed42c4b4bc253da442d8ae Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Wed, 1 Aug 2018 09:21:22 -0400 Subject: [PATCH 255/789] Relicense under Apache 2.0 --- LICENSE | 201 +++++++++++++++++++++++++++++++++++++++++++++++++++++ LICENSE.md | 28 -------- 2 files changed, 201 insertions(+), 28 deletions(-) create mode 100644 LICENSE delete mode 100644 LICENSE.md diff --git a/LICENSE b/LICENSE new file mode 100644 index 000000000..261eeb9e9 --- /dev/null +++ b/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/LICENSE.md b/LICENSE.md deleted file mode 100644 index 0858ac98f..000000000 --- a/LICENSE.md +++ /dev/null @@ -1,28 +0,0 @@ -Copyright (c) 2002-2018 EPFL -Copyright (c) 2011-2018 Lightbend, Inc. - -All rights reserved. - -Redistribution and use in source and binary forms, with or without modification, -are permitted provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. -* Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. -* Neither the name of the EPFL nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR -CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. From 389cdce9d4f1274c6159f591dcd2cc9dcaa2036b Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Thu, 16 Aug 2018 09:03:41 -0400 Subject: [PATCH 256/789] Fix failure for empty string match Trying to match the empty string on descendants (or self) throws an unexpected error: scala> \\ "" java.lang.StringIndexOutOfBoundsException: String index out of range: 0 at java.lang.String.charAt(String.java:646) at scala.collection.immutable.StringOps$.apply$extension(StringOps.scala:37) at scala.xml.NodeSeq.$bslash$bslash(NodeSeq.scala:147) ... The error should be consistent with what is thrown when trying to match the empty string on just children: scala> \ "" java.lang.IllegalArgumentException at scala.xml.NodeSeq.fail$1(NodeSeq.scala:97) at scala.xml.NodeSeq.$bslash(NodeSeq.scala:120) ... This was identified while writing ScalaCheck property tests. --- shared/src/main/scala/scala/xml/NodeSeq.scala | 2 ++ shared/src/test/scala/scala/xml/XMLTest.scala | 10 ++++++++++ 2 files changed, 12 insertions(+) diff --git a/shared/src/main/scala/scala/xml/NodeSeq.scala b/shared/src/main/scala/scala/xml/NodeSeq.scala index fe071488f..21de379bb 100644 --- a/shared/src/main/scala/scala/xml/NodeSeq.scala +++ b/shared/src/main/scala/scala/xml/NodeSeq.scala @@ -140,8 +140,10 @@ abstract class NodeSeq extends AbstractSeq[Node] with immutable.Seq[Node] with S * The document order is preserved. */ def \\(that: String): NodeSeq = { + def fail = throw new IllegalArgumentException(that) def filt(cond: (Node) => Boolean) = this flatMap (_.descendant_or_self) filter cond that match { + case "" => fail case "_" => filt(!_.isAtom) case _ if that(0) == '@' => filt(!_.isAtom) flatMap (_ \ that) case _ => filt(x => !x.isAtom && x.label == that) diff --git a/shared/src/test/scala/scala/xml/XMLTest.scala b/shared/src/test/scala/scala/xml/XMLTest.scala index 998b06dcd..93e443119 100644 --- a/shared/src/test/scala/scala/xml/XMLTest.scala +++ b/shared/src/test/scala/scala/xml/XMLTest.scala @@ -145,6 +145,16 @@ class XMLTest { assertEquals(expected, actual) } + @UnitTest(expected=classOf[IllegalArgumentException]) + def failEmptyStringChildren: Unit = { + \ "" + } + + @UnitTest(expected=classOf[IllegalArgumentException]) + def failEmptyStringDescendants: Unit = { + \\ "" + } + @UnitTest def namespaces: Unit = { val cuckoo = From ee65a974fb759c120fab26065a3133e031ee1718 Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Mon, 24 Sep 2018 23:56:31 -0400 Subject: [PATCH 257/789] Update maven badge to 2.13.0-M5 --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 34b0ffc48..3fbbfef9a 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ scala-xml [![Travis](https://img.shields.io/travis/scala/scala-xml.svg)](https://travis-ci.org/scala/scala-xml) [![latest release for 2.11](https://img.shields.io/maven-central/v/org.scala-lang.modules/scala-xml_2.11.svg?label=scala+2.11)](http://mvnrepository.com/artifact/org.scala-lang.modules/scala-xml_2.11) [![latest release for 2.12](https://img.shields.io/maven-central/v/org.scala-lang.modules/scala-xml_2.12.svg?label=scala+2.12)](http://mvnrepository.com/artifact/org.scala-lang.modules/scala-xml_2.12) -[![latest release for 2.13.0-M3](https://img.shields.io/maven-central/v/org.scala-lang.modules/scala-xml_2.13.0-M3.svg?label=scala+2.13.0-M3)](http://mvnrepository.com/artifact/org.scala-lang.modules/scala-xml_2.13.0-M3) +[![latest release for 2.13.0-M5](https://img.shields.io/maven-central/v/org.scala-lang.modules/scala-xml_2.13.0-M5.svg?label=scala+2.13.0-M5)](http://mvnrepository.com/artifact/org.scala-lang.modules/scala-xml_2.13.0-M5) [![Gitter](https://badges.gitter.im/Join+Chat.svg)](https://gitter.im/scala/scala-xml) ========= From e68e7a8444d69225253aafaf0eb4334fa5f0d739 Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Tue, 25 Sep 2018 00:19:07 -0400 Subject: [PATCH 258/789] Update Scala.js to 0.6.25 and 1.0.0-M5 --- .travis.yml | 8 ++++---- build.sbt | 2 +- project/plugins.sbt | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.travis.yml b/.travis.yml index 629df76af..81e0dfa6b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -29,15 +29,15 @@ env: matrix: # The empty SCALAJS_VERSION will only compile for the JVM - SCALAJS_VERSION= - - SCALAJS_VERSION=0.6.23 - - SCALAJS_VERSION=1.0.0-M3 + - SCALAJS_VERSION=0.6.25 + - SCALAJS_VERSION=1.0.0-M5 matrix: exclude: - jdk: oraclejdk10 - env: SCALAJS_VERSION=0.6.23 + env: SCALAJS_VERSION=0.6.25 - jdk: oraclejdk10 - env: SCALAJS_VERSION=1.0.0-M3 + env: SCALAJS_VERSION=1.0.0-M5 - scala: 2.11.12 jdk: oraclejdk8 - scala: 2.11.12 diff --git a/build.sbt b/build.sbt index a1b38172d..0d5f75b5f 100644 --- a/build.sbt +++ b/build.sbt @@ -19,7 +19,7 @@ lazy val xml = crossProject(JSPlatform, JVMPlatform) scalacOptions in Test += "-Xxml:coalescing", mimaPreviousVersion := { - if (System.getenv("SCALAJS_VERSION") == "1.0.0-M3") None // No such release yet + if (System.getenv("SCALAJS_VERSION") == "1.0.0-M5") None // No such release yet else Some("1.1.0") }, diff --git a/project/plugins.sbt b/project/plugins.sbt index 0670f0eef..62ba94c51 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -6,8 +6,8 @@ else Seq(addSbtPlugin("com.typesafe.sbt" % "sbt-osgi" % "0.9.3")) val scalaJSVersion = - Option(System.getenv("SCALAJS_VERSION")).filter(_.nonEmpty).getOrElse("0.6.23") + Option(System.getenv("SCALAJS_VERSION")).filter(_.nonEmpty).getOrElse("0.6.25") addSbtPlugin("org.scala-js" % "sbt-scalajs" % scalaJSVersion) -addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "0.4.0") +addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "0.5.0") addSbtPlugin("org.scala-lang.modules" % "sbt-scala-module" % "1.0.14") From 57e5dd7176a9b4037a895615eabe0d5820bb4f92 Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Tue, 25 Sep 2018 06:33:21 -0400 Subject: [PATCH 259/789] Drop Scala 2.11 for Scalajs 1.0 --- .travis.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.travis.yml b/.travis.yml index 81e0dfa6b..07a3600f9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -38,6 +38,8 @@ matrix: env: SCALAJS_VERSION=0.6.25 - jdk: oraclejdk10 env: SCALAJS_VERSION=1.0.0-M5 + - scala: 2.11.12 + env: SCALAJS_VERSION=1.0.0-M5 - scala: 2.11.12 jdk: oraclejdk8 - scala: 2.11.12 From 61a2691875c518e3564c3552fa004b4df730b810 Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Fri, 21 Sep 2018 10:08:06 -0400 Subject: [PATCH 260/789] Fix exception in XhtmlParser with HTML5 docype Make characters, including whitespace, after the `html' identifier in be optional. Otherwise, the following errors are emitted: file.xml:2:15: whitespace expected ^ file.xml:2:15: document must contain exactly one element And a java.lang.NullPointerException is thrown. Unfortunately, testing with Source.fromString doesn't reproduce the NullPointerException that occurs with Source.fromFile. --- .../xml/parsing/ConstructingParserTest.scala | 52 ++++++++++++++++ .../scala/xml/parsing/XhtmlParserTest.scala | 61 +++++++++++++++++++ .../scala/xml/parsing/MarkupParser.scala | 2 +- 3 files changed, 114 insertions(+), 1 deletion(-) create mode 100644 jvm/src/test/scala/scala/xml/parsing/XhtmlParserTest.scala diff --git a/jvm/src/test/scala/scala/xml/parsing/ConstructingParserTest.scala b/jvm/src/test/scala/scala/xml/parsing/ConstructingParserTest.scala index d67524c51..4a8cf3134 100644 --- a/jvm/src/test/scala/scala/xml/parsing/ConstructingParserTest.scala +++ b/jvm/src/test/scala/scala/xml/parsing/ConstructingParserTest.scala @@ -4,6 +4,7 @@ package parsing import scala.io.Source import org.junit.Test import scala.xml.JUnitAssertsForXML.{ assertEquals => assertXml } +import org.junit.Assert.assertEquals class ConstructingParserTest { @@ -19,4 +20,55 @@ class ConstructingParserTest { } + /* Example of using SYSTEM in DOCTYPE */ + @Test + def docbookTest = { + val xml = + """| + | + | Book + | + | Chapter + | Text + | + |""".stripMargin + + val expected = + Book + + Chapter + Text + + + + val source = new Source { + val iter = xml.iterator + override def reportError(pos: Int, msg: String, out: java.io.PrintStream = Console.err) = {} + } + + val doc = ConstructingParser.fromSource(source, true).document + + assertEquals(expected, doc.theSeq) + } + + /* Unsupported use of lowercase DOCTYPE and SYSTEM */ + @Test(expected = classOf[scala.xml.parsing.FatalError]) + def docbookFail: Unit = { + val xml = + """| + | + |Book + | + |Chapter + |Text + | + |""".stripMargin + + val source = new Source { + val iter = xml.iterator + override def reportError(pos: Int, msg: String, out: java.io.PrintStream = Console.err) = {} + } + + ConstructingParser.fromSource(source, true).content(TopScope) + } } diff --git a/jvm/src/test/scala/scala/xml/parsing/XhtmlParserTest.scala b/jvm/src/test/scala/scala/xml/parsing/XhtmlParserTest.scala new file mode 100644 index 000000000..fd7c8ccae --- /dev/null +++ b/jvm/src/test/scala/scala/xml/parsing/XhtmlParserTest.scala @@ -0,0 +1,61 @@ +package scala.xml +package parsing + +import scala.io.Source + +import org.junit.Test +import org.junit.Assert.assertEquals + +class XhtmlParserTest { + + @Test + def issue259: Unit = { + val xml = + """| + | + | + | + | + | + |

Text

+ | + |""".stripMargin + + val expected = + + + + +

Text

+ + + + assertEquals(expected, XhtmlParser(Source.fromString(xml)).theSeq) + } + + @Test + def html4Strict: Unit = { + val xml = + """| + | + | + | Title + | + | + |

Text

+ | + |""".stripMargin + + val expected = + + Title + + +

Text

+ + + + assertEquals(expected, XhtmlParser(Source.fromString(xml)).theSeq) + } +} diff --git a/shared/src/main/scala/scala/xml/parsing/MarkupParser.scala b/shared/src/main/scala/scala/xml/parsing/MarkupParser.scala index 0b2f0d567..880d9bd7b 100755 --- a/shared/src/main/scala/scala/xml/parsing/MarkupParser.scala +++ b/shared/src/main/scala/scala/xml/parsing/MarkupParser.scala @@ -518,7 +518,7 @@ trait MarkupParser extends MarkupParserCommon with TokenTests { xToken("DOCTYPE") xSpace() val n = xName - xSpace() + xSpaceOpt() //external ID if ('S' == ch || 'P' == ch) { extID = externalID() From 1e1051907da39cf88baf1cda97d86200721cda13 Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Fri, 21 Sep 2018 10:18:39 -0400 Subject: [PATCH 261/789] Add Java 11 to Travis --- .travis.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 07a3600f9..ef62eb34d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,7 +11,7 @@ sudo: required jdk: - openjdk6 - oraclejdk8 - - oraclejdk10 + - oraclejdk11 scala: - 2.11.12 @@ -34,16 +34,16 @@ env: matrix: exclude: - - jdk: oraclejdk10 + - jdk: oraclejdk11 env: SCALAJS_VERSION=0.6.25 - - jdk: oraclejdk10 + - jdk: oraclejdk11 env: SCALAJS_VERSION=1.0.0-M5 - scala: 2.11.12 env: SCALAJS_VERSION=1.0.0-M5 - scala: 2.11.12 jdk: oraclejdk8 - scala: 2.11.12 - jdk: oraclejdk10 + jdk: oraclejdk11 - scala: 2.12.6 jdk: openjdk6 - scala: 2.13.0-M3 From 93d87dbbeb3a73ab1f002b028958bec31908532e Mon Sep 17 00:00:00 2001 From: Seth Tisue Date: Wed, 26 Sep 2018 09:37:28 -0700 Subject: [PATCH 262/789] use openjdk11 not oraclejdk11 historically the Oracle one was the most standard one, but with the new licensing model for 11, it's really OpenJDK that's the standard one now, and the Oracle one is a commercial-use thing --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index ef62eb34d..5c9b2abc4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,7 +11,7 @@ sudo: required jdk: - openjdk6 - oraclejdk8 - - oraclejdk11 + - openjdk11 scala: - 2.11.12 From 054cd8880db15e07b2356ceef180b65ba2dc5653 Mon Sep 17 00:00:00 2001 From: Seth Tisue Date: Wed, 26 Sep 2018 09:59:14 -0700 Subject: [PATCH 263/789] complete OracleJDK11 -> OpenJDK11 move gah, I messed up #265 --- .travis.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 5c9b2abc4..14a493fb2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -34,16 +34,16 @@ env: matrix: exclude: - - jdk: oraclejdk11 + - jdk: openjdk11 env: SCALAJS_VERSION=0.6.25 - - jdk: oraclejdk11 + - jdk: openjdk11 env: SCALAJS_VERSION=1.0.0-M5 - scala: 2.11.12 env: SCALAJS_VERSION=1.0.0-M5 - scala: 2.11.12 jdk: oraclejdk8 - scala: 2.11.12 - jdk: oraclejdk11 + jdk: openjdk11 - scala: 2.12.6 jdk: openjdk6 - scala: 2.13.0-M3 From 2d99e29e2273d12539204942d883bbd4632d6236 Mon Sep 17 00:00:00 2001 From: Lukas Rytz Date: Thu, 22 Mar 2018 22:31:04 +0100 Subject: [PATCH 264/789] Changes to cross-compile with the 2.13 collections --- build.sbt | 10 +++++++ .../scala/xml/ScalaVersionSpecific.scala | 22 +++++++++++++++ .../scala/xml/ScalaVersionSpecific.scala | 27 +++++++++++++++++++ .../src/main/scala/scala/xml/NodeBuffer.scala | 5 +--- shared/src/main/scala/scala/xml/NodeSeq.scala | 23 ++++++++-------- 5 files changed, 71 insertions(+), 16 deletions(-) create mode 100644 shared/src/main/scala-2.11-2.12/scala/xml/ScalaVersionSpecific.scala create mode 100644 shared/src/main/scala-2.13/scala/xml/ScalaVersionSpecific.scala diff --git a/build.sbt b/build.sbt index 0d5f75b5f..3d129124d 100644 --- a/build.sbt +++ b/build.sbt @@ -23,6 +23,16 @@ lazy val xml = crossProject(JSPlatform, JVMPlatform) else Some("1.1.0") }, + unmanagedSourceDirectories in Compile ++= { + (unmanagedSourceDirectories in Compile).value.map { dir => + val sv = scalaVersion.value + CrossVersion.partialVersion(sv) match { + case Some((2, 13)) if !sv.startsWith("2.13.0-M3") => file(dir.getPath ++ "-2.13") // TODO: remove M3 guard once M4 is out. + case _ => file(dir.getPath ++ "-2.11-2.12") + } + } + }, + apiMappings ++= Map( scalaInstance.value.libraryJar -> url(s"http://www.scala-lang.org/api/${scalaVersion.value}/") diff --git a/shared/src/main/scala-2.11-2.12/scala/xml/ScalaVersionSpecific.scala b/shared/src/main/scala-2.11-2.12/scala/xml/ScalaVersionSpecific.scala new file mode 100644 index 000000000..eee27f621 --- /dev/null +++ b/shared/src/main/scala-2.11-2.12/scala/xml/ScalaVersionSpecific.scala @@ -0,0 +1,22 @@ +package scala.xml + +import scala.collection.SeqLike +import scala.collection.generic.CanBuildFrom + +object ScalaVersionSpecific { + import NodeSeq.Coll + type CBF[-From, -A, +C] = CanBuildFrom[From, A, C] + object NodeSeqCBF extends CanBuildFrom[Coll, Node, NodeSeq] { + def apply(from: Coll) = NodeSeq.newBuilder + def apply() = NodeSeq.newBuilder + } +} + +trait ScalaVersionSpecificNodeSeq extends SeqLike[Node, NodeSeq] { self: NodeSeq => + /** Creates a list buffer as builder for this class */ + override protected[this] def newBuilder = NodeSeq.newBuilder +} + +trait ScalaVersionSpecificNodeBuffer { self: NodeBuffer => + override def stringPrefix: String = "NodeBuffer" +} diff --git a/shared/src/main/scala-2.13/scala/xml/ScalaVersionSpecific.scala b/shared/src/main/scala-2.13/scala/xml/ScalaVersionSpecific.scala new file mode 100644 index 000000000..6b66691c5 --- /dev/null +++ b/shared/src/main/scala-2.13/scala/xml/ScalaVersionSpecific.scala @@ -0,0 +1,27 @@ +package scala.xml + +import scala.collection.immutable.StrictOptimizedSeqOps +import scala.collection.{SeqOps, immutable, mutable} +import scala.collection.BuildFrom +import scala.collection.mutable.Builder + +object ScalaVersionSpecific { + import NodeSeq.Coll + type CBF[-From, -A, +C] = BuildFrom[From, A, C] + object NodeSeqCBF extends BuildFrom[Coll, Node, NodeSeq] { + def newBuilder(from: Coll): Builder[Node, NodeSeq] = NodeSeq.newBuilder + def fromSpecificIterable(from: Coll)(it: Iterable[Node]): NodeSeq = (NodeSeq.newBuilder ++= from).result() + } +} + +trait ScalaVersionSpecificNodeSeq + extends SeqOps[Node, immutable.Seq, NodeSeq] + with StrictOptimizedSeqOps[Node, immutable.Seq, NodeSeq] { self: NodeSeq => + override def fromSpecificIterable(coll: Iterable[Node]): NodeSeq = (NodeSeq.newBuilder ++= coll).result() + + override def newSpecificBuilder(): mutable.Builder[Node, NodeSeq] = NodeSeq.newBuilder +} + +trait ScalaVersionSpecificNodeBuffer { self: NodeBuffer => + override def className: String = "NodeBuffer" +} diff --git a/shared/src/main/scala/scala/xml/NodeBuffer.scala b/shared/src/main/scala/scala/xml/NodeBuffer.scala index 84692b264..2b0a0c851 100644 --- a/shared/src/main/scala/scala/xml/NodeBuffer.scala +++ b/shared/src/main/scala/scala/xml/NodeBuffer.scala @@ -19,10 +19,7 @@ package xml * * @author Burak Emir */ -class NodeBuffer extends scala.collection.mutable.ArrayBuffer[Node] { - - override def stringPrefix: String = "NodeBuffer" - +class NodeBuffer extends scala.collection.mutable.ArrayBuffer[Node] with ScalaVersionSpecificNodeBuffer { /** * Append given object to this buffer, returns reference on this * `NodeBuffer` for convenience. Some rules apply: diff --git a/shared/src/main/scala/scala/xml/NodeSeq.scala b/shared/src/main/scala/scala/xml/NodeSeq.scala index 21de379bb..eb7056272 100644 --- a/shared/src/main/scala/scala/xml/NodeSeq.scala +++ b/shared/src/main/scala/scala/xml/NodeSeq.scala @@ -9,9 +9,9 @@ package scala package xml -import scala.collection.{ mutable, immutable, generic, SeqLike, AbstractSeq } +import scala.collection.{ mutable, immutable, AbstractSeq } import mutable.{ Builder, ListBuffer } -import generic.{ CanBuildFrom } +import ScalaVersionSpecific.CBF import scala.language.implicitConversions import scala.collection.Seq @@ -25,12 +25,15 @@ object NodeSeq { def fromSeq(s: Seq[Node]): NodeSeq = new NodeSeq { def theSeq = s } + + // --- + // For 2.11 / 2.12 only. Moving the implicit to a parent trait of `object NodeSeq` and keeping it + // in ScalaVersionSpecific doesn't work because the implicit becomes less specific, which leads to + // ambiguities. type Coll = NodeSeq - implicit def canBuildFrom: CanBuildFrom[Coll, Node, NodeSeq] = - new CanBuildFrom[Coll, Node, NodeSeq] { - def apply(from: Coll) = newBuilder - def apply() = newBuilder - } + implicit def canBuildFrom: CBF[Coll, Node, NodeSeq] = ScalaVersionSpecific.NodeSeqCBF + // --- + def newBuilder: Builder[Node, NodeSeq] = new ListBuffer[Node] mapResult fromSeq implicit def seqToNodeSeq(s: Seq[Node]): NodeSeq = fromSeq(s) } @@ -41,11 +44,7 @@ object NodeSeq { * * @author Burak Emir */ -abstract class NodeSeq extends AbstractSeq[Node] with immutable.Seq[Node] with SeqLike[Node, NodeSeq] with Equality with Serializable { - - /** Creates a list buffer as builder for this class */ - override protected[this] def newBuilder = NodeSeq.newBuilder - +abstract class NodeSeq extends AbstractSeq[Node] with immutable.Seq[Node] with ScalaVersionSpecificNodeSeq with Equality with Serializable { def theSeq: Seq[Node] def length = theSeq.length override def iterator = theSeq.iterator From 4c7a945436dea36b0413f42f8741e72fe2e8fa50 Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Wed, 16 May 2018 10:31:46 -0600 Subject: [PATCH 265/789] Use scala 2.13.0-M4 milestone release --- .travis.yml | 4 ++-- build.sbt | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 14a493fb2..efe857912 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,7 +16,7 @@ jdk: scala: - 2.11.12 - 2.12.6 - - 2.13.0-M3 + - 2.13.0-M4 env: global: @@ -46,7 +46,7 @@ matrix: jdk: openjdk11 - scala: 2.12.6 jdk: openjdk6 - - scala: 2.13.0-M3 + - scala: 2.13.0-M4 jdk: openjdk6 script: diff --git a/build.sbt b/build.sbt index 3d129124d..8fb650c3e 100644 --- a/build.sbt +++ b/build.sbt @@ -1,7 +1,7 @@ import sbtcrossproject.{crossProject, CrossType} import ScalaModulePlugin._ -crossScalaVersions in ThisBuild := List("2.12.6", "2.11.12", "2.13.0-M3") +crossScalaVersions in ThisBuild := List("2.12.6", "2.11.12", "2.13.0-M4") lazy val xml = crossProject(JSPlatform, JVMPlatform) .withoutSuffixFor(JVMPlatform) @@ -27,7 +27,7 @@ lazy val xml = crossProject(JSPlatform, JVMPlatform) (unmanagedSourceDirectories in Compile).value.map { dir => val sv = scalaVersion.value CrossVersion.partialVersion(sv) match { - case Some((2, 13)) if !sv.startsWith("2.13.0-M3") => file(dir.getPath ++ "-2.13") // TODO: remove M3 guard once M4 is out. + case Some((2, 13)) => file(dir.getPath ++ "-2.13") case _ => file(dir.getPath ++ "-2.11-2.12") } } From eab3a7970f281c17ec0464b861d02a6ca13f7bfe Mon Sep 17 00:00:00 2001 From: Lukas Rytz Date: Fri, 18 May 2018 22:03:54 +0200 Subject: [PATCH 266/789] Make ScalaVersionSpecific non-public --- .../scala-2.11-2.12/scala/xml/ScalaVersionSpecific.scala | 6 +++--- .../main/scala-2.13/scala/xml/ScalaVersionSpecific.scala | 9 ++++----- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/shared/src/main/scala-2.11-2.12/scala/xml/ScalaVersionSpecific.scala b/shared/src/main/scala-2.11-2.12/scala/xml/ScalaVersionSpecific.scala index eee27f621..417a3bcc6 100644 --- a/shared/src/main/scala-2.11-2.12/scala/xml/ScalaVersionSpecific.scala +++ b/shared/src/main/scala-2.11-2.12/scala/xml/ScalaVersionSpecific.scala @@ -3,7 +3,7 @@ package scala.xml import scala.collection.SeqLike import scala.collection.generic.CanBuildFrom -object ScalaVersionSpecific { +private[xml] object ScalaVersionSpecific { import NodeSeq.Coll type CBF[-From, -A, +C] = CanBuildFrom[From, A, C] object NodeSeqCBF extends CanBuildFrom[Coll, Node, NodeSeq] { @@ -12,11 +12,11 @@ object ScalaVersionSpecific { } } -trait ScalaVersionSpecificNodeSeq extends SeqLike[Node, NodeSeq] { self: NodeSeq => +private[xml] trait ScalaVersionSpecificNodeSeq extends SeqLike[Node, NodeSeq] { self: NodeSeq => /** Creates a list buffer as builder for this class */ override protected[this] def newBuilder = NodeSeq.newBuilder } -trait ScalaVersionSpecificNodeBuffer { self: NodeBuffer => +private[xml] trait ScalaVersionSpecificNodeBuffer { self: NodeBuffer => override def stringPrefix: String = "NodeBuffer" } diff --git a/shared/src/main/scala-2.13/scala/xml/ScalaVersionSpecific.scala b/shared/src/main/scala-2.13/scala/xml/ScalaVersionSpecific.scala index 6b66691c5..fb256ba60 100644 --- a/shared/src/main/scala-2.13/scala/xml/ScalaVersionSpecific.scala +++ b/shared/src/main/scala-2.13/scala/xml/ScalaVersionSpecific.scala @@ -5,7 +5,7 @@ import scala.collection.{SeqOps, immutable, mutable} import scala.collection.BuildFrom import scala.collection.mutable.Builder -object ScalaVersionSpecific { +private[xml] object ScalaVersionSpecific { import NodeSeq.Coll type CBF[-From, -A, +C] = BuildFrom[From, A, C] object NodeSeqCBF extends BuildFrom[Coll, Node, NodeSeq] { @@ -14,14 +14,13 @@ object ScalaVersionSpecific { } } -trait ScalaVersionSpecificNodeSeq +private[xml] trait ScalaVersionSpecificNodeSeq extends SeqOps[Node, immutable.Seq, NodeSeq] with StrictOptimizedSeqOps[Node, immutable.Seq, NodeSeq] { self: NodeSeq => override def fromSpecificIterable(coll: Iterable[Node]): NodeSeq = (NodeSeq.newBuilder ++= coll).result() - - override def newSpecificBuilder(): mutable.Builder[Node, NodeSeq] = NodeSeq.newBuilder + override def newSpecificBuilder: mutable.Builder[Node, NodeSeq] = NodeSeq.newBuilder } -trait ScalaVersionSpecificNodeBuffer { self: NodeBuffer => +private[xml] trait ScalaVersionSpecificNodeBuffer { self: NodeBuffer => override def className: String = "NodeBuffer" } From 246634d2dbc19633f5216ff577a643751c25fd04 Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Tue, 16 Oct 2018 10:57:45 -0400 Subject: [PATCH 267/789] Bump version for next release --- build.sbt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build.sbt b/build.sbt index 8fb650c3e..9dcb1cfed 100644 --- a/build.sbt +++ b/build.sbt @@ -11,7 +11,7 @@ lazy val xml = crossProject(JSPlatform, JVMPlatform) .jvmSettings(scalaModuleSettingsJVM) .settings( name := "scala-xml", - version := "1.1.1-SNAPSHOT", + version := "1.2.0-SNAPSHOT", // Compiler team advised avoiding the -Xfuture option for releases. // The output with -Xfuture should be periodically checked, though. @@ -20,7 +20,7 @@ lazy val xml = crossProject(JSPlatform, JVMPlatform) mimaPreviousVersion := { if (System.getenv("SCALAJS_VERSION") == "1.0.0-M5") None // No such release yet - else Some("1.1.0") + else Some("1.1.1") }, unmanagedSourceDirectories in Compile ++= { From 8ffdb970d0a0a465706456e754aec082869f5ae1 Mon Sep 17 00:00:00 2001 From: Seth Tisue Date: Fri, 17 Aug 2018 19:11:24 -0700 Subject: [PATCH 268/789] Switch to includeOnce in 2.13 Scala-specific code for M5 --- .../main/scala-2.13/scala/xml/ScalaVersionSpecific.scala | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/shared/src/main/scala-2.13/scala/xml/ScalaVersionSpecific.scala b/shared/src/main/scala-2.13/scala/xml/ScalaVersionSpecific.scala index fb256ba60..0d0c99167 100644 --- a/shared/src/main/scala-2.13/scala/xml/ScalaVersionSpecific.scala +++ b/shared/src/main/scala-2.13/scala/xml/ScalaVersionSpecific.scala @@ -1,7 +1,7 @@ package scala.xml import scala.collection.immutable.StrictOptimizedSeqOps -import scala.collection.{SeqOps, immutable, mutable} +import scala.collection.{SeqOps, IterableOnce, immutable, mutable} import scala.collection.BuildFrom import scala.collection.mutable.Builder @@ -10,14 +10,14 @@ private[xml] object ScalaVersionSpecific { type CBF[-From, -A, +C] = BuildFrom[From, A, C] object NodeSeqCBF extends BuildFrom[Coll, Node, NodeSeq] { def newBuilder(from: Coll): Builder[Node, NodeSeq] = NodeSeq.newBuilder - def fromSpecificIterable(from: Coll)(it: Iterable[Node]): NodeSeq = (NodeSeq.newBuilder ++= from).result() + def fromSpecific(from: Coll)(it: IterableOnce[Node]): NodeSeq = (NodeSeq.newBuilder ++= from).result() } } private[xml] trait ScalaVersionSpecificNodeSeq extends SeqOps[Node, immutable.Seq, NodeSeq] with StrictOptimizedSeqOps[Node, immutable.Seq, NodeSeq] { self: NodeSeq => - override def fromSpecificIterable(coll: Iterable[Node]): NodeSeq = (NodeSeq.newBuilder ++= coll).result() + override def fromSpecific(coll: IterableOnce[Node]): NodeSeq = (NodeSeq.newBuilder ++= coll).result() override def newSpecificBuilder: mutable.Builder[Node, NodeSeq] = NodeSeq.newBuilder } From d3963467298cd73c56db3a8c2961721fe64f89cb Mon Sep 17 00:00:00 2001 From: Seth Tisue Date: Tue, 21 Aug 2018 13:25:39 -0700 Subject: [PATCH 269/789] Name-based pattern matching dropped for unapplySeq in 2.13 --- shared/src/main/scala/scala/xml/Elem.scala | 2 +- shared/src/main/scala/scala/xml/Node.scala | 2 +- shared/src/main/scala/scala/xml/QNode.scala | 2 +- shared/src/test/scala/scala/xml/PatternMatching.scala | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/shared/src/main/scala/scala/xml/Elem.scala b/shared/src/main/scala/scala/xml/Elem.scala index 8392255ca..288133e4c 100755 --- a/shared/src/main/scala/scala/xml/Elem.scala +++ b/shared/src/main/scala/scala/xml/Elem.scala @@ -36,7 +36,7 @@ object Elem { def unapplySeq(n: Node) = n match { case _: SpecialNode | _: Group => None - case _ => Some((n.prefix, n.label, n.attributes, n.scope, n.child)) + case _ => Some((n.prefix, n.label, n.attributes, n.scope, n.child.toSeq)) } import scala.sys.process._ diff --git a/shared/src/main/scala/scala/xml/Node.scala b/shared/src/main/scala/scala/xml/Node.scala index f62edabda..907dd4bb8 100755 --- a/shared/src/main/scala/scala/xml/Node.scala +++ b/shared/src/main/scala/scala/xml/Node.scala @@ -24,7 +24,7 @@ object Node { /** the empty namespace */ val EmptyNamespace = "" - def unapplySeq(n: Node) = Some((n.label, n.attributes, n.child)) + def unapplySeq(n: Node) = Some((n.label, n.attributes, n.child.toSeq)) } /** diff --git a/shared/src/main/scala/scala/xml/QNode.scala b/shared/src/main/scala/scala/xml/QNode.scala index 3d41d2e79..5e5d052fa 100644 --- a/shared/src/main/scala/scala/xml/QNode.scala +++ b/shared/src/main/scala/scala/xml/QNode.scala @@ -16,5 +16,5 @@ package xml * @author Burak Emir */ object QNode { - def unapplySeq(n: Node) = Some((n.scope.getURI(n.prefix), n.label, n.attributes, n.child)) + def unapplySeq(n: Node) = Some((n.scope.getURI(n.prefix), n.label, n.attributes, n.child.toSeq)) } diff --git a/shared/src/test/scala/scala/xml/PatternMatching.scala b/shared/src/test/scala/scala/xml/PatternMatching.scala index 41644cec1..32d4b9b78 100644 --- a/shared/src/test/scala/scala/xml/PatternMatching.scala +++ b/shared/src/test/scala/scala/xml/PatternMatching.scala @@ -58,9 +58,9 @@ class PatternMatching extends { object SafeNodeSeq { def unapplySeq(any: Any): Option[Seq[Node]] = any match { - case s: Seq[_] => Some(s flatMap (_ match { + case s: Seq[_] => Some((s flatMap (_ match { case n: Node => n case _ => NodeSeq.Empty - })) case _ => None + })).toSeq) case _ => None } } From 8c48d07191c45f71669f973710549ba8ed7a5630 Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Wed, 29 Aug 2018 21:54:31 -0400 Subject: [PATCH 270/789] Use scala 2.13.0-M5 milestone release --- .travis.yml | 4 ++-- build.sbt | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index efe857912..cca72f2e8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,7 +16,7 @@ jdk: scala: - 2.11.12 - 2.12.6 - - 2.13.0-M4 + - 2.13.0-M5 env: global: @@ -46,7 +46,7 @@ matrix: jdk: openjdk11 - scala: 2.12.6 jdk: openjdk6 - - scala: 2.13.0-M4 + - scala: 2.13.0-M5 jdk: openjdk6 script: diff --git a/build.sbt b/build.sbt index 9dcb1cfed..e851ea0f3 100644 --- a/build.sbt +++ b/build.sbt @@ -1,7 +1,7 @@ import sbtcrossproject.{crossProject, CrossType} import ScalaModulePlugin._ -crossScalaVersions in ThisBuild := List("2.12.6", "2.11.12", "2.13.0-M4") +crossScalaVersions in ThisBuild := List("2.12.6", "2.11.12", "2.13.0-M5") lazy val xml = crossProject(JSPlatform, JVMPlatform) .withoutSuffixFor(JVMPlatform) From de93de554165b2e006d20dc2b8cf585e6a7d7081 Mon Sep 17 00:00:00 2001 From: xuwei-k <6b656e6a69@gmail.com> Date: Thu, 30 Aug 2018 09:09:04 +0900 Subject: [PATCH 271/789] override writeReplace. fix serialize error https://github.com/scala/scala/blob/v2.13.0-M5/src/library/scala/collection/Iterable.scala#L42-L46 --- shared/src/main/scala/scala/xml/MetaData.scala | 2 ++ shared/src/main/scala/scala/xml/NodeSeq.scala | 2 ++ 2 files changed, 4 insertions(+) diff --git a/shared/src/main/scala/scala/xml/MetaData.scala b/shared/src/main/scala/scala/xml/MetaData.scala index 1affff4e0..cdb988518 100644 --- a/shared/src/main/scala/scala/xml/MetaData.scala +++ b/shared/src/main/scala/scala/xml/MetaData.scala @@ -225,4 +225,6 @@ abstract class MetaData final def remove(namespace: String, owner: Node, key: String): MetaData = remove(namespace, owner.scope, key) + + protected[this] override def writeReplace(): AnyRef = this } diff --git a/shared/src/main/scala/scala/xml/NodeSeq.scala b/shared/src/main/scala/scala/xml/NodeSeq.scala index eb7056272..431d8461e 100644 --- a/shared/src/main/scala/scala/xml/NodeSeq.scala +++ b/shared/src/main/scala/scala/xml/NodeSeq.scala @@ -158,4 +158,6 @@ abstract class NodeSeq extends AbstractSeq[Node] with immutable.Seq[Node] with S override def toString(): String = theSeq.mkString def text: String = (this map (_.text)).mkString + + protected[this] override def writeReplace(): AnyRef = this } From bd764f0e13e89548fb484f3b95d324e1712f4415 Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Fri, 12 Oct 2018 18:32:01 -0400 Subject: [PATCH 272/789] Make writeReplace Scala version-specific --- .../main/scala-2.11-2.12/scala/xml/ScalaVersionSpecific.scala | 4 ++++ .../src/main/scala-2.13/scala/xml/ScalaVersionSpecific.scala | 4 ++++ shared/src/main/scala/scala/xml/MetaData.scala | 3 +-- shared/src/main/scala/scala/xml/NodeSeq.scala | 4 +--- 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/shared/src/main/scala-2.11-2.12/scala/xml/ScalaVersionSpecific.scala b/shared/src/main/scala-2.11-2.12/scala/xml/ScalaVersionSpecific.scala index 417a3bcc6..fd3452089 100644 --- a/shared/src/main/scala-2.11-2.12/scala/xml/ScalaVersionSpecific.scala +++ b/shared/src/main/scala-2.11-2.12/scala/xml/ScalaVersionSpecific.scala @@ -20,3 +20,7 @@ private[xml] trait ScalaVersionSpecificNodeSeq extends SeqLike[Node, NodeSeq] { private[xml] trait ScalaVersionSpecificNodeBuffer { self: NodeBuffer => override def stringPrefix: String = "NodeBuffer" } + +private[xml] trait ScalaVersionSpecificIterableSerializable[+A] { // extends Iterable[A] { + // protected[this] override def writeReplace(): AnyRef = this +} diff --git a/shared/src/main/scala-2.13/scala/xml/ScalaVersionSpecific.scala b/shared/src/main/scala-2.13/scala/xml/ScalaVersionSpecific.scala index 0d0c99167..c47518336 100644 --- a/shared/src/main/scala-2.13/scala/xml/ScalaVersionSpecific.scala +++ b/shared/src/main/scala-2.13/scala/xml/ScalaVersionSpecific.scala @@ -24,3 +24,7 @@ private[xml] trait ScalaVersionSpecificNodeSeq private[xml] trait ScalaVersionSpecificNodeBuffer { self: NodeBuffer => override def className: String = "NodeBuffer" } + +private[xml] trait ScalaVersionSpecificIterableSerializable[+A] extends Iterable[A] { + protected[this] override def writeReplace(): AnyRef = this +} diff --git a/shared/src/main/scala/scala/xml/MetaData.scala b/shared/src/main/scala/scala/xml/MetaData.scala index cdb988518..f930a7fb8 100644 --- a/shared/src/main/scala/scala/xml/MetaData.scala +++ b/shared/src/main/scala/scala/xml/MetaData.scala @@ -82,6 +82,7 @@ abstract class MetaData extends AbstractIterable[MetaData] with Iterable[MetaData] with Equality + with ScalaVersionSpecificIterableSerializable[MetaData] with Serializable { /** @@ -225,6 +226,4 @@ abstract class MetaData final def remove(namespace: String, owner: Node, key: String): MetaData = remove(namespace, owner.scope, key) - - protected[this] override def writeReplace(): AnyRef = this } diff --git a/shared/src/main/scala/scala/xml/NodeSeq.scala b/shared/src/main/scala/scala/xml/NodeSeq.scala index 431d8461e..94f7535d8 100644 --- a/shared/src/main/scala/scala/xml/NodeSeq.scala +++ b/shared/src/main/scala/scala/xml/NodeSeq.scala @@ -44,7 +44,7 @@ object NodeSeq { * * @author Burak Emir */ -abstract class NodeSeq extends AbstractSeq[Node] with immutable.Seq[Node] with ScalaVersionSpecificNodeSeq with Equality with Serializable { +abstract class NodeSeq extends AbstractSeq[Node] with immutable.Seq[Node] with ScalaVersionSpecificNodeSeq with Equality with ScalaVersionSpecificIterableSerializable[Node] with Serializable { def theSeq: Seq[Node] def length = theSeq.length override def iterator = theSeq.iterator @@ -158,6 +158,4 @@ abstract class NodeSeq extends AbstractSeq[Node] with immutable.Seq[Node] with S override def toString(): String = theSeq.mkString def text: String = (this map (_.text)).mkString - - protected[this] override def writeReplace(): AnyRef = this } From 270e9cdd92c4cec5187aa997ac60437dbcb3b664 Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Fri, 26 Oct 2018 15:46:58 -0400 Subject: [PATCH 273/789] Update Scala.js to 1.0.0-M6 --- .travis.yml | 6 +++--- build.sbt | 2 +- project/plugins.sbt | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index cca72f2e8..846fc9c0f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -30,16 +30,16 @@ env: # The empty SCALAJS_VERSION will only compile for the JVM - SCALAJS_VERSION= - SCALAJS_VERSION=0.6.25 - - SCALAJS_VERSION=1.0.0-M5 + - SCALAJS_VERSION=1.0.0-M6 matrix: exclude: - jdk: openjdk11 env: SCALAJS_VERSION=0.6.25 - jdk: openjdk11 - env: SCALAJS_VERSION=1.0.0-M5 + env: SCALAJS_VERSION=1.0.0-M6 - scala: 2.11.12 - env: SCALAJS_VERSION=1.0.0-M5 + env: SCALAJS_VERSION=1.0.0-M6 - scala: 2.11.12 jdk: oraclejdk8 - scala: 2.11.12 diff --git a/build.sbt b/build.sbt index e851ea0f3..c6d583fe3 100644 --- a/build.sbt +++ b/build.sbt @@ -19,7 +19,7 @@ lazy val xml = crossProject(JSPlatform, JVMPlatform) scalacOptions in Test += "-Xxml:coalescing", mimaPreviousVersion := { - if (System.getenv("SCALAJS_VERSION") == "1.0.0-M5") None // No such release yet + if (System.getenv("SCALAJS_VERSION") == "1.0.0-M6") None // No such release yet else Some("1.1.1") }, diff --git a/project/plugins.sbt b/project/plugins.sbt index 62ba94c51..f166d63cc 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -9,5 +9,5 @@ val scalaJSVersion = Option(System.getenv("SCALAJS_VERSION")).filter(_.nonEmpty).getOrElse("0.6.25") addSbtPlugin("org.scala-js" % "sbt-scalajs" % scalaJSVersion) -addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "0.5.0") +addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "0.6.0") addSbtPlugin("org.scala-lang.modules" % "sbt-scala-module" % "1.0.14") From 7b040e3f4fcf67e4ffb4fc35b8149faa8764d28c Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Wed, 23 Jan 2019 22:09:12 -0500 Subject: [PATCH 274/789] Fix openjdk6 on Travis --- .travis.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index 846fc9c0f..006483a85 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,12 +1,12 @@ language: scala -addons: - apt: - packages: - - openjdk-6-jdk - # Needed for openjdk6 +dist: precise sudo: required +addons: + hosts: + - localhost + hostname: localhost.local jdk: - openjdk6 From 9b866e95b687103d1a65beeeb8a32593598df62d Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Fri, 25 Jan 2019 10:23:43 -0500 Subject: [PATCH 275/789] Set node.js version in Travis --- .travis.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.travis.yml b/.travis.yml index 006483a85..09afc8fab 100644 --- a/.travis.yml +++ b/.travis.yml @@ -49,10 +49,15 @@ matrix: - scala: 2.13.0-M5 jdk: openjdk6 +before_script: + - nvm install 8 + - nvm use 8 + script: # work around https://github.com/travis-ci/travis-ci/issues/9713 - if [[ $JAVA_HOME = *java-6* ]]; then jdk_switcher use openjdk6; fi - java -version + - node -v - admin/build.sh before_cache: From 4940c55c9ffb43b19706580595a126d74fe9b6a0 Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Fri, 25 Jan 2019 15:39:18 -0500 Subject: [PATCH 276/789] Update to Scala 2.12.8 --- .travis.yml | 4 ++-- build.sbt | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 09afc8fab..db12e9710 100644 --- a/.travis.yml +++ b/.travis.yml @@ -15,7 +15,7 @@ jdk: scala: - 2.11.12 - - 2.12.6 + - 2.12.8 - 2.13.0-M5 env: @@ -44,7 +44,7 @@ matrix: jdk: oraclejdk8 - scala: 2.11.12 jdk: openjdk11 - - scala: 2.12.6 + - scala: 2.12.8 jdk: openjdk6 - scala: 2.13.0-M5 jdk: openjdk6 diff --git a/build.sbt b/build.sbt index c6d583fe3..1b1e7b946 100644 --- a/build.sbt +++ b/build.sbt @@ -1,7 +1,7 @@ import sbtcrossproject.{crossProject, CrossType} import ScalaModulePlugin._ -crossScalaVersions in ThisBuild := List("2.12.6", "2.11.12", "2.13.0-M5") +crossScalaVersions in ThisBuild := List("2.12.8", "2.11.12", "2.13.0-M5") lazy val xml = crossProject(JSPlatform, JVMPlatform) .withoutSuffixFor(JVMPlatform) From 3723447b65155c09ea7ce33762e48fde387625b9 Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Sat, 26 Jan 2019 09:43:16 -0500 Subject: [PATCH 277/789] Update copyright 2019 --- shared/src/main/scala/scala/xml/Atom.scala | 2 +- shared/src/main/scala/scala/xml/Attribute.scala | 2 +- shared/src/main/scala/scala/xml/Comment.scala | 2 +- shared/src/main/scala/scala/xml/Document.scala | 2 +- shared/src/main/scala/scala/xml/Elem.scala | 2 +- shared/src/main/scala/scala/xml/EntityRef.scala | 2 +- shared/src/main/scala/scala/xml/Equality.scala | 2 +- shared/src/main/scala/scala/xml/Group.scala | 2 +- .../src/main/scala/scala/xml/MalformedAttributeException.scala | 2 +- shared/src/main/scala/scala/xml/MetaData.scala | 2 +- shared/src/main/scala/scala/xml/NamespaceBinding.scala | 2 +- shared/src/main/scala/scala/xml/Node.scala | 2 +- shared/src/main/scala/scala/xml/NodeBuffer.scala | 2 +- shared/src/main/scala/scala/xml/NodeSeq.scala | 2 +- shared/src/main/scala/scala/xml/Null.scala | 2 +- shared/src/main/scala/scala/xml/PCData.scala | 2 +- shared/src/main/scala/scala/xml/PrefixedAttribute.scala | 2 +- shared/src/main/scala/scala/xml/PrettyPrinter.scala | 2 +- shared/src/main/scala/scala/xml/ProcInstr.scala | 2 +- shared/src/main/scala/scala/xml/QNode.scala | 2 +- shared/src/main/scala/scala/xml/SpecialNode.scala | 2 +- shared/src/main/scala/scala/xml/Text.scala | 2 +- shared/src/main/scala/scala/xml/TextBuffer.scala | 2 +- shared/src/main/scala/scala/xml/TopScope.scala | 2 +- shared/src/main/scala/scala/xml/TypeSymbol.scala | 2 +- shared/src/main/scala/scala/xml/Unparsed.scala | 2 +- shared/src/main/scala/scala/xml/UnprefixedAttribute.scala | 2 +- shared/src/main/scala/scala/xml/Utility.scala | 2 +- shared/src/main/scala/scala/xml/XML.scala | 2 +- shared/src/main/scala/scala/xml/Xhtml.scala | 2 +- shared/src/main/scala/scala/xml/dtd/ContentModel.scala | 2 +- shared/src/main/scala/scala/xml/dtd/ContentModelParser.scala | 2 +- shared/src/main/scala/scala/xml/dtd/DTD.scala | 2 +- shared/src/main/scala/scala/xml/dtd/Decl.scala | 2 +- shared/src/main/scala/scala/xml/dtd/DocType.scala | 2 +- shared/src/main/scala/scala/xml/dtd/ElementValidator.scala | 2 +- shared/src/main/scala/scala/xml/dtd/ExternalID.scala | 2 +- shared/src/main/scala/scala/xml/dtd/Scanner.scala | 2 +- shared/src/main/scala/scala/xml/dtd/Tokens.scala | 2 +- shared/src/main/scala/scala/xml/dtd/ValidationException.scala | 2 +- shared/src/main/scala/scala/xml/dtd/impl/Base.scala | 2 +- shared/src/main/scala/scala/xml/dtd/impl/BaseBerrySethi.scala | 2 +- shared/src/main/scala/scala/xml/dtd/impl/DetWordAutom.scala | 2 +- shared/src/main/scala/scala/xml/dtd/impl/Inclusion.scala | 2 +- shared/src/main/scala/scala/xml/dtd/impl/NondetWordAutom.scala | 2 +- shared/src/main/scala/scala/xml/dtd/impl/PointedHedgeExp.scala | 2 +- .../src/main/scala/scala/xml/dtd/impl/SubsetConstruction.scala | 2 +- shared/src/main/scala/scala/xml/dtd/impl/SyntaxError.scala | 2 +- shared/src/main/scala/scala/xml/dtd/impl/WordBerrySethi.scala | 2 +- shared/src/main/scala/scala/xml/dtd/impl/WordExp.scala | 2 +- shared/src/main/scala/scala/xml/factory/Binder.scala | 2 +- shared/src/main/scala/scala/xml/factory/LoggedNodeFactory.scala | 2 +- shared/src/main/scala/scala/xml/factory/NodeFactory.scala | 2 +- shared/src/main/scala/scala/xml/factory/XMLLoader.scala | 2 +- .../main/scala/scala/xml/include/CircularIncludeException.scala | 2 +- .../scala/scala/xml/include/UnavailableResourceException.scala | 2 +- shared/src/main/scala/scala/xml/include/XIncludeException.scala | 2 +- .../main/scala/scala/xml/include/sax/EncodingHeuristics.scala | 2 +- .../src/main/scala/scala/xml/include/sax/XIncludeFilter.scala | 2 +- shared/src/main/scala/scala/xml/include/sax/XIncluder.scala | 2 +- shared/src/main/scala/scala/xml/package.scala | 2 +- .../src/main/scala/scala/xml/parsing/ConstructingHandler.scala | 2 +- .../src/main/scala/scala/xml/parsing/ConstructingParser.scala | 2 +- .../src/main/scala/scala/xml/parsing/DefaultMarkupHandler.scala | 2 +- shared/src/main/scala/scala/xml/parsing/ExternalSources.scala | 2 +- shared/src/main/scala/scala/xml/parsing/FactoryAdapter.scala | 2 +- shared/src/main/scala/scala/xml/parsing/FatalError.scala | 2 +- shared/src/main/scala/scala/xml/parsing/MarkupHandler.scala | 2 +- shared/src/main/scala/scala/xml/parsing/MarkupParser.scala | 2 +- .../src/main/scala/scala/xml/parsing/MarkupParserCommon.scala | 2 +- .../main/scala/scala/xml/parsing/NoBindingFactoryAdapter.scala | 2 +- shared/src/main/scala/scala/xml/parsing/TokenTests.scala | 2 +- .../main/scala/scala/xml/parsing/ValidatingMarkupHandler.scala | 2 +- shared/src/main/scala/scala/xml/parsing/XhtmlEntities.scala | 2 +- shared/src/main/scala/scala/xml/parsing/XhtmlParser.scala | 2 +- .../src/main/scala/scala/xml/persistent/CachedFileStorage.scala | 2 +- shared/src/main/scala/scala/xml/persistent/Index.scala | 2 +- shared/src/main/scala/scala/xml/persistent/SetStorage.scala | 2 +- shared/src/main/scala/scala/xml/pull/XMLEvent.scala | 2 +- shared/src/main/scala/scala/xml/pull/XMLEventReader.scala | 2 +- shared/src/main/scala/scala/xml/pull/package.scala | 2 +- .../src/main/scala/scala/xml/transform/BasicTransformer.scala | 2 +- shared/src/main/scala/scala/xml/transform/RewriteRule.scala | 2 +- shared/src/main/scala/scala/xml/transform/RuleTransformer.scala | 2 +- 84 files changed, 84 insertions(+), 84 deletions(-) diff --git a/shared/src/main/scala/scala/xml/Atom.scala b/shared/src/main/scala/scala/xml/Atom.scala index 311157147..bc82e5343 100644 --- a/shared/src/main/scala/scala/xml/Atom.scala +++ b/shared/src/main/scala/scala/xml/Atom.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2018, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2003-2019, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/Attribute.scala b/shared/src/main/scala/scala/xml/Attribute.scala index 4423ad9ab..968b2c5f9 100644 --- a/shared/src/main/scala/scala/xml/Attribute.scala +++ b/shared/src/main/scala/scala/xml/Attribute.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2018, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2003-2019, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/Comment.scala b/shared/src/main/scala/scala/xml/Comment.scala index 24f7c1d99..9fbd5a679 100644 --- a/shared/src/main/scala/scala/xml/Comment.scala +++ b/shared/src/main/scala/scala/xml/Comment.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2018, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2003-2019, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/Document.scala b/shared/src/main/scala/scala/xml/Document.scala index 6213e0e40..f36b28658 100644 --- a/shared/src/main/scala/scala/xml/Document.scala +++ b/shared/src/main/scala/scala/xml/Document.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2018, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2003-2019, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/Elem.scala b/shared/src/main/scala/scala/xml/Elem.scala index 288133e4c..f641ff7bd 100755 --- a/shared/src/main/scala/scala/xml/Elem.scala +++ b/shared/src/main/scala/scala/xml/Elem.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2002-2018, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2002-2019, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/EntityRef.scala b/shared/src/main/scala/scala/xml/EntityRef.scala index 06d855460..a3208c320 100644 --- a/shared/src/main/scala/scala/xml/EntityRef.scala +++ b/shared/src/main/scala/scala/xml/EntityRef.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2018, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2003-2019, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/Equality.scala b/shared/src/main/scala/scala/xml/Equality.scala index 9f22fc2fb..f148df2e9 100644 --- a/shared/src/main/scala/scala/xml/Equality.scala +++ b/shared/src/main/scala/scala/xml/Equality.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2018, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2003-2019, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/Group.scala b/shared/src/main/scala/scala/xml/Group.scala index dc4c19960..34921a3d4 100644 --- a/shared/src/main/scala/scala/xml/Group.scala +++ b/shared/src/main/scala/scala/xml/Group.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2018, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2003-2019, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/MalformedAttributeException.scala b/shared/src/main/scala/scala/xml/MalformedAttributeException.scala index 3609639b2..d0332a3d9 100644 --- a/shared/src/main/scala/scala/xml/MalformedAttributeException.scala +++ b/shared/src/main/scala/scala/xml/MalformedAttributeException.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2018, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2003-2019, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/MetaData.scala b/shared/src/main/scala/scala/xml/MetaData.scala index f930a7fb8..fbea65cd3 100644 --- a/shared/src/main/scala/scala/xml/MetaData.scala +++ b/shared/src/main/scala/scala/xml/MetaData.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2018, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2003-2019, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/NamespaceBinding.scala b/shared/src/main/scala/scala/xml/NamespaceBinding.scala index e8ad08f77..c67c35bf9 100644 --- a/shared/src/main/scala/scala/xml/NamespaceBinding.scala +++ b/shared/src/main/scala/scala/xml/NamespaceBinding.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2002-2018, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2002-2019, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/Node.scala b/shared/src/main/scala/scala/xml/Node.scala index 907dd4bb8..b4b038bac 100755 --- a/shared/src/main/scala/scala/xml/Node.scala +++ b/shared/src/main/scala/scala/xml/Node.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2018, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2003-2019, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/NodeBuffer.scala b/shared/src/main/scala/scala/xml/NodeBuffer.scala index 2b0a0c851..7c82eef11 100644 --- a/shared/src/main/scala/scala/xml/NodeBuffer.scala +++ b/shared/src/main/scala/scala/xml/NodeBuffer.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2018, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2003-2019, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/NodeSeq.scala b/shared/src/main/scala/scala/xml/NodeSeq.scala index 94f7535d8..07e6fe87d 100644 --- a/shared/src/main/scala/scala/xml/NodeSeq.scala +++ b/shared/src/main/scala/scala/xml/NodeSeq.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2018, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2003-2019, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/Null.scala b/shared/src/main/scala/scala/xml/Null.scala index 6e438a53b..4f06b1a4f 100644 --- a/shared/src/main/scala/scala/xml/Null.scala +++ b/shared/src/main/scala/scala/xml/Null.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2018, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2003-2019, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/PCData.scala b/shared/src/main/scala/scala/xml/PCData.scala index 1df109e25..0b1c985e7 100644 --- a/shared/src/main/scala/scala/xml/PCData.scala +++ b/shared/src/main/scala/scala/xml/PCData.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2018, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2003-2019, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/PrefixedAttribute.scala b/shared/src/main/scala/scala/xml/PrefixedAttribute.scala index b1408d287..0e7240c04 100644 --- a/shared/src/main/scala/scala/xml/PrefixedAttribute.scala +++ b/shared/src/main/scala/scala/xml/PrefixedAttribute.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2018, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2003-2019, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/PrettyPrinter.scala b/shared/src/main/scala/scala/xml/PrettyPrinter.scala index 01545d61a..3831bd3bb 100755 --- a/shared/src/main/scala/scala/xml/PrettyPrinter.scala +++ b/shared/src/main/scala/scala/xml/PrettyPrinter.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2018, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2003-2019, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/ProcInstr.scala b/shared/src/main/scala/scala/xml/ProcInstr.scala index f7511966f..48f247120 100644 --- a/shared/src/main/scala/scala/xml/ProcInstr.scala +++ b/shared/src/main/scala/scala/xml/ProcInstr.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2018, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2003-2019, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/QNode.scala b/shared/src/main/scala/scala/xml/QNode.scala index 5e5d052fa..24c093b2d 100644 --- a/shared/src/main/scala/scala/xml/QNode.scala +++ b/shared/src/main/scala/scala/xml/QNode.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2018, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2003-2019, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/SpecialNode.scala b/shared/src/main/scala/scala/xml/SpecialNode.scala index 5b88e8564..0c2d90335 100644 --- a/shared/src/main/scala/scala/xml/SpecialNode.scala +++ b/shared/src/main/scala/scala/xml/SpecialNode.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2018, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2003-2019, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/Text.scala b/shared/src/main/scala/scala/xml/Text.scala index 7f3debc53..8e2ee498f 100644 --- a/shared/src/main/scala/scala/xml/Text.scala +++ b/shared/src/main/scala/scala/xml/Text.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2018, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2003-2019, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/TextBuffer.scala b/shared/src/main/scala/scala/xml/TextBuffer.scala index 8ab2a53e4..6f10b8c13 100644 --- a/shared/src/main/scala/scala/xml/TextBuffer.scala +++ b/shared/src/main/scala/scala/xml/TextBuffer.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2018, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2003-2019, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/TopScope.scala b/shared/src/main/scala/scala/xml/TopScope.scala index 64da11b23..605ec87cd 100644 --- a/shared/src/main/scala/scala/xml/TopScope.scala +++ b/shared/src/main/scala/scala/xml/TopScope.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2002-2018, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2002-2019, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/TypeSymbol.scala b/shared/src/main/scala/scala/xml/TypeSymbol.scala index 4e9b0ff0e..8d6989716 100644 --- a/shared/src/main/scala/scala/xml/TypeSymbol.scala +++ b/shared/src/main/scala/scala/xml/TypeSymbol.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2002-2018, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2002-2019, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/Unparsed.scala b/shared/src/main/scala/scala/xml/Unparsed.scala index 4b1ae2db8..da8e2dada 100644 --- a/shared/src/main/scala/scala/xml/Unparsed.scala +++ b/shared/src/main/scala/scala/xml/Unparsed.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2018, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2003-2019, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/UnprefixedAttribute.scala b/shared/src/main/scala/scala/xml/UnprefixedAttribute.scala index d7ead87dc..dcdaf374e 100644 --- a/shared/src/main/scala/scala/xml/UnprefixedAttribute.scala +++ b/shared/src/main/scala/scala/xml/UnprefixedAttribute.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2002-2018, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2002-2019, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/Utility.scala b/shared/src/main/scala/scala/xml/Utility.scala index bd974b3e7..9374ff990 100755 --- a/shared/src/main/scala/scala/xml/Utility.scala +++ b/shared/src/main/scala/scala/xml/Utility.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2018, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2003-2019, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/XML.scala b/shared/src/main/scala/scala/xml/XML.scala index 0b99ca816..90bebc93c 100755 --- a/shared/src/main/scala/scala/xml/XML.scala +++ b/shared/src/main/scala/scala/xml/XML.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2018, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2003-2019, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/Xhtml.scala b/shared/src/main/scala/scala/xml/Xhtml.scala index 8d4ab2698..5828212df 100644 --- a/shared/src/main/scala/scala/xml/Xhtml.scala +++ b/shared/src/main/scala/scala/xml/Xhtml.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2018, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2003-2019, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/dtd/ContentModel.scala b/shared/src/main/scala/scala/xml/dtd/ContentModel.scala index a36674d61..4ef9fec55 100644 --- a/shared/src/main/scala/scala/xml/dtd/ContentModel.scala +++ b/shared/src/main/scala/scala/xml/dtd/ContentModel.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2002-2018, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2002-2019, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/dtd/ContentModelParser.scala b/shared/src/main/scala/scala/xml/dtd/ContentModelParser.scala index cd0b03cbe..c69dca9f2 100644 --- a/shared/src/main/scala/scala/xml/dtd/ContentModelParser.scala +++ b/shared/src/main/scala/scala/xml/dtd/ContentModelParser.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2002-2018, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2002-2019, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://www.scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/dtd/DTD.scala b/shared/src/main/scala/scala/xml/dtd/DTD.scala index f01fe5a0a..94a772228 100644 --- a/shared/src/main/scala/scala/xml/dtd/DTD.scala +++ b/shared/src/main/scala/scala/xml/dtd/DTD.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2002-2018, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2002-2019, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/dtd/Decl.scala b/shared/src/main/scala/scala/xml/dtd/Decl.scala index 1d5994a50..9ac9761ea 100644 --- a/shared/src/main/scala/scala/xml/dtd/Decl.scala +++ b/shared/src/main/scala/scala/xml/dtd/Decl.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2018, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2003-2019, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://www.scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/dtd/DocType.scala b/shared/src/main/scala/scala/xml/dtd/DocType.scala index 4bc78b1a2..b22ef3258 100644 --- a/shared/src/main/scala/scala/xml/dtd/DocType.scala +++ b/shared/src/main/scala/scala/xml/dtd/DocType.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2018, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2003-2019, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/dtd/ElementValidator.scala b/shared/src/main/scala/scala/xml/dtd/ElementValidator.scala index c30c2af17..45618f06c 100644 --- a/shared/src/main/scala/scala/xml/dtd/ElementValidator.scala +++ b/shared/src/main/scala/scala/xml/dtd/ElementValidator.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2002-2018, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2002-2019, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://www.scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/dtd/ExternalID.scala b/shared/src/main/scala/scala/xml/dtd/ExternalID.scala index 3b8ef63f6..1d546ca97 100644 --- a/shared/src/main/scala/scala/xml/dtd/ExternalID.scala +++ b/shared/src/main/scala/scala/xml/dtd/ExternalID.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2018, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2003-2019, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://www.scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/dtd/Scanner.scala b/shared/src/main/scala/scala/xml/dtd/Scanner.scala index 425f3cd7f..cb042d5a9 100644 --- a/shared/src/main/scala/scala/xml/dtd/Scanner.scala +++ b/shared/src/main/scala/scala/xml/dtd/Scanner.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2002-2018, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2002-2019, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/dtd/Tokens.scala b/shared/src/main/scala/scala/xml/dtd/Tokens.scala index b2ff19f42..c5f112dd6 100644 --- a/shared/src/main/scala/scala/xml/dtd/Tokens.scala +++ b/shared/src/main/scala/scala/xml/dtd/Tokens.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2002-2018, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2002-2019, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://www.scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/dtd/ValidationException.scala b/shared/src/main/scala/scala/xml/dtd/ValidationException.scala index a79aea75b..9731099d0 100644 --- a/shared/src/main/scala/scala/xml/dtd/ValidationException.scala +++ b/shared/src/main/scala/scala/xml/dtd/ValidationException.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2002-2018, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2002-2019, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://www.scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/dtd/impl/Base.scala b/shared/src/main/scala/scala/xml/dtd/impl/Base.scala index 13c19911f..3283e2ba0 100644 --- a/shared/src/main/scala/scala/xml/dtd/impl/Base.scala +++ b/shared/src/main/scala/scala/xml/dtd/impl/Base.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2018, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2003-2019, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/dtd/impl/BaseBerrySethi.scala b/shared/src/main/scala/scala/xml/dtd/impl/BaseBerrySethi.scala index 869ed9ae4..3f04e6d1e 100644 --- a/shared/src/main/scala/scala/xml/dtd/impl/BaseBerrySethi.scala +++ b/shared/src/main/scala/scala/xml/dtd/impl/BaseBerrySethi.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2018, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2003-2019, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/dtd/impl/DetWordAutom.scala b/shared/src/main/scala/scala/xml/dtd/impl/DetWordAutom.scala index dcd026fe6..e44285c81 100644 --- a/shared/src/main/scala/scala/xml/dtd/impl/DetWordAutom.scala +++ b/shared/src/main/scala/scala/xml/dtd/impl/DetWordAutom.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2018, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2003-2019, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/dtd/impl/Inclusion.scala b/shared/src/main/scala/scala/xml/dtd/impl/Inclusion.scala index 709c2c530..278d966e4 100644 --- a/shared/src/main/scala/scala/xml/dtd/impl/Inclusion.scala +++ b/shared/src/main/scala/scala/xml/dtd/impl/Inclusion.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2018, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2003-2019, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/dtd/impl/NondetWordAutom.scala b/shared/src/main/scala/scala/xml/dtd/impl/NondetWordAutom.scala index 91fdf86c0..5519fd7ef 100644 --- a/shared/src/main/scala/scala/xml/dtd/impl/NondetWordAutom.scala +++ b/shared/src/main/scala/scala/xml/dtd/impl/NondetWordAutom.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2018, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2003-2019, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/dtd/impl/PointedHedgeExp.scala b/shared/src/main/scala/scala/xml/dtd/impl/PointedHedgeExp.scala index c6560ac07..9c4263ab3 100644 --- a/shared/src/main/scala/scala/xml/dtd/impl/PointedHedgeExp.scala +++ b/shared/src/main/scala/scala/xml/dtd/impl/PointedHedgeExp.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2018, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2003-2019, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/dtd/impl/SubsetConstruction.scala b/shared/src/main/scala/scala/xml/dtd/impl/SubsetConstruction.scala index 2dddfdcec..2bc2c97b1 100644 --- a/shared/src/main/scala/scala/xml/dtd/impl/SubsetConstruction.scala +++ b/shared/src/main/scala/scala/xml/dtd/impl/SubsetConstruction.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2018, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2003-2019, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/dtd/impl/SyntaxError.scala b/shared/src/main/scala/scala/xml/dtd/impl/SyntaxError.scala index 10c41dddb..f0c992854 100644 --- a/shared/src/main/scala/scala/xml/dtd/impl/SyntaxError.scala +++ b/shared/src/main/scala/scala/xml/dtd/impl/SyntaxError.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2018, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2003-2019, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/dtd/impl/WordBerrySethi.scala b/shared/src/main/scala/scala/xml/dtd/impl/WordBerrySethi.scala index 3f0ef361f..2fef5b9a8 100644 --- a/shared/src/main/scala/scala/xml/dtd/impl/WordBerrySethi.scala +++ b/shared/src/main/scala/scala/xml/dtd/impl/WordBerrySethi.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2018, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2003-2019, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/dtd/impl/WordExp.scala b/shared/src/main/scala/scala/xml/dtd/impl/WordExp.scala index e30fe1164..6d132a04a 100644 --- a/shared/src/main/scala/scala/xml/dtd/impl/WordExp.scala +++ b/shared/src/main/scala/scala/xml/dtd/impl/WordExp.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2018, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2003-2019, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/factory/Binder.scala b/shared/src/main/scala/scala/xml/factory/Binder.scala index 3453a6253..3c1b595ac 100755 --- a/shared/src/main/scala/scala/xml/factory/Binder.scala +++ b/shared/src/main/scala/scala/xml/factory/Binder.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2002-2018, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2002-2019, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/factory/LoggedNodeFactory.scala b/shared/src/main/scala/scala/xml/factory/LoggedNodeFactory.scala index afe3c15ec..5b18dda50 100644 --- a/shared/src/main/scala/scala/xml/factory/LoggedNodeFactory.scala +++ b/shared/src/main/scala/scala/xml/factory/LoggedNodeFactory.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2002-2018, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2002-2019, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/factory/NodeFactory.scala b/shared/src/main/scala/scala/xml/factory/NodeFactory.scala index d03961a8f..9dc78af5c 100644 --- a/shared/src/main/scala/scala/xml/factory/NodeFactory.scala +++ b/shared/src/main/scala/scala/xml/factory/NodeFactory.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2018, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2003-2019, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/factory/XMLLoader.scala b/shared/src/main/scala/scala/xml/factory/XMLLoader.scala index 4bddd2df6..b84f42af4 100644 --- a/shared/src/main/scala/scala/xml/factory/XMLLoader.scala +++ b/shared/src/main/scala/scala/xml/factory/XMLLoader.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2018, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2003-2019, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/include/CircularIncludeException.scala b/shared/src/main/scala/scala/xml/include/CircularIncludeException.scala index cdc73f39c..15688658e 100644 --- a/shared/src/main/scala/scala/xml/include/CircularIncludeException.scala +++ b/shared/src/main/scala/scala/xml/include/CircularIncludeException.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2002-2018, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2002-2019, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/include/UnavailableResourceException.scala b/shared/src/main/scala/scala/xml/include/UnavailableResourceException.scala index db2ee7f5d..5dcf68191 100644 --- a/shared/src/main/scala/scala/xml/include/UnavailableResourceException.scala +++ b/shared/src/main/scala/scala/xml/include/UnavailableResourceException.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2002-2018, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2002-2019, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/include/XIncludeException.scala b/shared/src/main/scala/scala/xml/include/XIncludeException.scala index 4b684ffef..f3bc67794 100644 --- a/shared/src/main/scala/scala/xml/include/XIncludeException.scala +++ b/shared/src/main/scala/scala/xml/include/XIncludeException.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2002-2018, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2002-2019, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/include/sax/EncodingHeuristics.scala b/shared/src/main/scala/scala/xml/include/sax/EncodingHeuristics.scala index 220d0cbf5..3246ff52b 100644 --- a/shared/src/main/scala/scala/xml/include/sax/EncodingHeuristics.scala +++ b/shared/src/main/scala/scala/xml/include/sax/EncodingHeuristics.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2002-2018, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2002-2019, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/include/sax/XIncludeFilter.scala b/shared/src/main/scala/scala/xml/include/sax/XIncludeFilter.scala index 770d1025b..4923cb1da 100644 --- a/shared/src/main/scala/scala/xml/include/sax/XIncludeFilter.scala +++ b/shared/src/main/scala/scala/xml/include/sax/XIncludeFilter.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2002-2018, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2002-2019, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/include/sax/XIncluder.scala b/shared/src/main/scala/scala/xml/include/sax/XIncluder.scala index dfc9408ba..2f6284a6c 100644 --- a/shared/src/main/scala/scala/xml/include/sax/XIncluder.scala +++ b/shared/src/main/scala/scala/xml/include/sax/XIncluder.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2002-2018, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2002-2019, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/package.scala b/shared/src/main/scala/scala/xml/package.scala index 8d28c2989..dff58146d 100644 --- a/shared/src/main/scala/scala/xml/package.scala +++ b/shared/src/main/scala/scala/xml/package.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2018, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2003-2019, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/parsing/ConstructingHandler.scala b/shared/src/main/scala/scala/xml/parsing/ConstructingHandler.scala index 5fa7905fd..e1d858f46 100755 --- a/shared/src/main/scala/scala/xml/parsing/ConstructingHandler.scala +++ b/shared/src/main/scala/scala/xml/parsing/ConstructingHandler.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2002-2018, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2002-2019, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/parsing/ConstructingParser.scala b/shared/src/main/scala/scala/xml/parsing/ConstructingParser.scala index 59fc3986d..b6c4aa258 100644 --- a/shared/src/main/scala/scala/xml/parsing/ConstructingParser.scala +++ b/shared/src/main/scala/scala/xml/parsing/ConstructingParser.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2018, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2003-2019, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/parsing/DefaultMarkupHandler.scala b/shared/src/main/scala/scala/xml/parsing/DefaultMarkupHandler.scala index 3f866510b..b8deb75ab 100755 --- a/shared/src/main/scala/scala/xml/parsing/DefaultMarkupHandler.scala +++ b/shared/src/main/scala/scala/xml/parsing/DefaultMarkupHandler.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2002-2018, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2002-2019, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/parsing/ExternalSources.scala b/shared/src/main/scala/scala/xml/parsing/ExternalSources.scala index fe7983a87..da6e9f1d0 100644 --- a/shared/src/main/scala/scala/xml/parsing/ExternalSources.scala +++ b/shared/src/main/scala/scala/xml/parsing/ExternalSources.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2018, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2003-2019, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/parsing/FactoryAdapter.scala b/shared/src/main/scala/scala/xml/parsing/FactoryAdapter.scala index d181621dd..cbacb0492 100644 --- a/shared/src/main/scala/scala/xml/parsing/FactoryAdapter.scala +++ b/shared/src/main/scala/scala/xml/parsing/FactoryAdapter.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2018, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2003-2019, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/parsing/FatalError.scala b/shared/src/main/scala/scala/xml/parsing/FatalError.scala index f913ec53d..dbce6f686 100644 --- a/shared/src/main/scala/scala/xml/parsing/FatalError.scala +++ b/shared/src/main/scala/scala/xml/parsing/FatalError.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2002-2018, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2002-2019, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/parsing/MarkupHandler.scala b/shared/src/main/scala/scala/xml/parsing/MarkupHandler.scala index d0d8abb1d..685e36451 100755 --- a/shared/src/main/scala/scala/xml/parsing/MarkupHandler.scala +++ b/shared/src/main/scala/scala/xml/parsing/MarkupHandler.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2018, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2003-2019, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/parsing/MarkupParser.scala b/shared/src/main/scala/scala/xml/parsing/MarkupParser.scala index 880d9bd7b..3ddc626b2 100755 --- a/shared/src/main/scala/scala/xml/parsing/MarkupParser.scala +++ b/shared/src/main/scala/scala/xml/parsing/MarkupParser.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2018, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2003-2019, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/parsing/MarkupParserCommon.scala b/shared/src/main/scala/scala/xml/parsing/MarkupParserCommon.scala index 00d94a4fe..caf165dfd 100644 --- a/shared/src/main/scala/scala/xml/parsing/MarkupParserCommon.scala +++ b/shared/src/main/scala/scala/xml/parsing/MarkupParserCommon.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2018, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2003-2019, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/parsing/NoBindingFactoryAdapter.scala b/shared/src/main/scala/scala/xml/parsing/NoBindingFactoryAdapter.scala index 3e1d83a40..a0ac87fda 100644 --- a/shared/src/main/scala/scala/xml/parsing/NoBindingFactoryAdapter.scala +++ b/shared/src/main/scala/scala/xml/parsing/NoBindingFactoryAdapter.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2018, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2003-2019, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/parsing/TokenTests.scala b/shared/src/main/scala/scala/xml/parsing/TokenTests.scala index 3db0ece88..e842cf48f 100644 --- a/shared/src/main/scala/scala/xml/parsing/TokenTests.scala +++ b/shared/src/main/scala/scala/xml/parsing/TokenTests.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2018, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2003-2019, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/parsing/ValidatingMarkupHandler.scala b/shared/src/main/scala/scala/xml/parsing/ValidatingMarkupHandler.scala index fb1058284..a1821bd95 100644 --- a/shared/src/main/scala/scala/xml/parsing/ValidatingMarkupHandler.scala +++ b/shared/src/main/scala/scala/xml/parsing/ValidatingMarkupHandler.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2002-2018, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2002-2019, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/parsing/XhtmlEntities.scala b/shared/src/main/scala/scala/xml/parsing/XhtmlEntities.scala index 3b35e2bce..e5e381afe 100644 --- a/shared/src/main/scala/scala/xml/parsing/XhtmlEntities.scala +++ b/shared/src/main/scala/scala/xml/parsing/XhtmlEntities.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2018, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2003-2019, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/parsing/XhtmlParser.scala b/shared/src/main/scala/scala/xml/parsing/XhtmlParser.scala index 9655e7553..4bd44b9c8 100644 --- a/shared/src/main/scala/scala/xml/parsing/XhtmlParser.scala +++ b/shared/src/main/scala/scala/xml/parsing/XhtmlParser.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2018, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2003-2019, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/persistent/CachedFileStorage.scala b/shared/src/main/scala/scala/xml/persistent/CachedFileStorage.scala index 0b73acd8b..1a932cc34 100644 --- a/shared/src/main/scala/scala/xml/persistent/CachedFileStorage.scala +++ b/shared/src/main/scala/scala/xml/persistent/CachedFileStorage.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2002-2018, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2002-2019, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/persistent/Index.scala b/shared/src/main/scala/scala/xml/persistent/Index.scala index 0c22ddd36..249e0b765 100644 --- a/shared/src/main/scala/scala/xml/persistent/Index.scala +++ b/shared/src/main/scala/scala/xml/persistent/Index.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2002-2018, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2002-2019, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/persistent/SetStorage.scala b/shared/src/main/scala/scala/xml/persistent/SetStorage.scala index a138df0e2..abe44be53 100644 --- a/shared/src/main/scala/scala/xml/persistent/SetStorage.scala +++ b/shared/src/main/scala/scala/xml/persistent/SetStorage.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2002-2018, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2002-2019, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/pull/XMLEvent.scala b/shared/src/main/scala/scala/xml/pull/XMLEvent.scala index 7d8cd4eb9..736d99e5a 100644 --- a/shared/src/main/scala/scala/xml/pull/XMLEvent.scala +++ b/shared/src/main/scala/scala/xml/pull/XMLEvent.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2018, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2003-2019, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/pull/XMLEventReader.scala b/shared/src/main/scala/scala/xml/pull/XMLEventReader.scala index fee9060b2..338b7b28a 100755 --- a/shared/src/main/scala/scala/xml/pull/XMLEventReader.scala +++ b/shared/src/main/scala/scala/xml/pull/XMLEventReader.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2018, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2003-2019, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/pull/package.scala b/shared/src/main/scala/scala/xml/pull/package.scala index cd50823df..38f23ef96 100644 --- a/shared/src/main/scala/scala/xml/pull/package.scala +++ b/shared/src/main/scala/scala/xml/pull/package.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2018, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2003-2019, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/transform/BasicTransformer.scala b/shared/src/main/scala/scala/xml/transform/BasicTransformer.scala index 7d659d5f4..02e333d7c 100644 --- a/shared/src/main/scala/scala/xml/transform/BasicTransformer.scala +++ b/shared/src/main/scala/scala/xml/transform/BasicTransformer.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2002-2018, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2002-2019, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/transform/RewriteRule.scala b/shared/src/main/scala/scala/xml/transform/RewriteRule.scala index b9374e7e5..dd0d8895b 100644 --- a/shared/src/main/scala/scala/xml/transform/RewriteRule.scala +++ b/shared/src/main/scala/scala/xml/transform/RewriteRule.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2002-2018, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2002-2019, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/shared/src/main/scala/scala/xml/transform/RuleTransformer.scala b/shared/src/main/scala/scala/xml/transform/RuleTransformer.scala index 1b71071cb..fa8a1a08e 100644 --- a/shared/src/main/scala/scala/xml/transform/RuleTransformer.scala +++ b/shared/src/main/scala/scala/xml/transform/RuleTransformer.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2002-2018, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2002-2019, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** From 286896c44c9e41841f963feac9af87522b651f97 Mon Sep 17 00:00:00 2001 From: Scala steward Date: Mon, 28 Jan 2019 03:44:55 +0100 Subject: [PATCH 278/789] Update sbt-scalajs, scalajs-compiler, ... to 0.6.26 --- project/plugins.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/plugins.sbt b/project/plugins.sbt index f166d63cc..4a28009d2 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -6,7 +6,7 @@ else Seq(addSbtPlugin("com.typesafe.sbt" % "sbt-osgi" % "0.9.3")) val scalaJSVersion = - Option(System.getenv("SCALAJS_VERSION")).filter(_.nonEmpty).getOrElse("0.6.25") + Option(System.getenv("SCALAJS_VERSION")).filter(_.nonEmpty).getOrElse("0.6.26") addSbtPlugin("org.scala-js" % "sbt-scalajs" % scalaJSVersion) addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "0.6.0") From f917ecec6f931c6334dc5d35ea57ecd4561efc3a Mon Sep 17 00:00:00 2001 From: Seth Tisue Date: Tue, 29 Jan 2019 13:02:35 -0800 Subject: [PATCH 279/789] bump Scala.js version in Travis-CI config, too --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index db12e9710..b279ac34f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -29,13 +29,13 @@ env: matrix: # The empty SCALAJS_VERSION will only compile for the JVM - SCALAJS_VERSION= - - SCALAJS_VERSION=0.6.25 + - SCALAJS_VERSION=0.6.26 - SCALAJS_VERSION=1.0.0-M6 matrix: exclude: - jdk: openjdk11 - env: SCALAJS_VERSION=0.6.25 + env: SCALAJS_VERSION=0.6.26 - jdk: openjdk11 env: SCALAJS_VERSION=1.0.0-M6 - scala: 2.11.12 From 4afe0db7f480a046870a4c938f74fb494601f33a Mon Sep 17 00:00:00 2001 From: Seth Tisue Date: Wed, 30 Jan 2019 22:18:08 -0800 Subject: [PATCH 280/789] include correct license info in POM --- build.sbt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/build.sbt b/build.sbt index c6d583fe3..5e5224098 100644 --- a/build.sbt +++ b/build.sbt @@ -13,6 +13,9 @@ lazy val xml = crossProject(JSPlatform, JVMPlatform) name := "scala-xml", version := "1.2.0-SNAPSHOT", + // this line could be removed after https://github.com/scala/sbt-scala-module/issues/48 is fixed + licenses := Seq(("Apache-2.0", url("https://www.apache.org/licenses/LICENSE-2.0"))), + // Compiler team advised avoiding the -Xfuture option for releases. // The output with -Xfuture should be periodically checked, though. scalacOptions ++= "-deprecation:false -feature -Xlint:-stars-align,-nullary-unit,_".split("\\s+").to[Seq], From d4a38aafeb7294467f7462b23db16acc51466a13 Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Thu, 14 Feb 2019 09:54:39 -0500 Subject: [PATCH 281/789] Publish API docs on GitHub pages --- README.md | 2 +- admin/api-docs.sh | 70 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 71 insertions(+), 1 deletion(-) create mode 100755 admin/api-docs.sh diff --git a/README.md b/README.md index 3fbbfef9a..ac7faa3b7 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ Since Scala 2.11, this library is a separate jar that can be omitted from Scala The decoupling works because the compiler desugars XML literals in Scala source code into a set of method calls. Alternative implementations of these calls are welcome! (The calls are unfortunately only defined by the [implementation](https://github.com/scala/scala/blob/2.11.x/src/compiler/scala/tools/nsc/ast/parser/SymbolicXMLBuilder.scala).) -API documentation is available [here](http://www.scala-lang.org/api/current/scala-xml/scala/xml/index.html). +API documentation is available [here](https://scala.github.io/scala-xml/api/1.1.0/scala/xml/). How to documentation is available in the [wiki](https://github.com/scala/scala-xml/wiki) diff --git a/admin/api-docs.sh b/admin/api-docs.sh new file mode 100755 index 000000000..9568a4cc7 --- /dev/null +++ b/admin/api-docs.sh @@ -0,0 +1,70 @@ +#!/bin/bash + +### + # Copyright (C) 2019 LAMP/EPFL and Lightbend, Inc. + # + # Build API docs for scala-xml. + # + # Runs Scaladoc, then commits to the gh-pages branch, so they are + # published to https://docs.scala-lang.org/scala-xml/api/1.0.0/ + # + # Usage: + # ./admin/api-docs.sh SCALA-XML-VERSION SCALA-VERSION + # + # SCALA-XML-VERSION is the scala-xml version, e.g. v1.0.5 + # SCALA-VERSION is the Scala version, e.g. 2.11.12 + # + # Example: + # ./admin/api-docs.sh v1.0.6 2.12.0 + # + # Required dependencies: + # - sbt 1.x + # - git + # - rsync + ## + +set -e + +if [ -z "$1" ]; then + echo "Error: Missing scala-xml version" >&2 + exit 1 +elif [ -z "$2" ]; then + echo "Error: Missing Scala version" >&2 + exit 1 +fi + +SCALA_XML_VERSION=${1%%#*} # Cleanup tags, e.g. v1.1.1#2.13.0-M5#8 +SCALA_VERSION=$2 + +TARGET_DIR=${TARGET_DIR-./jvm/target} +API_DIR=$TARGET_DIR/scala-${SCALA_VERSION%.*}/api +GIT_DIR=${GIT_DIR-./jvm/target} +DOC_DIR=$GIT_DIR/api/${SCALA_XML_VERSION#v} + +git checkout $SCALA_XML_VERSION +sbt "++$SCALA_VERSION" doc +mkdir $GIT_DIR/api +rsync -a $API_DIR/ $DOC_DIR/ +echo "Initializing git directory in $GIT_DIR" +cd $GIT_DIR +git init +git remote add upstream git@github.com:scala/scala-xml.git +git fetch upstream gh-pages +git checkout gh-pages +git add -A ./api +git commit -m"Scaladoc for $SCALA_XML_VERSION with Scala $SCALA_VERSION" +echo "Please review the commit in $GIT_DIR and push upstream" + +exit 0 +## End of script + +## Rebuild the universe with: + +env JAVA_HOME=$(/usr/libexec/java_home -v 1.6) TARGET_DIR=./target ./admin/api-docs.sh v1.0.1 2.11.12 +env JAVA_HOME=$(/usr/libexec/java_home -v 1.6) TARGET_DIR=./target ./admin/api-docs.sh v1.0.2 2.11.12 +env JAVA_HOME=$(/usr/libexec/java_home -v 1.6) TARGET_DIR=./target ./admin/api-docs.sh v1.0.3 2.11.12 +env JAVA_HOME=$(/usr/libexec/java_home -v 1.6) TARGET_DIR=./target ./admin/api-docs.sh v1.0.4 2.11.12 +env JAVA_HOME=$(/usr/libexec/java_home -v 1.6) TARGET_DIR=./target ./admin/api-docs.sh v1.0.5 2.11.12 +env JAVA_HOME=$(/usr/libexec/java_home -v 1.8) TARGET_DIR=./target ./admin/api-docs.sh v1.0.6 2.12.0 +env JAVA_HOME=$(/usr/libexec/java_home -v 1.8) ./admin/api-docs.sh v1.1.0 2.12.4 +env JAVA_HOME=$(/usr/libexec/java_home -v 1.8) ./admin/api-docs.sh v1.1.1 2.12.6 From 67a87459c1d78ba479b60ca273a0a5bc3218d1fa Mon Sep 17 00:00:00 2001 From: Seth Tisue Date: Fri, 15 Feb 2019 13:51:01 -0800 Subject: [PATCH 282/789] link to latest api docs --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index ac7faa3b7..f5926368b 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ Since Scala 2.11, this library is a separate jar that can be omitted from Scala The decoupling works because the compiler desugars XML literals in Scala source code into a set of method calls. Alternative implementations of these calls are welcome! (The calls are unfortunately only defined by the [implementation](https://github.com/scala/scala/blob/2.11.x/src/compiler/scala/tools/nsc/ast/parser/SymbolicXMLBuilder.scala).) -API documentation is available [here](https://scala.github.io/scala-xml/api/1.1.0/scala/xml/). +API documentation is available [here](https://scala.github.io/scala-xml/api/1.1.1/scala/xml/). How to documentation is available in the [wiki](https://github.com/scala/scala-xml/wiki) From 9a0db27487d3d28ca3286975c0c8cf13b5f27fc6 Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Tue, 28 Aug 2018 11:54:28 -0400 Subject: [PATCH 283/789] Fix failure for empty attribute match Running the following invalid attribute search, properly throws an IllegalArgumentException. scala> \ "@" java.lang.IllegalArgumentException: @ scala> \@ "" java.lang.IllegalArgumentException: @ There's no such thing as an empty attribute. However, when the improper matching value is used against more than just one element, no error is thrown, just an empty NodeSeq is returned: scala> .child \ "@" res1: scala.xml.NodeSeq = NodeSeq() It should be a failure. Similarly, the attribute search method, is similarly affected. scala> .child \@ "" res1: scala.xml.NodeSeq = NodeSeq() This was identified while writing ScalaCheck property tests. --- shared/src/main/scala/scala/xml/NodeSeq.scala | 1 + .../test/scala/scala/xml/AttributeTest.scala | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/shared/src/main/scala/scala/xml/NodeSeq.scala b/shared/src/main/scala/scala/xml/NodeSeq.scala index 07e6fe87d..18c8295b2 100644 --- a/shared/src/main/scala/scala/xml/NodeSeq.scala +++ b/shared/src/main/scala/scala/xml/NodeSeq.scala @@ -116,6 +116,7 @@ abstract class NodeSeq extends AbstractSeq[Node] with immutable.Seq[Node] with S that match { case "" => fail case "_" => makeSeq(!_.isAtom) + case "@" => fail case _ if (that(0) == '@' && this.length == 1) => atResult case _ => makeSeq(_.label == that) } diff --git a/shared/src/test/scala/scala/xml/AttributeTest.scala b/shared/src/test/scala/scala/xml/AttributeTest.scala index 0b3891496..285d24795 100644 --- a/shared/src/test/scala/scala/xml/AttributeTest.scala +++ b/shared/src/test/scala/scala/xml/AttributeTest.scala @@ -154,4 +154,23 @@ class AttributeTest { assertEquals(List(Group(Seq(Text("1"))), Group(Seq(Text("2")))), barList) } + @Test(expected=classOf[IllegalArgumentException]) + def invalidAttributeFailForOne: Unit = { + \ "@" + } + + @Test(expected=classOf[IllegalArgumentException]) + def invalidAttributeFailForMany: Unit = { + .child \ "@" + } + + @Test(expected=classOf[IllegalArgumentException]) + def invalidEmptyAttributeFailForOne: Unit = { + \@ "" + } + + @Test(expected=classOf[IllegalArgumentException]) + def invalidEmptyAttributeFailForMany: Unit = { + .child \@ "" + } } From 79c96dbc73ea428cf9def17c8218aa1fc2828266 Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Fri, 25 Jan 2019 10:52:51 -0500 Subject: [PATCH 284/789] Fix Decl.toString --- .../src/main/scala/scala/xml/dtd/Decl.scala | 1 + .../test/scala/scala/xml/dtd/DeclTest.scala | 42 +++++++++++++++++++ 2 files changed, 43 insertions(+) create mode 100644 shared/src/test/scala/scala/xml/dtd/DeclTest.scala diff --git a/shared/src/main/scala/scala/xml/dtd/Decl.scala b/shared/src/main/scala/scala/xml/dtd/Decl.scala index 9ac9761ea..5bf37403a 100644 --- a/shared/src/main/scala/scala/xml/dtd/Decl.scala +++ b/shared/src/main/scala/scala/xml/dtd/Decl.scala @@ -26,6 +26,7 @@ import Utility.sbToString sealed abstract class Decl sealed abstract class MarkupDecl extends Decl { + override def toString(): String = sbToString(buildString) def buildString(sb: StringBuilder): StringBuilder } diff --git a/shared/src/test/scala/scala/xml/dtd/DeclTest.scala b/shared/src/test/scala/scala/xml/dtd/DeclTest.scala new file mode 100644 index 000000000..a41542897 --- /dev/null +++ b/shared/src/test/scala/scala/xml/dtd/DeclTest.scala @@ -0,0 +1,42 @@ +package scala.xml +package dtd + +import org.junit.Test +import org.junit.Assert.assertEquals + +class DeclTest { + + @Test + def elemDeclToString: Unit = { + assertEquals( + "", + ElemDecl("x", PCDATA).toString + ) + } + + @Test + def attListDeclToString: Unit = { + + val expected = + """|""".stripMargin + + val actual = AttListDecl("x", + List( + AttrDecl("y", "CDATA", REQUIRED), + AttrDecl("z", "CDATA", REQUIRED) + ) + ).toString + + assertEquals(expected, actual) + } + + @Test + def parsedEntityDeclToString: Unit = { + assertEquals( + """""", + ParsedEntityDecl("foo", ExtDef(SystemID("bar"))).toString + ) + } +} From f9786bf8b786eeef3c972929f7483c7fb52a8829 Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Thu, 4 Apr 2019 13:58:37 -0400 Subject: [PATCH 285/789] Remove field RewriteRule.name It's not clear what this class member is for. Because of the lexical scoping rules in Scala, it can become an unfortunate name-collision when users write code that uses the same variable name in the anonymous class. --- build.sbt | 7 +++++++ .../src/main/scala/scala/xml/transform/RewriteRule.scala | 2 -- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/build.sbt b/build.sbt index cb9d1f576..14a058f69 100644 --- a/build.sbt +++ b/build.sbt @@ -21,6 +21,13 @@ lazy val xml = crossProject(JSPlatform, JVMPlatform) scalacOptions ++= "-deprecation:false -feature -Xlint:-stars-align,-nullary-unit,_".split("\\s+").to[Seq], scalacOptions in Test += "-Xxml:coalescing", + mimaBinaryIssueFilters ++= { + import com.typesafe.tools.mima.core._ + import com.typesafe.tools.mima.core.ProblemFilters._ + Seq( + exclude[DirectMissingMethodProblem]("scala.xml.transform.RewriteRule.name") + ) + }, mimaPreviousVersion := { if (System.getenv("SCALAJS_VERSION") == "1.0.0-M6") None // No such release yet else Some("1.1.1") diff --git a/shared/src/main/scala/scala/xml/transform/RewriteRule.scala b/shared/src/main/scala/scala/xml/transform/RewriteRule.scala index dd0d8895b..315be859d 100644 --- a/shared/src/main/scala/scala/xml/transform/RewriteRule.scala +++ b/shared/src/main/scala/scala/xml/transform/RewriteRule.scala @@ -20,8 +20,6 @@ import scala.collection.Seq * @author Burak Emir */ abstract class RewriteRule extends BasicTransformer { - /** a name for this rewrite rule */ - val name = this.toString() override def transform(ns: Seq[Node]): Seq[Node] = super.transform(ns) override def transform(n: Node): Seq[Node] = n } From cf34171810e020fdf63bd3b942329285e43d28dd Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Thu, 4 Apr 2019 12:33:10 -0400 Subject: [PATCH 286/789] Use 2.13.0-RC1 release candidate --- .travis.yml | 4 ++-- build.sbt | 2 +- .../scala-2.11-2.12/scala/xml/ScalaVersionSpecific.scala | 4 ---- .../src/main/scala-2.13/scala/xml/ScalaVersionSpecific.scala | 5 +---- shared/src/main/scala/scala/xml/MetaData.scala | 1 - shared/src/main/scala/scala/xml/NodeSeq.scala | 2 +- 6 files changed, 5 insertions(+), 13 deletions(-) diff --git a/.travis.yml b/.travis.yml index b279ac34f..4b4884d9c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,7 +16,7 @@ jdk: scala: - 2.11.12 - 2.12.8 - - 2.13.0-M5 + - 2.13.0-RC1 env: global: @@ -46,7 +46,7 @@ matrix: jdk: openjdk11 - scala: 2.12.8 jdk: openjdk6 - - scala: 2.13.0-M5 + - scala: 2.13.0-RC1 jdk: openjdk6 before_script: diff --git a/build.sbt b/build.sbt index 14a058f69..eccab34b6 100644 --- a/build.sbt +++ b/build.sbt @@ -1,7 +1,7 @@ import sbtcrossproject.{crossProject, CrossType} import ScalaModulePlugin._ -crossScalaVersions in ThisBuild := List("2.12.8", "2.11.12", "2.13.0-M5") +crossScalaVersions in ThisBuild := List("2.12.8", "2.11.12", "2.13.0-RC1") lazy val xml = crossProject(JSPlatform, JVMPlatform) .withoutSuffixFor(JVMPlatform) diff --git a/shared/src/main/scala-2.11-2.12/scala/xml/ScalaVersionSpecific.scala b/shared/src/main/scala-2.11-2.12/scala/xml/ScalaVersionSpecific.scala index fd3452089..417a3bcc6 100644 --- a/shared/src/main/scala-2.11-2.12/scala/xml/ScalaVersionSpecific.scala +++ b/shared/src/main/scala-2.11-2.12/scala/xml/ScalaVersionSpecific.scala @@ -20,7 +20,3 @@ private[xml] trait ScalaVersionSpecificNodeSeq extends SeqLike[Node, NodeSeq] { private[xml] trait ScalaVersionSpecificNodeBuffer { self: NodeBuffer => override def stringPrefix: String = "NodeBuffer" } - -private[xml] trait ScalaVersionSpecificIterableSerializable[+A] { // extends Iterable[A] { - // protected[this] override def writeReplace(): AnyRef = this -} diff --git a/shared/src/main/scala-2.13/scala/xml/ScalaVersionSpecific.scala b/shared/src/main/scala-2.13/scala/xml/ScalaVersionSpecific.scala index c47518336..bd2eb820d 100644 --- a/shared/src/main/scala-2.13/scala/xml/ScalaVersionSpecific.scala +++ b/shared/src/main/scala-2.13/scala/xml/ScalaVersionSpecific.scala @@ -19,12 +19,9 @@ private[xml] trait ScalaVersionSpecificNodeSeq with StrictOptimizedSeqOps[Node, immutable.Seq, NodeSeq] { self: NodeSeq => override def fromSpecific(coll: IterableOnce[Node]): NodeSeq = (NodeSeq.newBuilder ++= coll).result() override def newSpecificBuilder: mutable.Builder[Node, NodeSeq] = NodeSeq.newBuilder + override def empty: NodeSeq = NodeSeq.Empty } private[xml] trait ScalaVersionSpecificNodeBuffer { self: NodeBuffer => override def className: String = "NodeBuffer" } - -private[xml] trait ScalaVersionSpecificIterableSerializable[+A] extends Iterable[A] { - protected[this] override def writeReplace(): AnyRef = this -} diff --git a/shared/src/main/scala/scala/xml/MetaData.scala b/shared/src/main/scala/scala/xml/MetaData.scala index fbea65cd3..ee6824b03 100644 --- a/shared/src/main/scala/scala/xml/MetaData.scala +++ b/shared/src/main/scala/scala/xml/MetaData.scala @@ -82,7 +82,6 @@ abstract class MetaData extends AbstractIterable[MetaData] with Iterable[MetaData] with Equality - with ScalaVersionSpecificIterableSerializable[MetaData] with Serializable { /** diff --git a/shared/src/main/scala/scala/xml/NodeSeq.scala b/shared/src/main/scala/scala/xml/NodeSeq.scala index 18c8295b2..56f7507e5 100644 --- a/shared/src/main/scala/scala/xml/NodeSeq.scala +++ b/shared/src/main/scala/scala/xml/NodeSeq.scala @@ -44,7 +44,7 @@ object NodeSeq { * * @author Burak Emir */ -abstract class NodeSeq extends AbstractSeq[Node] with immutable.Seq[Node] with ScalaVersionSpecificNodeSeq with Equality with ScalaVersionSpecificIterableSerializable[Node] with Serializable { +abstract class NodeSeq extends AbstractSeq[Node] with immutable.Seq[Node] with ScalaVersionSpecificNodeSeq with Equality with Serializable { def theSeq: Seq[Node] def length = theSeq.length override def iterator = theSeq.iterator From 242cf9e0f1c36d0af743040c16503e25de6f3ba1 Mon Sep 17 00:00:00 2001 From: Seth Tisue Date: Fri, 5 Apr 2019 11:08:58 +0100 Subject: [PATCH 287/789] bump Scala.js versions for RC1 --- .travis.yml | 10 +++++----- build.sbt | 2 +- project/plugins.sbt | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.travis.yml b/.travis.yml index 4b4884d9c..ee9554c29 100644 --- a/.travis.yml +++ b/.travis.yml @@ -29,17 +29,17 @@ env: matrix: # The empty SCALAJS_VERSION will only compile for the JVM - SCALAJS_VERSION= - - SCALAJS_VERSION=0.6.26 - - SCALAJS_VERSION=1.0.0-M6 + - SCALAJS_VERSION=0.6.27 + - SCALAJS_VERSION=1.0.0-M7 matrix: exclude: - jdk: openjdk11 - env: SCALAJS_VERSION=0.6.26 + env: SCALAJS_VERSION=0.6.27 - jdk: openjdk11 - env: SCALAJS_VERSION=1.0.0-M6 + env: SCALAJS_VERSION=1.0.0-M7 - scala: 2.11.12 - env: SCALAJS_VERSION=1.0.0-M6 + env: SCALAJS_VERSION=1.0.0-M7 - scala: 2.11.12 jdk: oraclejdk8 - scala: 2.11.12 diff --git a/build.sbt b/build.sbt index eccab34b6..91c112cf1 100644 --- a/build.sbt +++ b/build.sbt @@ -29,7 +29,7 @@ lazy val xml = crossProject(JSPlatform, JVMPlatform) ) }, mimaPreviousVersion := { - if (System.getenv("SCALAJS_VERSION") == "1.0.0-M6") None // No such release yet + if (System.getenv("SCALAJS_VERSION") == "1.0.0-M7") None // No such release yet else Some("1.1.1") }, diff --git a/project/plugins.sbt b/project/plugins.sbt index 4a28009d2..983887349 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -6,7 +6,7 @@ else Seq(addSbtPlugin("com.typesafe.sbt" % "sbt-osgi" % "0.9.3")) val scalaJSVersion = - Option(System.getenv("SCALAJS_VERSION")).filter(_.nonEmpty).getOrElse("0.6.26") + Option(System.getenv("SCALAJS_VERSION")).filter(_.nonEmpty).getOrElse("0.6.27") addSbtPlugin("org.scala-js" % "sbt-scalajs" % scalaJSVersion) addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "0.6.0") From d3c6dd79c9bd06d31787d9c86fc621d43de18598 Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Fri, 5 Apr 2019 12:03:05 -0400 Subject: [PATCH 288/789] Bump version for next release --- build.sbt | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/build.sbt b/build.sbt index 91c112cf1..61c479c2b 100644 --- a/build.sbt +++ b/build.sbt @@ -11,7 +11,7 @@ lazy val xml = crossProject(JSPlatform, JVMPlatform) .jvmSettings(scalaModuleSettingsJVM) .settings( name := "scala-xml", - version := "1.2.0-SNAPSHOT", + version := "1.2.1-SNAPSHOT", // this line could be removed after https://github.com/scala/sbt-scala-module/issues/48 is fixed licenses := Seq(("Apache-2.0", url("https://www.apache.org/licenses/LICENSE-2.0"))), @@ -29,8 +29,7 @@ lazy val xml = crossProject(JSPlatform, JVMPlatform) ) }, mimaPreviousVersion := { - if (System.getenv("SCALAJS_VERSION") == "1.0.0-M7") None // No such release yet - else Some("1.1.1") + Some("1.2.0") }, unmanagedSourceDirectories in Compile ++= { From b4067ed1384673e1059757959b6f05344cbeaa96 Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Fri, 5 Apr 2019 12:17:02 -0400 Subject: [PATCH 289/789] Update Maven badge to 2.13.0-RC1 --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index f5926368b..967511919 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ scala-xml [![Travis](https://img.shields.io/travis/scala/scala-xml.svg)](https://travis-ci.org/scala/scala-xml) [![latest release for 2.11](https://img.shields.io/maven-central/v/org.scala-lang.modules/scala-xml_2.11.svg?label=scala+2.11)](http://mvnrepository.com/artifact/org.scala-lang.modules/scala-xml_2.11) [![latest release for 2.12](https://img.shields.io/maven-central/v/org.scala-lang.modules/scala-xml_2.12.svg?label=scala+2.12)](http://mvnrepository.com/artifact/org.scala-lang.modules/scala-xml_2.12) -[![latest release for 2.13.0-M5](https://img.shields.io/maven-central/v/org.scala-lang.modules/scala-xml_2.13.0-M5.svg?label=scala+2.13.0-M5)](http://mvnrepository.com/artifact/org.scala-lang.modules/scala-xml_2.13.0-M5) +[![latest release for 2.13.0-RC1](https://img.shields.io/maven-central/v/org.scala-lang.modules/scala-xml_2.13.0-RC1.svg?label=scala+2.13.0-RC1)](http://mvnrepository.com/artifact/org.scala-lang.modules/scala-xml_2.13.0-RC1) [![Gitter](https://badges.gitter.im/Join+Chat.svg)](https://gitter.im/scala/scala-xml) ========= From 4367c8d3ff285aa9a2b00d1f627fcc2179662238 Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Fri, 5 Apr 2019 12:47:30 -0400 Subject: [PATCH 290/789] Update version in api-docs.sh --- admin/api-docs.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/admin/api-docs.sh b/admin/api-docs.sh index 9568a4cc7..ece2b11e1 100755 --- a/admin/api-docs.sh +++ b/admin/api-docs.sh @@ -68,3 +68,4 @@ env JAVA_HOME=$(/usr/libexec/java_home -v 1.6) TARGET_DIR=./target ./admin/api-d env JAVA_HOME=$(/usr/libexec/java_home -v 1.8) TARGET_DIR=./target ./admin/api-docs.sh v1.0.6 2.12.0 env JAVA_HOME=$(/usr/libexec/java_home -v 1.8) ./admin/api-docs.sh v1.1.0 2.12.4 env JAVA_HOME=$(/usr/libexec/java_home -v 1.8) ./admin/api-docs.sh v1.1.1 2.12.6 +env JAVA_HOME=$(/usr/libexec/java_home -v 1.8) ./admin/api-docs.sh v1.2.0 2.12.8 From 350d6258c7beb05067ebf7d98ec1e0d031385c01 Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Fri, 5 Apr 2019 14:39:33 -0400 Subject: [PATCH 291/789] Reset the MiMa filters in build.sbt --- build.sbt | 7 ------- 1 file changed, 7 deletions(-) diff --git a/build.sbt b/build.sbt index 61c479c2b..e6a7dbb30 100644 --- a/build.sbt +++ b/build.sbt @@ -21,13 +21,6 @@ lazy val xml = crossProject(JSPlatform, JVMPlatform) scalacOptions ++= "-deprecation:false -feature -Xlint:-stars-align,-nullary-unit,_".split("\\s+").to[Seq], scalacOptions in Test += "-Xxml:coalescing", - mimaBinaryIssueFilters ++= { - import com.typesafe.tools.mima.core._ - import com.typesafe.tools.mima.core.ProblemFilters._ - Seq( - exclude[DirectMissingMethodProblem]("scala.xml.transform.RewriteRule.name") - ) - }, mimaPreviousVersion := { Some("1.2.0") }, From 61efbd75ebba987338083acfb8e3b50338325323 Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Fri, 5 Apr 2019 16:27:21 -0400 Subject: [PATCH 292/789] Update link for API docs to 1.2.0 --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 967511919..b35010889 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ Since Scala 2.11, this library is a separate jar that can be omitted from Scala The decoupling works because the compiler desugars XML literals in Scala source code into a set of method calls. Alternative implementations of these calls are welcome! (The calls are unfortunately only defined by the [implementation](https://github.com/scala/scala/blob/2.11.x/src/compiler/scala/tools/nsc/ast/parser/SymbolicXMLBuilder.scala).) -API documentation is available [here](https://scala.github.io/scala-xml/api/1.1.1/scala/xml/). +API documentation is available [here](https://scala.github.io/scala-xml/api/1.2.0/scala/xml/). How to documentation is available in the [wiki](https://github.com/scala/scala-xml/wiki) From 20b8db223dfc8f1b6fba6d6a34057c0b82be57c5 Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Fri, 5 Apr 2019 16:35:28 -0400 Subject: [PATCH 293/789] Drop JDK6 and Scala 2.11 from build --- .sbtrepos | 8 -------- .travis.yml | 28 ---------------------------- admin/build.sh | 10 ++-------- build.sbt | 2 +- 4 files changed, 3 insertions(+), 45 deletions(-) delete mode 100644 .sbtrepos diff --git a/.sbtrepos b/.sbtrepos deleted file mode 100644 index b9e49c484..000000000 --- a/.sbtrepos +++ /dev/null @@ -1,8 +0,0 @@ -[repositories] - local - local-preloaded-ivy: file:///${sbt.preloaded-${sbt.global.base-${user.home}/.sbt}/preloaded/}, [organization]/[module]/[revision]/[type]s/[artifact](-[classifier]).[ext] - local-preloaded: file:///${sbt.preloaded-${sbt.global.base-${user.home}/.sbt}/preloaded/} - maven-central: http://repo1.maven.org/maven2/ - sonatype-public: http://oss.sonatype.org/content/repositories/public - typesafe-ivy-releases: http://repo.typesafe.com/typesafe/ivy-releases/, [organization]/[module]/(scala_[scalaVersion]/)(sbt_[sbtVersion]/)[revision]/[type]s/[artifact](-[classifier]).[ext], bootOnly - sbt-ivy-releases: http://repo.scala-sbt.org/scalasbt/sbt-plugin-releases/, [organization]/[module]/(scala_[scalaVersion]/)(sbt_[sbtVersion]/)[revision]/[type]s/[artifact](-[classifier]).[ext], bootOnly diff --git a/.travis.yml b/.travis.yml index ee9554c29..bef7d95db 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,20 +1,10 @@ language: scala -# Needed for openjdk6 -dist: precise -sudo: required -addons: - hosts: - - localhost - hostname: localhost.local - jdk: - - openjdk6 - oraclejdk8 - openjdk11 scala: - - 2.11.12 - 2.12.8 - 2.13.0-RC1 @@ -38,26 +28,8 @@ matrix: env: SCALAJS_VERSION=0.6.27 - jdk: openjdk11 env: SCALAJS_VERSION=1.0.0-M7 - - scala: 2.11.12 - env: SCALAJS_VERSION=1.0.0-M7 - - scala: 2.11.12 - jdk: oraclejdk8 - - scala: 2.11.12 - jdk: openjdk11 - - scala: 2.12.8 - jdk: openjdk6 - - scala: 2.13.0-RC1 - jdk: openjdk6 - -before_script: - - nvm install 8 - - nvm use 8 script: - # work around https://github.com/travis-ci/travis-ci/issues/9713 - - if [[ $JAVA_HOME = *java-6* ]]; then jdk_switcher use openjdk6; fi - - java -version - - node -v - admin/build.sh before_cache: diff --git a/admin/build.sh b/admin/build.sh index 2ebd80311..c0585c46f 100755 --- a/admin/build.sh +++ b/admin/build.sh @@ -16,8 +16,7 @@ set -e # of the existing tag. Then a new tag can be created for that commit, e.g., `v1.2.3#2.13.0-M5`. # Everything after the `#` in the tag name is ignored. -if [[ "$TRAVIS_JDK_VERSION" == "openjdk6" && "$TRAVIS_SCALA_VERSION" =~ 2\.11\..* \ - || "$TRAVIS_JDK_VERSION" == "oraclejdk8" && "$TRAVIS_SCALA_VERSION" =~ 2\.1[23]\..* ]]; then +if [[ "$TRAVIS_JDK_VERSION" == "oraclejdk8" && "$TRAVIS_SCALA_VERSION" =~ 2\.1[23]\..* ]]; then RELEASE_COMBO=true; fi @@ -52,9 +51,4 @@ if [[ "$TRAVIS_TAG" =~ $tagPat ]]; then fi fi -# Maven Central and Bintray are unreachable over HTTPS -if [[ "$TRAVIS_JDK_VERSION" == "openjdk6" ]]; then - SBTOPTS="-Dsbt.override.build.repos=true -Dsbt.repository.config=./.sbtrepos" -fi - -sbt $SBTOPTS "++$TRAVIS_SCALA_VERSION" "$publishVersion" "$projectPrefix/clean" "$projectPrefix/test" "$projectPrefix/publishLocal" "$publishTask" +sbt "++$TRAVIS_SCALA_VERSION" "$publishVersion" "$projectPrefix/clean" "$projectPrefix/test" "$projectPrefix/publishLocal" "$publishTask" diff --git a/build.sbt b/build.sbt index e6a7dbb30..1c80f046d 100644 --- a/build.sbt +++ b/build.sbt @@ -1,7 +1,7 @@ import sbtcrossproject.{crossProject, CrossType} import ScalaModulePlugin._ -crossScalaVersions in ThisBuild := List("2.12.8", "2.11.12", "2.13.0-RC1") +crossScalaVersions in ThisBuild := List("2.12.8", "2.13.0-RC1") lazy val xml = crossProject(JSPlatform, JVMPlatform) .withoutSuffixFor(JVMPlatform) From 7d06cddfdb9eb813874b81db4f40f8a479b33a7f Mon Sep 17 00:00:00 2001 From: Scala steward Date: Mon, 15 Apr 2019 22:32:59 +0200 Subject: [PATCH 294/789] Update commons-lang3 to 3.9 --- build.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index 1c80f046d..54e744115 100644 --- a/build.sbt +++ b/build.sbt @@ -63,7 +63,7 @@ lazy val xml = crossProject(JSPlatform, JVMPlatform) libraryDependencies += "junit" % "junit" % "4.12" % "test", libraryDependencies += "com.novocode" % "junit-interface" % "0.11" % "test", - libraryDependencies += "org.apache.commons" % "commons-lang3" % "3.5" % "test", + libraryDependencies += "org.apache.commons" % "commons-lang3" % "3.9" % "test", libraryDependencies += ("org.scala-lang" % "scala-compiler" % scalaVersion.value % "test").exclude("org.scala-lang.modules", s"scala-xml_${scalaBinaryVersion.value}") ) .jsSettings( From 9b85bf7007212f2fffc2537603930504ad82a8fe Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Fri, 5 Apr 2019 17:09:34 -0400 Subject: [PATCH 295/789] Update build to sbt 1.2.8 --- admin/build.sh | 2 +- project/build.properties | 2 +- project/plugins.sbt | 9 ++------- 3 files changed, 4 insertions(+), 9 deletions(-) diff --git a/admin/build.sh b/admin/build.sh index c0585c46f..01548ad8d 100755 --- a/admin/build.sh +++ b/admin/build.sh @@ -39,7 +39,7 @@ if [[ "$TRAVIS_TAG" =~ $tagPat ]]; then currentJvmVer=$(java -version 2>&1 | awk -F '"' '/version/ {print $2}' | sed 's/^1\.//' | sed 's/[^0-9].*//') echo "Releasing $tagVer with Scala $TRAVIS_SCALA_VERSION on Java version $currentJvmVer." - publishTask="$projectPrefix/publish-signed" + publishTask="$projectPrefix/publishSigned" cat admin/gpg.sbt >> project/plugins.sbt cp admin/publish-settings.sbt . diff --git a/project/build.properties b/project/build.properties index 133a8f197..c0bab0494 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version=0.13.17 +sbt.version=1.2.8 diff --git a/project/plugins.sbt b/project/plugins.sbt index 983887349..8920d978b 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,13 +1,8 @@ -if (System.getProperty("java.version").startsWith("1.")) - Seq() -else - // override to version that works on Java 9, - // see https://github.com/scala/sbt-scala-module/issues/35 - Seq(addSbtPlugin("com.typesafe.sbt" % "sbt-osgi" % "0.9.3")) +addSbtPlugin("com.typesafe.sbt" % "sbt-osgi" % "0.9.5") val scalaJSVersion = Option(System.getenv("SCALAJS_VERSION")).filter(_.nonEmpty).getOrElse("0.6.27") addSbtPlugin("org.scala-js" % "sbt-scalajs" % scalaJSVersion) addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "0.6.0") -addSbtPlugin("org.scala-lang.modules" % "sbt-scala-module" % "1.0.14") +addSbtPlugin("org.scala-lang.modules" % "sbt-scala-module" % "2.0.0") From e0e7df1b7e9fef64372560cf8e149a58ee3ec00f Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Wed, 3 May 2017 00:29:42 -0400 Subject: [PATCH 296/789] Improve junit tests to use assertEquals Using assertTrue and == won't show expected versus result. --- jvm/src/test/scala/scala/xml/XMLTest.scala | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/jvm/src/test/scala/scala/xml/XMLTest.scala b/jvm/src/test/scala/scala/xml/XMLTest.scala index 37d45bccc..11387171b 100644 --- a/jvm/src/test/scala/scala/xml/XMLTest.scala +++ b/jvm/src/test/scala/scala/xml/XMLTest.scala @@ -41,8 +41,8 @@ class XMLTestJVM { override def text = "" } - assertTrue(c == parsedxml11) - assertTrue(parsedxml1 == parsedxml11) + assertEquals(c, parsedxml11) + assertEquals(parsedxml1, parsedxml11) assertTrue(List(parsedxml1) sameElements List(parsedxml11)) assertTrue(Array(parsedxml1).toList sameElements List(parsedxml11)) @@ -51,10 +51,10 @@ class XMLTestJVM { val i = new InputSource(new StringReader(x2)) val x2p = scala.xml.XML.load(i) - assertTrue(x2p == Elem(null, "book", e, sc, + assertEquals(Elem(null, "book", e, sc, Elem(null, "author", e, sc, Text("Peter Buneman")), Elem(null, "author", e, sc, Text("Dan Suciu")), - Elem(null, "title", e, sc, Text("Data on ze web")))) + Elem(null, "title", e, sc, Text("Data on ze web"))), x2p) } @@ -455,16 +455,16 @@ class XMLTestJVM { @UnitTest def t6939 = { val foo = - assertTrue(foo.child.head.scope.toString == """ xmlns:x="http://bar.com/"""") + assertEquals(foo.child.head.scope.toString, """ xmlns:x="http://bar.com/"""") val fooDefault = - assertTrue(fooDefault.child.head.scope.toString == """ xmlns="http://bar.com/"""") + assertEquals(fooDefault.child.head.scope.toString, """ xmlns="http://bar.com/"""") val foo2 = scala.xml.XML.loadString("""""") - assertTrue(foo2.child.head.scope.toString == """ xmlns:x="http://bar.com/"""") + assertEquals(foo2.child.head.scope.toString, """ xmlns:x="http://bar.com/"""") val foo2Default = scala.xml.XML.loadString("""""") - assertTrue(foo2Default.child.head.scope.toString == """ xmlns="http://bar.com/"""") + assertEquals(foo2Default.child.head.scope.toString, """ xmlns="http://bar.com/"""") } @UnitTest From 39753a6bc7211cca56add4cedee230713c768d43 Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Wed, 3 May 2017 00:38:29 -0400 Subject: [PATCH 297/789] Replace deprecated stack with list 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] ^ --- .../xml/dtd/impl/SubsetConstruction.scala | 9 +++-- .../scala/scala/xml/factory/XMLLoader.scala | 4 +- .../scala/xml/include/sax/XIncluder.scala | 7 ++-- .../scala/xml/parsing/FactoryAdapter.scala | 40 +++++++++++-------- 4 files changed, 33 insertions(+), 27 deletions(-) diff --git a/shared/src/main/scala/scala/xml/dtd/impl/SubsetConstruction.scala b/shared/src/main/scala/scala/xml/dtd/impl/SubsetConstruction.scala index 2bc2c97b1..e3d2ba194 100644 --- a/shared/src/main/scala/scala/xml/dtd/impl/SubsetConstruction.scala +++ b/shared/src/main/scala/scala/xml/dtd/impl/SubsetConstruction.scala @@ -32,9 +32,9 @@ private[dtd] class SubsetConstruction[T <: AnyRef](val nfa: NondetWordAutom[T]) val delta = new mutable.HashMap[immutable.BitSet, mutable.HashMap[T, immutable.BitSet]] val deftrans = mutable.Map(q0 -> sink, sink -> sink) // initial transitions val finals: mutable.Map[immutable.BitSet, Int] = mutable.Map() - val rest = new mutable.Stack[immutable.BitSet] + var rest = immutable.List.empty[immutable.BitSet] - rest.push(sink, q0) + rest = q0 :: sink :: rest def addFinal(q: immutable.BitSet): Unit = { if (nfa containsFinal q) @@ -43,7 +43,7 @@ private[dtd] class SubsetConstruction[T <: AnyRef](val nfa: NondetWordAutom[T]) def add(Q: immutable.BitSet): Unit = { if (!states(Q)) { states += Q - rest push Q + rest = Q :: rest addFinal(Q) } } @@ -51,7 +51,8 @@ private[dtd] class SubsetConstruction[T <: AnyRef](val nfa: NondetWordAutom[T]) addFinal(q0) // initial state may also be a final state while (!rest.isEmpty) { - val P = rest.pop() + val P = rest.head + rest = rest.tail // assign a number to this bitset indexMap(P) = ix invIndexMap(ix) = P diff --git a/shared/src/main/scala/scala/xml/factory/XMLLoader.scala b/shared/src/main/scala/scala/xml/factory/XMLLoader.scala index b84f42af4..e9a534fbd 100644 --- a/shared/src/main/scala/scala/xml/factory/XMLLoader.scala +++ b/shared/src/main/scala/scala/xml/factory/XMLLoader.scala @@ -37,9 +37,9 @@ trait XMLLoader[T <: Node] { def loadXML(source: InputSource, parser: SAXParser): T = { val newAdapter = adapter - newAdapter.scopeStack push TopScope + newAdapter.scopeStack = TopScope :: newAdapter.scopeStack parser.parse(source, newAdapter) - newAdapter.scopeStack.pop() + newAdapter.scopeStack = newAdapter.scopeStack.tail newAdapter.rootElem.asInstanceOf[T] } diff --git a/shared/src/main/scala/scala/xml/include/sax/XIncluder.scala b/shared/src/main/scala/scala/xml/include/sax/XIncluder.scala index 2f6284a6c..bf65cfafc 100644 --- a/shared/src/main/scala/scala/xml/include/sax/XIncluder.scala +++ b/shared/src/main/scala/scala/xml/include/sax/XIncluder.scala @@ -10,7 +10,6 @@ package scala package xml package include.sax -import scala.collection.mutable import org.xml.sax.{ ContentHandler, Locator, Attributes } import org.xml.sax.ext.LexicalHandler import java.io.{ OutputStream, OutputStreamWriter, IOException } @@ -126,7 +125,7 @@ class XIncluder(outs: OutputStream, encoding: String) extends ContentHandler wit // LexicalHandler methods private var inDTD: Boolean = false - private val entities = new mutable.Stack[String]() + private var entities = List.empty[String] def startDTD(name: String, publicID: String, systemID: String): Unit = { inDTD = true @@ -146,11 +145,11 @@ class XIncluder(outs: OutputStream, encoding: String) extends ContentHandler wit def endDTD(): Unit = {} def startEntity(name: String): Unit = { - entities push name + entities = name :: entities } def endEntity(name: String): Unit = { - entities.pop() + entities = entities.tail } def startCDATA(): Unit = {} diff --git a/shared/src/main/scala/scala/xml/parsing/FactoryAdapter.scala b/shared/src/main/scala/scala/xml/parsing/FactoryAdapter.scala index cbacb0492..5751bf670 100644 --- a/shared/src/main/scala/scala/xml/parsing/FactoryAdapter.scala +++ b/shared/src/main/scala/scala/xml/parsing/FactoryAdapter.scala @@ -10,7 +10,6 @@ package scala package xml package parsing -import scala.collection.{ mutable, Iterator } import scala.collection.Seq import org.xml.sax.Attributes import org.xml.sax.helpers.DefaultHandler @@ -40,10 +39,10 @@ abstract class FactoryAdapter extends DefaultHandler with factory.XMLLoader[Node var rootElem: Node = null val buffer = new StringBuilder() - val attribStack = new mutable.Stack[MetaData] - val hStack = new mutable.Stack[Node] // [ element ] contains siblings - val tagStack = new mutable.Stack[String] - var scopeStack = new mutable.Stack[NamespaceBinding] + var attribStack = List.empty[MetaData] + var hStack = List.empty[Node] // [ element ] contains siblings + var tagStack = List.empty[String] + var scopeStack = List.empty[NamespaceBinding] var curTag: String = null var capture: Boolean = false @@ -123,17 +122,17 @@ abstract class FactoryAdapter extends DefaultHandler with factory.XMLLoader[Node attributes: Attributes): Unit = { captureText() - tagStack push curTag + tagStack = curTag :: tagStack curTag = qname val localName = splitName(qname)._2 capture = nodeContainsText(localName) - hStack push null + hStack = null :: hStack var m: MetaData = Null var scpe: NamespaceBinding = if (scopeStack.isEmpty) TopScope - else scopeStack.top + else scopeStack.head for (i <- 0 until attributes.getLength()) { val qname = attributes getQName i @@ -148,8 +147,8 @@ abstract class FactoryAdapter extends DefaultHandler with factory.XMLLoader[Node m = Attribute(Option(pre), key, Text(value), m) } - scopeStack push scpe - attribStack push m + scopeStack = scpe :: scopeStack + attribStack = m :: attribStack } /** @@ -157,7 +156,7 @@ abstract class FactoryAdapter extends DefaultHandler with factory.XMLLoader[Node */ def captureText(): Unit = { if (capture && buffer.length > 0) - hStack push createText(buffer.toString) + hStack = createText(buffer.toString) :: hStack buffer.clear() } @@ -171,17 +170,24 @@ abstract class FactoryAdapter extends DefaultHandler with factory.XMLLoader[Node */ override def endElement(uri: String, _localName: String, qname: String): Unit = { captureText() - val metaData = attribStack.pop() + val metaData = attribStack.head + attribStack = attribStack.tail // reverse order to get it right - val v = (Iterator continually hStack.pop takeWhile (_ != null)).toList.reverse + val v = hStack.takeWhile(_ != null).reverse + hStack = hStack.dropWhile(_ != null) match { + case null :: hs => hs + case hs => hs + } val (pre, localName) = splitName(qname) - val scp = scopeStack.pop() + val scp = scopeStack.head + scopeStack = scopeStack.tail // create element rootElem = createNode(pre, localName, metaData, scp, v) - hStack push rootElem - curTag = tagStack.pop() + hStack = rootElem :: hStack + curTag = tagStack.head + tagStack = tagStack.tail capture = curTag != null && nodeContainsText(curTag) // root level } @@ -190,6 +196,6 @@ abstract class FactoryAdapter extends DefaultHandler with factory.XMLLoader[Node */ override def processingInstruction(target: String, data: String): Unit = { captureText() - hStack pushAll createProcInstr(target, data) + hStack = hStack.reverse_:::(createProcInstr(target, data).toList) } } From 64b7dbd283f52f8daf4573dded5687e0add8176c Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Wed, 10 May 2017 23:20:01 -0400 Subject: [PATCH 298/789] Add mima exclude filters for mutable.Stack 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. --- build.sbt | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/build.sbt b/build.sbt index 54e744115..a18bc22bc 100644 --- a/build.sbt +++ b/build.sbt @@ -24,6 +24,19 @@ lazy val xml = crossProject(JSPlatform, JVMPlatform) mimaPreviousVersion := { Some("1.2.0") }, + mimaBinaryIssueFilters ++= { + import com.typesafe.tools.mima.core._ + import com.typesafe.tools.mima.core.ProblemFilters._ + Seq( + // Scala 2.12 deprecated mutable.Stack, so we broke + // binary compatibility for 1.1.0 in the following way: + exclude[IncompatibleMethTypeProblem]("scala.xml.parsing.FactoryAdapter.scopeStack_="), + exclude[IncompatibleResultTypeProblem]("scala.xml.parsing.FactoryAdapter.hStack"), + exclude[IncompatibleResultTypeProblem]("scala.xml.parsing.FactoryAdapter.scopeStack"), + exclude[IncompatibleResultTypeProblem]("scala.xml.parsing.FactoryAdapter.attribStack"), + exclude[IncompatibleResultTypeProblem]("scala.xml.parsing.FactoryAdapter.tagStack") + ) + }, unmanagedSourceDirectories in Compile ++= { (unmanagedSourceDirectories in Compile).value.map { dir => From 35f452c01cf1826b6697ce96c7324ec0889f8e02 Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Thu, 11 May 2017 00:53:07 -0400 Subject: [PATCH 299/789] Document dropping mutuable.Stack Make a note of binary compatability change in scaladoc for members that were converted to mutable.Stack. --- .../scala/xml/parsing/FactoryAdapter.scala | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/shared/src/main/scala/scala/xml/parsing/FactoryAdapter.scala b/shared/src/main/scala/scala/xml/parsing/FactoryAdapter.scala index 5751bf670..ad863d4fc 100644 --- a/shared/src/main/scala/scala/xml/parsing/FactoryAdapter.scala +++ b/shared/src/main/scala/scala/xml/parsing/FactoryAdapter.scala @@ -39,9 +39,33 @@ abstract class FactoryAdapter extends DefaultHandler with factory.XMLLoader[Node var rootElem: Node = null val buffer = new StringBuilder() + /** List of attributes + * + * Previously was a [[scala.collection.mutable.Stack]], but is now a mutable [[scala.collection.immutable.List]]. + * + * @since 1.0.7 + */ var attribStack = List.empty[MetaData] + /** List of elements + * + * Previously was a [[scala.collection.mutable.Stack]], but is now a mutable [[scala.collection.immutable.List]]. + * + * @since 1.0.7 + */ var hStack = List.empty[Node] // [ element ] contains siblings + /** List of element names + * + * Previously was a [[scala.collection.mutable.Stack]], but is now a mutable [[scala.collection.immutable.List]]. + * + * @since 1.0.7 + */ var tagStack = List.empty[String] + /** List of namespaces + * + * Previously was a [[scala.collection.mutable.Stack]], but is now a mutable [[scala.collection.immutable.List]]. + * + * @since 1.0.7 + */ var scopeStack = List.empty[NamespaceBinding] var curTag: String = null From 27404951320cd56a465d3e101893f10ddbfd5e9e Mon Sep 17 00:00:00 2001 From: Joe Barnes Date: Sat, 5 Aug 2017 23:20:57 -0400 Subject: [PATCH 300/789] Improve wording on stack deprecation --- .../scala/scala/xml/parsing/FactoryAdapter.scala | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/shared/src/main/scala/scala/xml/parsing/FactoryAdapter.scala b/shared/src/main/scala/scala/xml/parsing/FactoryAdapter.scala index ad863d4fc..608646f2a 100644 --- a/shared/src/main/scala/scala/xml/parsing/FactoryAdapter.scala +++ b/shared/src/main/scala/scala/xml/parsing/FactoryAdapter.scala @@ -41,30 +41,30 @@ abstract class FactoryAdapter extends DefaultHandler with factory.XMLLoader[Node val buffer = new StringBuilder() /** List of attributes * - * Previously was a [[scala.collection.mutable.Stack]], but is now a mutable [[scala.collection.immutable.List]]. + * Previously was a mutable [[scala.collection.mutable.Stack Stack]], but is now a mutable reference to an immutable [[scala.collection.immutable.List List]]. * - * @since 1.0.7 + * @since 1.1.0 */ var attribStack = List.empty[MetaData] /** List of elements * - * Previously was a [[scala.collection.mutable.Stack]], but is now a mutable [[scala.collection.immutable.List]]. + * Previously was a mutable [[scala.collection.mutable.Stack Stack]], but is now a mutable reference to an immutable [[scala.collection.immutable.List List]]. * - * @since 1.0.7 + * @since 1.1.0 */ var hStack = List.empty[Node] // [ element ] contains siblings /** List of element names * - * Previously was a [[scala.collection.mutable.Stack]], but is now a mutable [[scala.collection.immutable.List]]. + * Previously was a mutable [[scala.collection.mutable.Stack Stack]], but is now a mutable reference to an immutable [[scala.collection.immutable.List List]]. * - * @since 1.0.7 + * @since 1.1.0 */ var tagStack = List.empty[String] /** List of namespaces * - * Previously was a [[scala.collection.mutable.Stack]], but is now a mutable [[scala.collection.immutable.List]]. + * Previously was a mutable [[scala.collection.mutable.Stack Stack]], but is now a mutable reference to an immutable [[scala.collection.immutable.List List]]. * - * @since 1.0.7 + * @since 1.1.0 */ var scopeStack = List.empty[NamespaceBinding] From 3d644e54eb8b9d06032b2453106b827d35fafb3e Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Sun, 18 Mar 2018 18:41:05 -0400 Subject: [PATCH 301/789] Remove XMLEventReader --- .../scala/scala/xml/pull/XMLEventReader.scala | 167 ------------------ 1 file changed, 167 deletions(-) delete mode 100755 shared/src/main/scala/scala/xml/pull/XMLEventReader.scala diff --git a/shared/src/main/scala/scala/xml/pull/XMLEventReader.scala b/shared/src/main/scala/scala/xml/pull/XMLEventReader.scala deleted file mode 100755 index 338b7b28a..000000000 --- a/shared/src/main/scala/scala/xml/pull/XMLEventReader.scala +++ /dev/null @@ -1,167 +0,0 @@ -/* __ *\ -** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2019, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** -** /____/\___/_/ |_/____/_/ | | ** -** |/ ** -\* */ - -package scala -package xml -package pull - -import scala.io.Source -import java.lang.Thread -import java.util.concurrent.LinkedBlockingQueue -import java.nio.channels.ClosedChannelException -import scala.xml.parsing.{ ExternalSources, MarkupHandler, MarkupParser } - -/** - * Main entry point into creating an event-based XML parser. Treating this - * as a [[scala.collection.Iterator]] will provide access to the generated events. - * @param src A [[scala.io.Source]] for XML data to parse - * - * @author Burak Emir - * @author Paul Phillips - */ -@deprecated("Consider javax.xml.stream.XMLEventReader instead.", "1.1.1") -class XMLEventReader(src: Source) - extends scala.collection.AbstractIterator[XMLEvent] - with ProducerConsumerIterator[XMLEvent] { - - // We implement a pull parser as an iterator, but since we may be operating on - // a stream (e.g. XML over a network) there may be arbitrarily long periods when - // the queue is empty. Fortunately the ProducerConsumerIterator is ideally - // suited to this task, possibly because it was written for use by this class. - - // to override as necessary - val preserveWS = true - - override val MaxQueueSize = 1000 - protected case object POISON extends XMLEvent - val EndOfStream = POISON - - // thread machinery - private[this] val parser = new Parser(src) - private[this] val parserThread = new Thread(parser, "XMLEventReader") - parserThread.start - // enqueueing the poison object is the reliable way to cause the - // iterator to terminate; hasNext will return false once it sees it. - // Calling interrupt() on the parserThread is the only way we can get - // it to stop producing tokens since it's lost deep in document() - - // we cross our fingers the interrupt() gets to its target, but if it - // fails for whatever reason the iterator correctness is not impacted, - // only performance (because it will finish the entire XML document, - // or at least as much as it can fit in the queue.) - def stop() = { - produce(POISON) - parserThread.interrupt() - } - - private class Parser(val input: Source) extends MarkupHandler with MarkupParser with ExternalSources with Runnable { - val preserveWS = XMLEventReader.this.preserveWS - // track level for elem memory usage optimization - private var level = 0 - - // this is Parser's way to add to the queue - the odd return type - // is to conform to MarkupHandler's interface - def setEvent(es: XMLEvent*): NodeSeq = { - es foreach produce - NodeSeq.Empty - } - - override def elemStart(pos: Int, pre: String, label: String, attrs: MetaData, scope: NamespaceBinding): Unit = { - level += 1 - setEvent(EvElemStart(pre, label, attrs, scope)) - } - override def elemEnd(pos: Int, pre: String, label: String): Unit = { - setEvent(EvElemEnd(pre, label)) - level -= 1 - } - - // this is a dummy to satisfy MarkupHandler's API - // memory usage optimization return one for top level to satisfy - // MarkupParser.document() otherwise NodeSeq.Empty - private var ignoreWritten = false - final def elem(pos: Int, pre: String, label: String, attrs: MetaData, pscope: NamespaceBinding, empty: Boolean, nodes: NodeSeq): NodeSeq = - if (level == 1 && !ignoreWritten) { ignoreWritten = true; } else NodeSeq.Empty - - def procInstr(pos: Int, target: String, txt: String) = setEvent(EvProcInstr(target, txt)) - def comment(pos: Int, txt: String) = setEvent(EvComment(txt)) - def entityRef(pos: Int, n: String) = setEvent(EvEntityRef(n)) - def text(pos: Int, txt: String) = setEvent(EvText(txt)) - - override def run(): Unit = { - curInput = input - try { - interruptibly { this.initialize.document() } - } catch { - case e:Exception => setEvent(ExceptionEvent(e)) - } - setEvent(POISON) - } - } -} - -// An internal class used to propagate exception from helper threads to API end users. -private case class ExceptionEvent(exception:Exception) extends XMLEvent - -// An iterator designed for one or more producers to generate -// elements, and a single consumer to iterate. Iteration will continue -// until closeIterator() is called, after which point producers -// calling produce() will receive interruptions. -// -// Since hasNext may block indefinitely if nobody is producing, -// there is also an available() method which will return true if -// the next call hasNext is guaranteed not to block. -// -// This is not thread-safe for multiple consumers! -trait ProducerConsumerIterator[T >: Null] extends Iterator[T] { - // abstract - iterator-specific distinguished object for marking eos - val EndOfStream: T - - // defaults to unbounded - override to positive Int if desired - val MaxQueueSize = -1 - - def interruptibly[A](body: => A): Option[A] = try Some(body) catch { - case _: InterruptedException => - Thread.currentThread.interrupt(); None - case _: ClosedChannelException => None - } - - private[this] lazy val queue = - if (MaxQueueSize < 0) new LinkedBlockingQueue[T]() - else new LinkedBlockingQueue[T](MaxQueueSize) - private[this] var buffer: T = _ - private def fillBuffer() = { - buffer = interruptibly(queue.take) getOrElse EndOfStream - isElement(buffer) - } - private def isElement(x: T) = x != null && x != EndOfStream - private def eos() = buffer == EndOfStream - - // public producer interface - this is the only method producers call, so - // LinkedBlockingQueue's synchronization is all we need. - def produce(x: T): Unit = if (!eos) interruptibly(queue put x) - - // consumer/iterator interface - we need not synchronize access to buffer - // because we required there to be only one consumer. - def hasNext = !eos && (buffer != null || fillBuffer) - - def next() = { - if (eos()) throw new NoSuchElementException("ProducerConsumerIterator") - if (buffer == null) fillBuffer() - if (buffer.isInstanceOf[ExceptionEvent]) throw buffer.asInstanceOf[ExceptionEvent].exception - - drainBuffer() - } - - def available() = isElement(buffer) || isElement(queue.peek) - - private def drainBuffer() = { - assert(!eos) - val res = buffer - buffer = null - res - } -} From 64857d562e085c09f3258b9e85876b6c44c61e8a Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Sun, 18 Mar 2018 18:42:25 -0400 Subject: [PATCH 302/789] Drop XMLEventReader from scala.xml.Properties.pickJarBasedOn --- shared/src/main/scala/scala/xml/XML.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shared/src/main/scala/scala/xml/XML.scala b/shared/src/main/scala/scala/xml/XML.scala index 90bebc93c..0e87530d9 100755 --- a/shared/src/main/scala/scala/xml/XML.scala +++ b/shared/src/main/scala/scala/xml/XML.scala @@ -117,5 +117,5 @@ object XML extends XMLLoader[Elem] { object Properties extends scala.util.PropertiesTrait { protected def propCategory = "scala-xml" - protected def pickJarBasedOn = classOf[scala.xml.pull.XMLEventReader] + protected def pickJarBasedOn = classOf[scala.xml.Node] } From 5b785db5094e03d4612f629653509b038de1646c Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Sun, 18 Mar 2018 18:43:00 -0400 Subject: [PATCH 303/789] Remove tests for XMLEventReader --- .../scala/xml/pull/XMLEventReaderTest.scala | 195 ------------------ 1 file changed, 195 deletions(-) delete mode 100644 jvm/src/test/scala/scala/xml/pull/XMLEventReaderTest.scala diff --git a/jvm/src/test/scala/scala/xml/pull/XMLEventReaderTest.scala b/jvm/src/test/scala/scala/xml/pull/XMLEventReaderTest.scala deleted file mode 100644 index 0c869d4f5..000000000 --- a/jvm/src/test/scala/scala/xml/pull/XMLEventReaderTest.scala +++ /dev/null @@ -1,195 +0,0 @@ -package scala.xml -package pull - -import org.junit.Test -import org.junit.Assert.{assertEquals,assertFalse, assertTrue} - -import scala.io.Source -import scala.xml.parsing.FatalError - -class XMLEventReaderTest { - - val src = Source.fromString("!") - - private def toSource(s: String) = new Source { - val iter = s.iterator - override def reportError(pos: Int, msg: String, out: java.io.PrintStream = Console.err): Unit = {} - } - - @Test - def pull: Unit = { - val er = new XMLEventReader(src) - assertTrue(er.next match { - case EvElemStart(_, "hello", _, _) => true - case _ => false - }) - assertTrue(er.next match { - case EvElemStart(_, "world", _, _) => true - case _ => false - }) - assertTrue(er.next match { - case EvElemEnd(_, "world") => true - case _ => false - }) - assertTrue(er.next match { - case EvText("!") => true - case _ => false - }) - assertTrue(er.next match { - case EvElemEnd(_, "hello") => true - case _ => false - }) - er.stop // allow thread to be garbage-collected - } - - @Test - def issue35: Unit = { - val broken = " - | - | - | - | - | - | - | - | - | - | - |""".stripMargin - - val er = new XMLEventReader(toSource(data)) - while(er.hasNext) er.next() - er.stop() - } - - @Test - def entityRefTest: Unit = { // SI-7796 - val source = Source.fromString(""'<>&") - val er = new XMLEventReader(source) - - assertTrue(er.next match { - case EvElemStart(_, "text", _, _) => true - case _ => false - }) - - assertEquals(EvEntityRef("quot"), er.next) - assertEquals(EvEntityRef("apos"), er.next) - assertEquals(EvEntityRef("lt"), er.next) - assertEquals(EvEntityRef("gt"), er.next) - assertEquals(EvEntityRef("amp"), er.next) - - assertTrue(er.next match { - case EvElemEnd(_, "text") => true - case _ => false - }) - - assertTrue(er.isEmpty) - } -} From bf2ed577b4d92e32b32875dbddbf3674f4801556 Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Sun, 18 Mar 2018 18:47:54 -0400 Subject: [PATCH 304/789] Drop pull.XMLEvent --- .../main/scala/scala/xml/pull/XMLEvent.scala | 61 ------------------- 1 file changed, 61 deletions(-) delete mode 100644 shared/src/main/scala/scala/xml/pull/XMLEvent.scala diff --git a/shared/src/main/scala/scala/xml/pull/XMLEvent.scala b/shared/src/main/scala/scala/xml/pull/XMLEvent.scala deleted file mode 100644 index 736d99e5a..000000000 --- a/shared/src/main/scala/scala/xml/pull/XMLEvent.scala +++ /dev/null @@ -1,61 +0,0 @@ -/* __ *\ -** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2019, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** -** /____/\___/_/ |_/____/_/ | | ** -** |/ ** -\* */ - -package scala -package xml -package pull - -/** - * An XML event for pull parsing. All events received during - * parsing will be one of the subclasses of this trait. - */ -@deprecated("Consider javax.xml.stream.events.XMLEvent instead.", "1.1.1") -trait XMLEvent - -/** - * An Element's start tag was encountered. - * @param pre prefix, if any, on the element. This is the `xs` in `foo`. - * @param label the name of the element, not including the prefix - * @param attrs any attributes on the element - */ -case class EvElemStart(pre: String, label: String, attrs: MetaData, scope: NamespaceBinding) extends XMLEvent - -/** - * An Element's end tag was encountered. - * @param pre prefix, if any, on the element. This is the `xs` in `foo`. - * @param label the name of the element, not including the prefix - */ -case class EvElemEnd(pre: String, label: String) extends XMLEvent - -/** - * A text node was encountered. - * @param text the text that was found - */ -case class EvText(text: String) extends XMLEvent - -/** - * An entity reference was encountered. - * @param entity the name of the entity, e.g. `gt` when encountering the entity `>` - */ -case class EvEntityRef(entity: String) extends XMLEvent - -/** - * A processing instruction was encountered. - * @param target the "PITarget" of the processing instruction. For the instruction ``, the target would - * be `foo` - * @param text the remainder of the instruction. For the instruction ``, the text would - * be `bar="baz"` - * @see [[http://www.w3.org/TR/REC-xml/#sec-pi]] - */ -case class EvProcInstr(target: String, text: String) extends XMLEvent - -/** - * A comment was encountered - * @param text the text of the comment - */ -case class EvComment(text: String) extends XMLEvent From 196af4004a554b586a8ee36ead63a653d52728ab Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Sun, 18 Mar 2018 18:49:20 -0400 Subject: [PATCH 305/789] Drop trait XMLEvent from Document and SpecialNode classes --- shared/src/main/scala/scala/xml/Document.scala | 2 +- shared/src/main/scala/scala/xml/SpecialNode.scala | 5 +---- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/shared/src/main/scala/scala/xml/Document.scala b/shared/src/main/scala/scala/xml/Document.scala index f36b28658..ccce9519b 100644 --- a/shared/src/main/scala/scala/xml/Document.scala +++ b/shared/src/main/scala/scala/xml/Document.scala @@ -20,7 +20,7 @@ import scala.collection.Seq * @author Burak Emir */ @SerialVersionUID(-2289320563321795109L) -class Document extends NodeSeq with pull.XMLEvent with Serializable { +class Document extends NodeSeq with Serializable { /** * An ordered list of child information items, in document diff --git a/shared/src/main/scala/scala/xml/SpecialNode.scala b/shared/src/main/scala/scala/xml/SpecialNode.scala index 0c2d90335..773aff9dc 100644 --- a/shared/src/main/scala/scala/xml/SpecialNode.scala +++ b/shared/src/main/scala/scala/xml/SpecialNode.scala @@ -13,12 +13,9 @@ package xml * `SpecialNode` is a special XML node which represents either text * `(PCDATA)`, a comment, a `PI`, or an entity ref. * - * `SpecialNode`s also play the role of [[scala.xml.pull.XMLEvent]]s for - * pull-parsing. - * * @author Burak Emir */ -abstract class SpecialNode extends Node with pull.XMLEvent { +abstract class SpecialNode extends Node { /** always empty */ final override def attributes = Null From 67ac459a6e31600ac9876eb7813554e9f6be5db9 Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Sun, 18 Mar 2018 18:49:33 -0400 Subject: [PATCH 306/789] Drop pull namespace --- .../main/scala/scala/xml/pull/package.scala | 50 ------------------- 1 file changed, 50 deletions(-) delete mode 100644 shared/src/main/scala/scala/xml/pull/package.scala diff --git a/shared/src/main/scala/scala/xml/pull/package.scala b/shared/src/main/scala/scala/xml/pull/package.scala deleted file mode 100644 index 38f23ef96..000000000 --- a/shared/src/main/scala/scala/xml/pull/package.scala +++ /dev/null @@ -1,50 +0,0 @@ -/* __ *\ -** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2019, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** -** /____/\___/_/ |_/____/_/ | | ** -** |/ ** -\* */ - -package scala -package xml - -/** - * Classes needed to view an XML document as a series of events. The document - * is parsed by an [[scala.xml.pull.XMLEventReader]] instance. You can treat it as - * an [[scala.collection.Iterator]] to retrieve the events, which are all - * subclasses of [[scala.xml.pull.XMLEvent]]. - * - * {{{ - * scala> val source = Source.fromString(""" - * - * - * ]>Hello&bar;>""") - * - * source: scala.io.Source = non-empty iterator - * - * scala> val reader = new XMLEventReader(source) - * reader: scala.xml.pull.XMLEventReader = non-empty iterator - * - * scala> reader.foreach{ println(_) } - * EvProcInstr(instruction,custom value="customvalue") - * EvText( - * ) - * EvElemStart(null,foo,,) - * EvText(Hello) - * EvComment( this is a comment ) - * EvElemStart(null,bar,,) - * EvText(BAR) - * EvElemEnd(null,bar) - * EvElemStart(null,bar,,) - * EvEntityRef(gt) - * EvElemEnd(null,bar) - * EvElemEnd(null,foo) - * EvText( - * - * ) - * - * }}} - */ -package object pull From a121f473bef32d89a458da2e8c4c298f41281005 Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Sun, 18 Mar 2018 18:50:21 -0400 Subject: [PATCH 307/789] Add mima exclude filters for XMLEventReader --- build.sbt | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index a18bc22bc..adf7dc93b 100644 --- a/build.sbt +++ b/build.sbt @@ -28,8 +28,40 @@ lazy val xml = crossProject(JSPlatform, JVMPlatform) import com.typesafe.tools.mima.core._ import com.typesafe.tools.mima.core.ProblemFilters._ Seq( + // scala-xml 1.1.1 deprecated XMLEventReader, so it broke + // binary compatibility for 2.0.0 in the following way: + exclude[MissingClassProblem]("scala.xml.pull.EvComment"), + exclude[MissingClassProblem]("scala.xml.pull.EvComment$"), + exclude[MissingClassProblem]("scala.xml.pull.EvElemEnd"), + exclude[MissingClassProblem]("scala.xml.pull.EvElemEnd$"), + exclude[MissingClassProblem]("scala.xml.pull.EvElemStart"), + exclude[MissingClassProblem]("scala.xml.pull.EvElemStart$"), + exclude[MissingClassProblem]("scala.xml.pull.EvEntityRef"), + exclude[MissingClassProblem]("scala.xml.pull.EvEntityRef$"), + exclude[MissingClassProblem]("scala.xml.pull.EvProcInstr"), + exclude[MissingClassProblem]("scala.xml.pull.EvProcInstr$"), + exclude[MissingClassProblem]("scala.xml.pull.EvText"), + exclude[MissingClassProblem]("scala.xml.pull.EvText$"), + exclude[MissingClassProblem]("scala.xml.pull.ExceptionEvent"), + exclude[MissingClassProblem]("scala.xml.pull.ExceptionEvent$"), + exclude[MissingClassProblem]("scala.xml.pull.ProducerConsumerIterator"), + exclude[MissingClassProblem]("scala.xml.pull.XMLEvent"), + exclude[MissingClassProblem]("scala.xml.pull.XMLEventReader"), + exclude[MissingClassProblem]("scala.xml.pull.XMLEventReader$POISON$"), + exclude[MissingClassProblem]("scala.xml.pull.XMLEventReader$Parser"), + exclude[MissingClassProblem]("scala.xml.pull.package"), + exclude[MissingClassProblem]("scala.xml.pull.package$"), + exclude[MissingTypesProblem]("scala.xml.Atom"), + exclude[MissingTypesProblem]("scala.xml.Comment"), + exclude[MissingTypesProblem]("scala.xml.Document"), + exclude[MissingTypesProblem]("scala.xml.EntityRef"), + exclude[MissingTypesProblem]("scala.xml.PCData"), + exclude[MissingTypesProblem]("scala.xml.ProcInstr"), + exclude[MissingTypesProblem]("scala.xml.SpecialNode"), + exclude[MissingTypesProblem]("scala.xml.Text"), + exclude[MissingTypesProblem]("scala.xml.Unparsed"), // Scala 2.12 deprecated mutable.Stack, so we broke - // binary compatibility for 1.1.0 in the following way: + // binary compatibility for 2.0.0 in the following way: exclude[IncompatibleMethTypeProblem]("scala.xml.parsing.FactoryAdapter.scopeStack_="), exclude[IncompatibleResultTypeProblem]("scala.xml.parsing.FactoryAdapter.hStack"), exclude[IncompatibleResultTypeProblem]("scala.xml.parsing.FactoryAdapter.scopeStack"), From 527629bbbdb0a6c8bbf67fcea55d122182eed570 Mon Sep 17 00:00:00 2001 From: Seth Tisue Date: Thu, 18 Apr 2019 06:48:35 -0700 Subject: [PATCH 308/789] drop references to Scala 2.10 from README --- README.md | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/README.md b/README.md index b35010889..29bee1ba2 100644 --- a/README.md +++ b/README.md @@ -8,18 +8,12 @@ scala-xml The standard Scala XML library. Please file XML issues here, not at https://github.com/scala/bug/issues. -Since Scala 2.11, this library is a separate jar that can be omitted from Scala projects that do not use XML. - -The decoupling works because the compiler desugars XML literals in Scala source code into a set of method calls. Alternative implementations of these calls are welcome! (The calls are unfortunately only defined by the [implementation](https://github.com/scala/scala/blob/2.11.x/src/compiler/scala/tools/nsc/ast/parser/SymbolicXMLBuilder.scala).) +The decoupling of scala-xml from the Scala compiler and standard library is possible because the compiler desugars XML literals in Scala source code into a set of method calls. Alternative implementations of these calls are welcome! (The calls are unfortunately only defined by the [implementation](https://github.com/scala/scala/blob/2.11.x/src/compiler/scala/tools/nsc/ast/parser/SymbolicXMLBuilder.scala).) API documentation is available [here](https://scala.github.io/scala-xml/api/1.2.0/scala/xml/). How to documentation is available in the [wiki](https://github.com/scala/scala-xml/wiki) -## Cross-building with 2.10 - -If you are cross-building a project that uses scala-xml with both Scala 2.10 and later Scala versions, take a look at [this example](https://github.com/scala/scala-module-dependency-sample). - ## Maintenance status This library is community-maintained. The lead maintainer is [@aaron_s_hawley](https://github.com/ashawley). From b189eb1655cd5f71d1f7fab20586d071c5a3ccc1 Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Fri, 19 Apr 2019 11:11:50 -0400 Subject: [PATCH 309/789] Bump version to 2.0 --- build.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index adf7dc93b..5a6058d0d 100644 --- a/build.sbt +++ b/build.sbt @@ -11,7 +11,7 @@ lazy val xml = crossProject(JSPlatform, JVMPlatform) .jvmSettings(scalaModuleSettingsJVM) .settings( name := "scala-xml", - version := "1.2.1-SNAPSHOT", + version := "2.0.0-SNAPSHOT", // this line could be removed after https://github.com/scala/sbt-scala-module/issues/48 is fixed licenses := Seq(("Apache-2.0", url("https://www.apache.org/licenses/LICENSE-2.0"))), From c92721c0bbd63dca1875adc167cacccc1ec1d7e9 Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Fri, 19 Apr 2019 11:13:44 -0400 Subject: [PATCH 310/789] Simplify sbt cache in Travis https://www.scala-sbt.org/1.0/docs/Travis-CI-with-sbt.html --- .travis.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index bef7d95db..fdce39d4f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -38,5 +38,4 @@ before_cache: cache: directories: - $HOME/.ivy2/cache - - $HOME/.sbt/boot - - $HOME/.sbt/launchers + - $HOME/.sbt From abe6e29954d7af1ea1be41294e33e5de32754735 Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Fri, 19 Apr 2019 11:53:25 -0400 Subject: [PATCH 311/789] Remove explicit license setting Inherit from sbt-scala-module --- build.sbt | 3 --- 1 file changed, 3 deletions(-) diff --git a/build.sbt b/build.sbt index 5a6058d0d..a00dfe860 100644 --- a/build.sbt +++ b/build.sbt @@ -13,9 +13,6 @@ lazy val xml = crossProject(JSPlatform, JVMPlatform) name := "scala-xml", version := "2.0.0-SNAPSHOT", - // this line could be removed after https://github.com/scala/sbt-scala-module/issues/48 is fixed - licenses := Seq(("Apache-2.0", url("https://www.apache.org/licenses/LICENSE-2.0"))), - // Compiler team advised avoiding the -Xfuture option for releases. // The output with -Xfuture should be periodically checked, though. scalacOptions ++= "-deprecation:false -feature -Xlint:-stars-align,-nullary-unit,_".split("\\s+").to[Seq], From 514a72377bf3a2d3e3acc1263130dc07d251035a Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Fri, 19 Apr 2019 12:07:09 -0400 Subject: [PATCH 312/789] Fix Java 11 API mappings --- build.sbt | 6 +++--- shared/src/main/scala/scala/xml/package.scala | 3 --- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/build.sbt b/build.sbt index a00dfe860..744937ce8 100644 --- a/build.sbt +++ b/build.sbt @@ -90,12 +90,12 @@ lazy val xml = crossProject(JSPlatform, JVMPlatform) -> url("http://docs.oracle.com/javase/8/docs/api") ) } getOrElse { - // If everything fails, jam in the Java 9 base module. + // If everything fails, jam in Java 11 modules. Map( file("/modules/java.base") - -> url("http://docs.oracle.com/javase/9/docs/api"), + -> url("https://docs.oracle.com/en/java/javase/11/docs/api/java.base"), file("/modules/java.xml") - -> url("http://docs.oracle.com/javase/9/docs/api") + -> url("https://docs.oracle.com/en/java/javase/11/docs/api/java.xml") ) } } diff --git a/shared/src/main/scala/scala/xml/package.scala b/shared/src/main/scala/scala/xml/package.scala index dff58146d..4bd95cfef 100644 --- a/shared/src/main/scala/scala/xml/package.scala +++ b/shared/src/main/scala/scala/xml/package.scala @@ -56,9 +56,6 @@ package scala * [[http://xerces.apache.org/ Xerces]] parser and is provided in Java * by [[javax.xml.parsers.SAXParser]]. * - * A less greedy XML reader can return data as a sequential collection - * of events, see [[scala.xml.pull.XMLEventReader]]. - * * For more control of the input, use the parser written in Scala that * is provided, [[scala.xml.parsing.ConstructingParser]]. * From 3f75e6902b2fe4d184f0e3f0b7a8ab8eca4831bd Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Fri, 19 Apr 2019 13:15:55 -0400 Subject: [PATCH 313/789] The -Xfuture option was deprecated --- build.sbt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build.sbt b/build.sbt index 744937ce8..e81f74f45 100644 --- a/build.sbt +++ b/build.sbt @@ -13,8 +13,8 @@ lazy val xml = crossProject(JSPlatform, JVMPlatform) name := "scala-xml", version := "2.0.0-SNAPSHOT", - // Compiler team advised avoiding the -Xfuture option for releases. - // The output with -Xfuture should be periodically checked, though. + // Compiler team advised avoiding the -Xsource:2.14 option for releases. + // The output with -Xsource should be periodically checked, though. scalacOptions ++= "-deprecation:false -feature -Xlint:-stars-align,-nullary-unit,_".split("\\s+").to[Seq], scalacOptions in Test += "-Xxml:coalescing", From 1e247101d19415698ae80fa0df6295c2a122091d Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Mon, 22 Apr 2019 09:48:01 -0400 Subject: [PATCH 314/789] Fix deprecation doc of Stack in FactoryAdapter --- .../src/main/scala/scala/xml/parsing/FactoryAdapter.scala | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/shared/src/main/scala/scala/xml/parsing/FactoryAdapter.scala b/shared/src/main/scala/scala/xml/parsing/FactoryAdapter.scala index 608646f2a..11db0ac61 100644 --- a/shared/src/main/scala/scala/xml/parsing/FactoryAdapter.scala +++ b/shared/src/main/scala/scala/xml/parsing/FactoryAdapter.scala @@ -43,28 +43,28 @@ abstract class FactoryAdapter extends DefaultHandler with factory.XMLLoader[Node * * Previously was a mutable [[scala.collection.mutable.Stack Stack]], but is now a mutable reference to an immutable [[scala.collection.immutable.List List]]. * - * @since 1.1.0 + * @since 2.0.0 */ var attribStack = List.empty[MetaData] /** List of elements * * Previously was a mutable [[scala.collection.mutable.Stack Stack]], but is now a mutable reference to an immutable [[scala.collection.immutable.List List]]. * - * @since 1.1.0 + * @since 2.0.0 */ var hStack = List.empty[Node] // [ element ] contains siblings /** List of element names * * Previously was a mutable [[scala.collection.mutable.Stack Stack]], but is now a mutable reference to an immutable [[scala.collection.immutable.List List]]. * - * @since 1.1.0 + * @since 2.0.0 */ var tagStack = List.empty[String] /** List of namespaces * * Previously was a mutable [[scala.collection.mutable.Stack Stack]], but is now a mutable reference to an immutable [[scala.collection.immutable.List List]]. * - * @since 1.1.0 + * @since 2.0.0 */ var scopeStack = List.empty[NamespaceBinding] From eaf1532664c74694a4c938417c094fa05b511324 Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Mon, 22 Apr 2019 09:36:00 -0400 Subject: [PATCH 315/789] XML attributes parsed in reverse order --- .../test/scala/scala/xml/AttributeTest.scala | 37 +++++++++++++++++++ .../xml/parsing/ConstructingParserTest.scala | 10 +++++ .../src/main/scala/scala/xml/MetaData.scala | 5 +++ .../scala/xml/parsing/FactoryAdapter.scala | 2 +- .../scala/xml/parsing/MarkupParser.scala | 2 +- .../test/scala/scala/xml/AttributeTest.scala | 5 +++ .../test/scala/scala/xml/MetaDataTest.scala | 7 ++++ .../test/scala/scala/xml/UtilityTest.scala | 2 + 8 files changed, 68 insertions(+), 2 deletions(-) create mode 100644 jvm/src/test/scala/scala/xml/AttributeTest.scala diff --git a/jvm/src/test/scala/scala/xml/AttributeTest.scala b/jvm/src/test/scala/scala/xml/AttributeTest.scala new file mode 100644 index 000000000..11511d1d0 --- /dev/null +++ b/jvm/src/test/scala/scala/xml/AttributeTest.scala @@ -0,0 +1,37 @@ +package scala.xml + +import org.junit.Test +import org.junit.Assert.assertEquals +import org.junit.Assert.assertNotEquals + +class AttributeTestJVM { + + @Test + def attributeOrder: Unit = { + val x = + assertEquals("""""", x.toString) + } + + @Test + def attributesFromString: Unit = { + val str = """""" + val doc = XML.loadString(str) + assertEquals(str, doc.toString) + } + + @Test + def attributesAndNamespaceFromString: Unit = { + val str = """""" + val doc = XML.loadString(str) + assertNotEquals(str, doc.toString) + val str2 = """""" + val doc2 = XML.loadString(str2) + assertEquals(str2, doc2.toString) + } + + @Test(expected=classOf[SAXParseException]) + def attributesFromStringWithDuplicate: Unit = { + val str = """""" + XML.loadString(str) + } +} diff --git a/jvm/src/test/scala/scala/xml/parsing/ConstructingParserTest.scala b/jvm/src/test/scala/scala/xml/parsing/ConstructingParserTest.scala index 4a8cf3134..7dfa33b6b 100644 --- a/jvm/src/test/scala/scala/xml/parsing/ConstructingParserTest.scala +++ b/jvm/src/test/scala/scala/xml/parsing/ConstructingParserTest.scala @@ -71,4 +71,14 @@ class ConstructingParserTest { ConstructingParser.fromSource(source, true).content(TopScope) } + + @Test + def SI6341issue65: Unit = { + val str = """""" + val cpa = ConstructingParser.fromSource(io.Source.fromString(str), preserveWS = true) + val cpadoc = cpa.document() + val ppr = new PrettyPrinter(80,5) + val out = ppr.format(cpadoc.docElem) + assertEquals(str, out) + } } diff --git a/shared/src/main/scala/scala/xml/MetaData.scala b/shared/src/main/scala/scala/xml/MetaData.scala index ee6824b03..a856c5c39 100644 --- a/shared/src/main/scala/scala/xml/MetaData.scala +++ b/shared/src/main/scala/scala/xml/MetaData.scala @@ -155,6 +155,11 @@ abstract class MetaData if (f(this)) copy(next filter f) else next filter f + def reverse: MetaData = + foldLeft(Null: MetaData) { (x, xs) => + xs.copy(x) + } + /** returns key of this MetaData item */ def key: String diff --git a/shared/src/main/scala/scala/xml/parsing/FactoryAdapter.scala b/shared/src/main/scala/scala/xml/parsing/FactoryAdapter.scala index 11db0ac61..1c46d7283 100644 --- a/shared/src/main/scala/scala/xml/parsing/FactoryAdapter.scala +++ b/shared/src/main/scala/scala/xml/parsing/FactoryAdapter.scala @@ -158,7 +158,7 @@ abstract class FactoryAdapter extends DefaultHandler with factory.XMLLoader[Node if (scopeStack.isEmpty) TopScope else scopeStack.head - for (i <- 0 until attributes.getLength()) { + for (i <- (0 until attributes.getLength).reverse) { val qname = attributes getQName i val value = attributes getValue i val (pre, key) = splitName(qname) diff --git a/shared/src/main/scala/scala/xml/parsing/MarkupParser.scala b/shared/src/main/scala/scala/xml/parsing/MarkupParser.scala index 3ddc626b2..33717ce71 100755 --- a/shared/src/main/scala/scala/xml/parsing/MarkupParser.scala +++ b/shared/src/main/scala/scala/xml/parsing/MarkupParser.scala @@ -339,7 +339,7 @@ trait MarkupParser extends MarkupParserCommon with TokenTests { if (!aMap.wellformed(scope)) reportSyntaxError("double attribute") - (aMap, scope) + (aMap.reverse, scope) } /** diff --git a/shared/src/test/scala/scala/xml/AttributeTest.scala b/shared/src/test/scala/scala/xml/AttributeTest.scala index 285d24795..159946231 100644 --- a/shared/src/test/scala/scala/xml/AttributeTest.scala +++ b/shared/src/test/scala/scala/xml/AttributeTest.scala @@ -49,6 +49,11 @@ class AttributeTest { } @Test + def attributeOrder: Unit = { + val x = + assertEquals("""""", x.toString) + } + def attributeToString: Unit = { val expected: String = """""" assertEquals(expected, ().toString) diff --git a/shared/src/test/scala/scala/xml/MetaDataTest.scala b/shared/src/test/scala/scala/xml/MetaDataTest.scala index 87be69b82..d6bacc0ef 100644 --- a/shared/src/test/scala/scala/xml/MetaDataTest.scala +++ b/shared/src/test/scala/scala/xml/MetaDataTest.scala @@ -54,4 +54,11 @@ class MetaDataTest { assertEquals(new Atom(3), domatch(z2)) } + @Test + def reverseTest: Unit = { + assertEquals("", Null.reverse.toString) + assertEquals(""" b="c"""", .attributes.reverse.toString) + assertEquals(""" d="e" b="c"""", .attributes.reverse.toString) + } + } diff --git a/shared/src/test/scala/scala/xml/UtilityTest.scala b/shared/src/test/scala/scala/xml/UtilityTest.scala index a27fb0b1a..765b9bad8 100644 --- a/shared/src/test/scala/scala/xml/UtilityTest.scala +++ b/shared/src/test/scala/scala/xml/UtilityTest.scala @@ -38,6 +38,8 @@ class UtilityTest { @Test def sort: Unit = { + assertEquals("", xml.Utility.sort(.attributes).toString) + assertEquals(""" b="c"""", xml.Utility.sort(.attributes).toString) val q = xml.Utility.sort() assertEquals(" a=\"2\" g=\"3\" j=\"2\" oo=\"2\"", xml.Utility.sort(q.attributes).toString) val pp = new xml.PrettyPrinter(80,5) From 3275e2bea969993f58b0dc6bface77766c027637 Mon Sep 17 00:00:00 2001 From: Seth Tisue Date: Mon, 22 Apr 2019 19:42:58 -0700 Subject: [PATCH 316/789] add NOTICE and CODE_OF_CONDUCT files --- CODE_OF_CONDUCT.md | 7 +++++++ NOTICE | 14 ++++++++++++++ 2 files changed, 21 insertions(+) create mode 100644 CODE_OF_CONDUCT.md create mode 100644 NOTICE diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md new file mode 100644 index 000000000..0511f2126 --- /dev/null +++ b/CODE_OF_CONDUCT.md @@ -0,0 +1,7 @@ +all repositories in these organizations: + +* [scala](https://github.com/scala) +* [scalacenter](https://github.com/scalacenter) +* [lampepfl](https://github.com/lampepfl) + +are covered by the Scala Code of Conduct: https://scala-lang.org/conduct/ diff --git a/NOTICE b/NOTICE new file mode 100644 index 000000000..8d1b2d704 --- /dev/null +++ b/NOTICE @@ -0,0 +1,14 @@ +scala-xml +Copyright (c) 2002-2019 EPFL +Copyright (c) 2011-2019 Lightbend, Inc. + +scala-xml includes software developed at +LAMP/EPFL (https://lamp.epfl.ch/) and +Lightbend, Inc. (https://www.lightbend.com/). + +Licensed under the Apache License, Version 2.0 (the "License"). +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. From 061aea9a4960f7f6f71542b79951672023bcd930 Mon Sep 17 00:00:00 2001 From: Philippus Date: Tue, 23 Apr 2019 09:52:33 +0200 Subject: [PATCH 317/789] Rename unmanaged source directories --- build.sbt | 4 ++-- .../scala/xml/ScalaVersionSpecific.scala | 0 .../scala/xml/ScalaVersionSpecific.scala | 0 3 files changed, 2 insertions(+), 2 deletions(-) rename shared/src/main/{scala-2.13 => scala-2.13+}/scala/xml/ScalaVersionSpecific.scala (100%) rename shared/src/main/{scala-2.11-2.12 => scala-2.13-}/scala/xml/ScalaVersionSpecific.scala (100%) diff --git a/build.sbt b/build.sbt index e81f74f45..2a096192e 100644 --- a/build.sbt +++ b/build.sbt @@ -71,8 +71,8 @@ lazy val xml = crossProject(JSPlatform, JVMPlatform) (unmanagedSourceDirectories in Compile).value.map { dir => val sv = scalaVersion.value CrossVersion.partialVersion(sv) match { - case Some((2, 13)) => file(dir.getPath ++ "-2.13") - case _ => file(dir.getPath ++ "-2.11-2.12") + case Some((2, 13)) => file(dir.getPath ++ "-2.13+") + case _ => file(dir.getPath ++ "-2.13-") } } }, diff --git a/shared/src/main/scala-2.13/scala/xml/ScalaVersionSpecific.scala b/shared/src/main/scala-2.13+/scala/xml/ScalaVersionSpecific.scala similarity index 100% rename from shared/src/main/scala-2.13/scala/xml/ScalaVersionSpecific.scala rename to shared/src/main/scala-2.13+/scala/xml/ScalaVersionSpecific.scala diff --git a/shared/src/main/scala-2.11-2.12/scala/xml/ScalaVersionSpecific.scala b/shared/src/main/scala-2.13-/scala/xml/ScalaVersionSpecific.scala similarity index 100% rename from shared/src/main/scala-2.11-2.12/scala/xml/ScalaVersionSpecific.scala rename to shared/src/main/scala-2.13-/scala/xml/ScalaVersionSpecific.scala From 3f9ab5e9c15e4bf1fe856e999daceae733f4cd9d Mon Sep 17 00:00:00 2001 From: Philippus Date: Tue, 23 Apr 2019 18:21:43 +0200 Subject: [PATCH 318/789] Import undeprecated crossProject --- build.sbt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index 2a096192e..3b1f0e104 100644 --- a/build.sbt +++ b/build.sbt @@ -1,4 +1,5 @@ -import sbtcrossproject.{crossProject, CrossType} +import sbtcrossproject.CrossType +import sbtcrossproject.CrossPlugin.autoImport.crossProject import ScalaModulePlugin._ crossScalaVersions in ThisBuild := List("2.12.8", "2.13.0-RC1") From 8d6fe784760fa98f703dcd382d552b021c1cd35a Mon Sep 17 00:00:00 2001 From: Philippus Date: Tue, 23 Apr 2019 18:22:18 +0200 Subject: [PATCH 319/789] Replace filter+headOption with find --- build.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index 3b1f0e104..368da6d0b 100644 --- a/build.sbt +++ b/build.sbt @@ -84,7 +84,7 @@ lazy val xml = crossProject(JSPlatform, JVMPlatform) ) ++ { // http://stackoverflow.com/questions/16934488 Option(System.getProperty("sun.boot.class.path")).flatMap { classPath => - classPath.split(java.io.File.pathSeparator).filter(_.endsWith(java.io.File.separator + "rt.jar")).headOption + classPath.split(java.io.File.pathSeparator).find(_.endsWith(java.io.File.separator + "rt.jar")) }.map { jarPath => Map( file(jarPath) From 74ba82633348e4027bf863aad8763f9eeeff6256 Mon Sep 17 00:00:00 2001 From: Philippus Date: Tue, 23 Apr 2019 18:22:44 +0200 Subject: [PATCH 320/789] Use type-safe scope configuration --- build.sbt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/build.sbt b/build.sbt index 368da6d0b..a284f9e2d 100644 --- a/build.sbt +++ b/build.sbt @@ -104,10 +104,10 @@ lazy val xml = crossProject(JSPlatform, JVMPlatform) .jvmSettings( OsgiKeys.exportPackage := Seq(s"scala.xml.*;version=${version.value}"), - libraryDependencies += "junit" % "junit" % "4.12" % "test", - libraryDependencies += "com.novocode" % "junit-interface" % "0.11" % "test", - libraryDependencies += "org.apache.commons" % "commons-lang3" % "3.9" % "test", - libraryDependencies += ("org.scala-lang" % "scala-compiler" % scalaVersion.value % "test").exclude("org.scala-lang.modules", s"scala-xml_${scalaBinaryVersion.value}") + libraryDependencies += "junit" % "junit" % "4.12" % Test, + libraryDependencies += "com.novocode" % "junit-interface" % "0.11" % Test, + libraryDependencies += "org.apache.commons" % "commons-lang3" % "3.9" % Test, + libraryDependencies += ("org.scala-lang" % "scala-compiler" % scalaVersion.value % Test).exclude("org.scala-lang.modules", s"scala-xml_${scalaBinaryVersion.value}") ) .jsSettings( // Scala.js cannot run forked tests From 51e736d71126b8c82ebc5c356a4b2900979a1279 Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Tue, 23 Apr 2019 06:31:59 -0400 Subject: [PATCH 321/789] The procedure syntax is deprecated Instead, add `: Unit =` to explicitly declare return type. --- jvm/src/test/scala/scala/xml/XMLTest.scala | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/jvm/src/test/scala/scala/xml/XMLTest.scala b/jvm/src/test/scala/scala/xml/XMLTest.scala index 11387171b..8266d9b18 100644 --- a/jvm/src/test/scala/scala/xml/XMLTest.scala +++ b/jvm/src/test/scala/scala/xml/XMLTest.scala @@ -820,55 +820,55 @@ class XMLTestJVM { } @UnitTest - def xTokenTest { + def xTokenTest: Unit = { val x = xml.parsing.ConstructingParser.fromSource(toSource("a"), false) assertEquals((): Unit, x.xToken('b')) } @UnitTest(expected = classOf[FatalError]) - def xCharDataFailure { + def xCharDataFailure: Unit = { val x = xml.parsing.ConstructingParser.fromSource(toSource(""), false) x.xCharData } @UnitTest(expected = classOf[FatalError]) - def xCommentFailure { + def xCommentFailure: Unit = { val x = xml.parsing.ConstructingParser.fromSource(toSource(""), false) x.xComment } @UnitTest - def xmlProcInstrTest { + def xmlProcInstrTest: Unit = { val x = xml.parsing.ConstructingParser.fromSource(toSource("aa"), false) assertEquals(new UnprefixedAttribute("aa", Text(""), Null), x.xmlProcInstr) } @UnitTest(expected = classOf[FatalError]) - def notationDeclFailure { + def notationDeclFailure: Unit = { val x = xml.parsing.ConstructingParser.fromSource(toSource(""), false) x.notationDecl } @UnitTest - def pubidLiteralTest { + def pubidLiteralTest: Unit = { val x = xml.parsing.ConstructingParser.fromSource(toSource(""), false) assertEquals("", x.pubidLiteral) } @UnitTest - def xAttributeValueTest { + def xAttributeValueTest: Unit = { val x = xml.parsing.ConstructingParser.fromSource(toSource("'"), false) assertEquals("", x.xAttributeValue) } @UnitTest - def xEntityValueTest { + def xEntityValueTest: Unit = { val x = xml.parsing.ConstructingParser.fromSource(toSource(""), false) assertEquals("", x.xEntityValue) From 58c563fe11dff150464197969155c49c0fffc4d6 Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Tue, 23 Apr 2019 06:34:45 -0400 Subject: [PATCH 322/789] Method + in class Char is deprecated (since 2.13.0) Adding a number and a String is deprecated. Use the string interpolation `s"$num$str"` --- shared/src/main/scala/scala/xml/dtd/ExternalID.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shared/src/main/scala/scala/xml/dtd/ExternalID.scala b/shared/src/main/scala/scala/xml/dtd/ExternalID.scala index 1d546ca97..87356a1b1 100644 --- a/shared/src/main/scala/scala/xml/dtd/ExternalID.scala +++ b/shared/src/main/scala/scala/xml/dtd/ExternalID.scala @@ -18,7 +18,7 @@ package dtd sealed abstract class ExternalID extends parsing.TokenTests { def quoted(s: String) = { val c = if (s contains '"') '\'' else '"' - c + s + c + c.toString + s + c } // public != null: PUBLIC " " publicLiteral " " [systemLiteral] From e029ac15390dd130d60b72bd0225cd5e6c3c4bf7 Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Tue, 23 Apr 2019 06:35:01 -0400 Subject: [PATCH 323/789] Passing an explicit array value to a varargs method This is deprecated (since 2.13.0) and will result in a defensive copy; Use the more efficient non-copying ArraySeq.unsafeWrapArray or an explicit toIndexedSeq call --- shared/src/main/scala/scala/xml/dtd/impl/DetWordAutom.scala | 2 +- shared/src/main/scala/scala/xml/dtd/impl/WordBerrySethi.scala | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/shared/src/main/scala/scala/xml/dtd/impl/DetWordAutom.scala b/shared/src/main/scala/scala/xml/dtd/impl/DetWordAutom.scala index e44285c81..fe0b66c0e 100644 --- a/shared/src/main/scala/scala/xml/dtd/impl/DetWordAutom.scala +++ b/shared/src/main/scala/scala/xml/dtd/impl/DetWordAutom.scala @@ -34,7 +34,7 @@ private[dtd] abstract class DetWordAutom[T <: AnyRef] { val sb = new StringBuilder("[DetWordAutom nstates=") sb.append(nstates) sb.append(" finals=") - val map = Map(finals.zipWithIndex map (_.swap): _*) + val map = finals.zipWithIndex.map(_.swap).toMap sb.append(map.toString()) sb.append(" delta=\n") diff --git a/shared/src/main/scala/scala/xml/dtd/impl/WordBerrySethi.scala b/shared/src/main/scala/scala/xml/dtd/impl/WordBerrySethi.scala index 2fef5b9a8..7ec77ad56 100644 --- a/shared/src/main/scala/scala/xml/dtd/impl/WordBerrySethi.scala +++ b/shared/src/main/scala/scala/xml/dtd/impl/WordBerrySethi.scala @@ -144,7 +144,7 @@ private[dtd] abstract class WordBerrySethi extends BaseBerrySethi { if (x.isNullable) // initial state is final finals = finals.updated(0, finalTag) - val delta1 = immutable.Map(deltaq.zipWithIndex map (_.swap): _*) + val delta1 = deltaq.zipWithIndex.map(_.swap).toMap val finalsArr = (0 until pos map (k => finals.getOrElse(k, 0))).toArray // 0 == not final val deltaArr: Array[mutable.Map[_labelT, immutable.BitSet]] = From ec593f03ddc2d70ab2e3fb58e8bce051eb23a7b3 Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Tue, 23 Apr 2019 06:35:10 -0400 Subject: [PATCH 324/789] Predef.tuple2ToZippedOps is deprecated use xs.lazyZip(ys) Will need to use xs.zip(ys) in scala-xml, instead. --- jvm/src/test/scala/scala/xml/ReuseNodesTest.scala | 2 +- .../src/main/scala/scala/xml/transform/BasicTransformer.scala | 2 +- .../xml/{PatternMatching.scala => PatternMatchingTest.scala} | 2 +- .../scala/xml/{Transformers.scala => TransformersTest.scala} | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) rename shared/src/test/scala/scala/xml/{PatternMatching.scala => PatternMatchingTest.scala} (98%) rename shared/src/test/scala/scala/xml/{Transformers.scala => TransformersTest.scala} (98%) diff --git a/jvm/src/test/scala/scala/xml/ReuseNodesTest.scala b/jvm/src/test/scala/scala/xml/ReuseNodesTest.scala index f419a1de4..5d38d74e2 100644 --- a/jvm/src/test/scala/scala/xml/ReuseNodesTest.scala +++ b/jvm/src/test/scala/scala/xml/ReuseNodesTest.scala @@ -32,7 +32,7 @@ object ReuseNodesTest { override def transform(ns: Seq[Node]): Seq[Node] = { val changed = ns flatMap transform - if (changed.length != ns.length || (changed, ns).zipped.exists(_ != _)) changed + if (changed.length != ns.length || changed.zip(ns).exists(p => p._1 != p._2)) changed else ns } override def transform(n:Node): Seq[Node] = super.transform(n) diff --git a/shared/src/main/scala/scala/xml/transform/BasicTransformer.scala b/shared/src/main/scala/scala/xml/transform/BasicTransformer.scala index 02e333d7c..707468ab9 100644 --- a/shared/src/main/scala/scala/xml/transform/BasicTransformer.scala +++ b/shared/src/main/scala/scala/xml/transform/BasicTransformer.scala @@ -34,7 +34,7 @@ abstract class BasicTransformer extends Function1[Node, Node] { */ def transform(ns: Seq[Node]): Seq[Node] = { val changed = ns flatMap transform - if (changed.length != ns.length || (changed, ns).zipped.exists(_ != _)) changed + if (changed.length != ns.length || changed.zip(ns).exists(p => p._1 != p._2)) changed else ns } diff --git a/shared/src/test/scala/scala/xml/PatternMatching.scala b/shared/src/test/scala/scala/xml/PatternMatchingTest.scala similarity index 98% rename from shared/src/test/scala/scala/xml/PatternMatching.scala rename to shared/src/test/scala/scala/xml/PatternMatchingTest.scala index 32d4b9b78..6f241464a 100644 --- a/shared/src/test/scala/scala/xml/PatternMatching.scala +++ b/shared/src/test/scala/scala/xml/PatternMatchingTest.scala @@ -5,7 +5,7 @@ import org.junit.Test import org.junit.Assert.assertTrue import org.junit.Assert.assertEquals -class PatternMatching extends { +class PatternMatchingTest extends { @Test def unprefixedAttribute: Unit = { val li = List("1", "2", "3", "4") diff --git a/shared/src/test/scala/scala/xml/Transformers.scala b/shared/src/test/scala/scala/xml/TransformersTest.scala similarity index 98% rename from shared/src/test/scala/scala/xml/Transformers.scala rename to shared/src/test/scala/scala/xml/TransformersTest.scala index 146a480a3..59ca25240 100644 --- a/shared/src/test/scala/scala/xml/Transformers.scala +++ b/shared/src/test/scala/scala/xml/TransformersTest.scala @@ -6,7 +6,7 @@ import scala.xml.transform._ import org.junit.Test import org.junit.Assert.assertEquals -class Transformers { +class TransformersTest { def transformer = new RuleTransformer(new RewriteRule { From 74be3f59e854c089d1b4747d2c7c7beb0c9bbb25 Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Thu, 16 May 2019 11:01:44 -0400 Subject: [PATCH 325/789] Use 2.13.0-RC2 release candidate --- .travis.yml | 2 +- README.md | 2 +- build.sbt | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index fdce39d4f..432ad3902 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,7 +6,7 @@ jdk: scala: - 2.12.8 - - 2.13.0-RC1 + - 2.13.0-RC2 env: global: diff --git a/README.md b/README.md index 29bee1ba2..f17c1947d 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ scala-xml [![Travis](https://img.shields.io/travis/scala/scala-xml.svg)](https://travis-ci.org/scala/scala-xml) [![latest release for 2.11](https://img.shields.io/maven-central/v/org.scala-lang.modules/scala-xml_2.11.svg?label=scala+2.11)](http://mvnrepository.com/artifact/org.scala-lang.modules/scala-xml_2.11) [![latest release for 2.12](https://img.shields.io/maven-central/v/org.scala-lang.modules/scala-xml_2.12.svg?label=scala+2.12)](http://mvnrepository.com/artifact/org.scala-lang.modules/scala-xml_2.12) -[![latest release for 2.13.0-RC1](https://img.shields.io/maven-central/v/org.scala-lang.modules/scala-xml_2.13.0-RC1.svg?label=scala+2.13.0-RC1)](http://mvnrepository.com/artifact/org.scala-lang.modules/scala-xml_2.13.0-RC1) +[![latest release for 2.13.0-RC2](https://img.shields.io/maven-central/v/org.scala-lang.modules/scala-xml_2.13.0-RC2.svg?label=scala+2.13.0-RC2)](http://mvnrepository.com/artifact/org.scala-lang.modules/scala-xml_2.13.0-RC2) [![Gitter](https://badges.gitter.im/Join+Chat.svg)](https://gitter.im/scala/scala-xml) ========= diff --git a/build.sbt b/build.sbt index a284f9e2d..eb8e6722d 100644 --- a/build.sbt +++ b/build.sbt @@ -2,7 +2,7 @@ import sbtcrossproject.CrossType import sbtcrossproject.CrossPlugin.autoImport.crossProject import ScalaModulePlugin._ -crossScalaVersions in ThisBuild := List("2.12.8", "2.13.0-RC1") +crossScalaVersions in ThisBuild := List("2.12.8", "2.13.0-RC2") lazy val xml = crossProject(JSPlatform, JVMPlatform) .withoutSuffixFor(JVMPlatform) From bd75ba8730b13783a3d21bb7d8cb0e889a4bbb97 Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Thu, 16 May 2019 11:30:09 -0400 Subject: [PATCH 326/789] Update build to sbt 1.3.0-RC1 --- project/build.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/build.properties b/project/build.properties index c0bab0494..c66f82ead 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version=1.2.8 +sbt.version=1.3.0-RC1 From 59ff6c004a414a6c29fec827e5b8962f71443e29 Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Thu, 16 May 2019 11:01:44 -0400 Subject: [PATCH 327/789] Use 2.13.0-RC2 release candidate --- .travis.yml | 4 ++-- README.md | 2 +- build.sbt | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index ee9554c29..1a54e7573 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,7 +16,7 @@ jdk: scala: - 2.11.12 - 2.12.8 - - 2.13.0-RC1 + - 2.13.0-RC2 env: global: @@ -46,7 +46,7 @@ matrix: jdk: openjdk11 - scala: 2.12.8 jdk: openjdk6 - - scala: 2.13.0-RC1 + - scala: 2.13.0-RC2 jdk: openjdk6 before_script: diff --git a/README.md b/README.md index b35010889..9eaf06872 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ scala-xml [![Travis](https://img.shields.io/travis/scala/scala-xml.svg)](https://travis-ci.org/scala/scala-xml) [![latest release for 2.11](https://img.shields.io/maven-central/v/org.scala-lang.modules/scala-xml_2.11.svg?label=scala+2.11)](http://mvnrepository.com/artifact/org.scala-lang.modules/scala-xml_2.11) [![latest release for 2.12](https://img.shields.io/maven-central/v/org.scala-lang.modules/scala-xml_2.12.svg?label=scala+2.12)](http://mvnrepository.com/artifact/org.scala-lang.modules/scala-xml_2.12) -[![latest release for 2.13.0-RC1](https://img.shields.io/maven-central/v/org.scala-lang.modules/scala-xml_2.13.0-RC1.svg?label=scala+2.13.0-RC1)](http://mvnrepository.com/artifact/org.scala-lang.modules/scala-xml_2.13.0-RC1) +[![latest release for 2.13.0-RC2](https://img.shields.io/maven-central/v/org.scala-lang.modules/scala-xml_2.13.0-RC2.svg?label=scala+2.13.0-RC2)](http://mvnrepository.com/artifact/org.scala-lang.modules/scala-xml_2.13.0-RC2) [![Gitter](https://badges.gitter.im/Join+Chat.svg)](https://gitter.im/scala/scala-xml) ========= diff --git a/build.sbt b/build.sbt index e6a7dbb30..97e0e55fd 100644 --- a/build.sbt +++ b/build.sbt @@ -1,7 +1,7 @@ import sbtcrossproject.{crossProject, CrossType} import ScalaModulePlugin._ -crossScalaVersions in ThisBuild := List("2.12.8", "2.11.12", "2.13.0-RC1") +crossScalaVersions in ThisBuild := List("2.12.8", "2.11.12", "2.13.0-RC2") lazy val xml = crossProject(JSPlatform, JVMPlatform) .withoutSuffixFor(JVMPlatform) From 5dac609d66e99bbe96abe1e67cd60c06c5cfb4e6 Mon Sep 17 00:00:00 2001 From: Guillaume Martres Date: Wed, 22 May 2019 15:00:29 +0200 Subject: [PATCH 328/789] Cross-compile with Dotty Tests that do not compile or failed with Dotty were moved to scala-2.x directories and should be investigated at some point. --- .travis.yml | 5 + build.sbt | 56 +++++-- .../scala/xml/CompilerErrors.scala | 0 .../scala-2.x/scala/xml/XMLTestJVM2x.scala | 138 +++++++++++++++++ .../test/scala/scala/xml/XMLSyntaxTest.scala | 2 +- jvm/src/test/scala/scala/xml/XMLTest.scala | 141 +----------------- .../xml/parsing/ConstructingParserTest.scala | 2 +- project/plugins.sbt | 1 + shared/src/main/scala/scala/xml/Elem.scala | 2 +- shared/src/main/scala/scala/xml/Utility.scala | 2 +- .../scala-2.x/scala/xml/ShouldCompile.scala | 13 ++ .../scala/xml/TransformersTest.scala | 0 .../test/scala-2.x/scala/xml/XMLTest2x.scala | 42 ++++++ .../scala/scala/xml/PatternMatchingTest.scala | 2 +- .../test/scala/scala/xml/ShouldCompile.scala | 6 - shared/src/test/scala/scala/xml/XMLTest.scala | 19 --- 16 files changed, 253 insertions(+), 178 deletions(-) rename jvm/src/test/{scala => scala-2.x}/scala/xml/CompilerErrors.scala (100%) create mode 100644 jvm/src/test/scala-2.x/scala/xml/XMLTestJVM2x.scala create mode 100644 shared/src/test/scala-2.x/scala/xml/ShouldCompile.scala rename shared/src/test/{scala => scala-2.x}/scala/xml/TransformersTest.scala (100%) create mode 100644 shared/src/test/scala-2.x/scala/xml/XMLTest2x.scala diff --git a/.travis.yml b/.travis.yml index 432ad3902..95e17b1f9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,6 +7,7 @@ jdk: scala: - 2.12.8 - 2.13.0-RC2 + - 0.14.0-RC1 env: global: @@ -28,6 +29,10 @@ matrix: env: SCALAJS_VERSION=0.6.27 - jdk: openjdk11 env: SCALAJS_VERSION=1.0.0-M7 + - scala: 0.14.0-RC1 + env: SCALAJS_VERSION=0.6.27 + - scala: 0.14.0-RC1 + env: SCALAJS_VERSION=1.0.0-M7 script: - admin/build.sh diff --git a/build.sbt b/build.sbt index eb8e6722d..d1eff4661 100644 --- a/build.sbt +++ b/build.sbt @@ -4,19 +4,49 @@ import ScalaModulePlugin._ crossScalaVersions in ThisBuild := List("2.12.8", "2.13.0-RC2") +lazy val configSettings: Seq[Setting[_]] = Seq( + unmanagedSourceDirectories ++= { + unmanagedSourceDirectories.value.flatMap { dir => + val sv = scalaVersion.value + Seq( + CrossVersion.partialVersion(sv) match { + case Some((2, 13)) => file(dir.getPath ++ "-2.13+") + case _ => file(dir.getPath ++ "-2.13-") + }, + CrossVersion.partialVersion(sv) match { + case Some((2, _)) => file(dir.getPath ++ "-2.x") + case _ => file(dir.getPath ++ "-3.x") + } + ) + } + } +) + + lazy val xml = crossProject(JSPlatform, JVMPlatform) .withoutSuffixFor(JVMPlatform) .crossType(CrossType.Full) .in(file(".")) .settings(scalaModuleSettings) .jvmSettings(scalaModuleSettingsJVM) + .jvmSettings( + crossScalaVersions += "0.14.0-RC1" + ) .settings( name := "scala-xml", version := "2.0.0-SNAPSHOT", - // Compiler team advised avoiding the -Xsource:2.14 option for releases. - // The output with -Xsource should be periodically checked, though. - scalacOptions ++= "-deprecation:false -feature -Xlint:-stars-align,-nullary-unit,_".split("\\s+").to[Seq], + scalacOptions ++= { + val opts = + if (isDotty.value) + "-language:Scala2" + else + // Compiler team advised avoiding the -Xsource:2.14 option for releases. + // The output with -Xsource should be periodically checked, though. + "-deprecation:false -feature -Xlint:-stars-align,-nullary-unit,_" + opts.split("\\s+").to[Seq] + }, + scalacOptions in Test += "-Xxml:coalescing", mimaPreviousVersion := { @@ -68,16 +98,6 @@ lazy val xml = crossProject(JSPlatform, JVMPlatform) ) }, - unmanagedSourceDirectories in Compile ++= { - (unmanagedSourceDirectories in Compile).value.map { dir => - val sv = scalaVersion.value - CrossVersion.partialVersion(sv) match { - case Some((2, 13)) => file(dir.getPath ++ "-2.13+") - case _ => file(dir.getPath ++ "-2.13-") - } - } - }, - apiMappings ++= Map( scalaInstance.value.libraryJar -> url(s"http://www.scala-lang.org/api/${scalaVersion.value}/") @@ -101,13 +121,21 @@ lazy val xml = crossProject(JSPlatform, JVMPlatform) } } ) + .settings( + inConfig(Compile)(configSettings) ++ inConfig(Test)(configSettings) + ) .jvmSettings( OsgiKeys.exportPackage := Seq(s"scala.xml.*;version=${version.value}"), libraryDependencies += "junit" % "junit" % "4.12" % Test, libraryDependencies += "com.novocode" % "junit-interface" % "0.11" % Test, libraryDependencies += "org.apache.commons" % "commons-lang3" % "3.9" % Test, - libraryDependencies += ("org.scala-lang" % "scala-compiler" % scalaVersion.value % Test).exclude("org.scala-lang.modules", s"scala-xml_${scalaBinaryVersion.value}") + libraryDependencies ++= { + if (isDotty.value) + Seq() + else + Seq(("org.scala-lang" % "scala-compiler" % scalaVersion.value % Test).exclude("org.scala-lang.modules", s"scala-xml_${scalaBinaryVersion.value}")) + } ) .jsSettings( // Scala.js cannot run forked tests diff --git a/jvm/src/test/scala/scala/xml/CompilerErrors.scala b/jvm/src/test/scala-2.x/scala/xml/CompilerErrors.scala similarity index 100% rename from jvm/src/test/scala/scala/xml/CompilerErrors.scala rename to jvm/src/test/scala-2.x/scala/xml/CompilerErrors.scala diff --git a/jvm/src/test/scala-2.x/scala/xml/XMLTestJVM2x.scala b/jvm/src/test/scala-2.x/scala/xml/XMLTestJVM2x.scala new file mode 100644 index 000000000..40bf56184 --- /dev/null +++ b/jvm/src/test/scala-2.x/scala/xml/XMLTestJVM2x.scala @@ -0,0 +1,138 @@ +package scala.xml + +import language.postfixOps + +import org.junit.{Test => UnitTest} +import org.junit.Assert.assertTrue +import org.junit.Assert.assertFalse +import org.junit.Assert.assertEquals +import scala.xml.parsing.ConstructingParser +import java.io.StringWriter +import java.io.ByteArrayOutputStream +import java.io.StringReader +import scala.collection.Iterable +import scala.collection.Seq +import scala.xml.Utility.sort + +class XMLTestJVM2x { + @UnitTest + def t2354: Unit = { + val xml_good = "<![CDATA[Hello [tag]]]>" + val xml_bad = "<![CDATA[Hello [tag] ]]>" + + val parser1 = ConstructingParser.fromSource(io.Source.fromString(xml_good), false) + val parser2 = ConstructingParser.fromSource(io.Source.fromString(xml_bad), false) + + parser1.document() + parser2.document() + } + + @UnitTest + def t8253: Unit = { + // `identity(foo)` used to match the overly permissive match in SymbolXMLBuilder + // which was intended to more specifically match `_root_.scala.xml.Text(...)` + + import reflect.runtime.universe._ // not using the XML library in compiler tests + + val ns1 = "ns1" + assertEquals(reify(ns1).tree.toString, q"ns1".toString) + assertEquals("", + """|{ + | var $tmpscope: _root_.scala.xml.NamespaceBinding = $scope; + | $tmpscope = new _root_.scala.xml.NamespaceBinding(null, "ns1", $tmpscope); + | { + | val $scope: _root_.scala.xml.NamespaceBinding = $tmpscope; + | new _root_.scala.xml.Elem(null, "sample", _root_.scala.xml.Null, $scope, true) + | } + |}""".stripMargin, + q"".toString) + assertEquals("", + """|{ + | var $tmpscope: _root_.scala.xml.NamespaceBinding = $scope; + | $tmpscope = new _root_.scala.xml.NamespaceBinding(null, ns1, $tmpscope); + | { + | val $scope: _root_.scala.xml.NamespaceBinding = $tmpscope; + | new _root_.scala.xml.Elem(null, "sample", _root_.scala.xml.Null, $scope, true) + | } + |}""".stripMargin, + q"".toString) + assertEquals("", + """|{ + | var $tmpscope: _root_.scala.xml.NamespaceBinding = $scope; + | $tmpscope = new _root_.scala.xml.NamespaceBinding("foo", "ns1", $tmpscope); + | { + | val $scope: _root_.scala.xml.NamespaceBinding = $tmpscope; + | new _root_.scala.xml.Elem(null, "sample", _root_.scala.xml.Null, $scope, true) + | } + |}""".stripMargin, + q"".toString) + assertEquals("", + """|{ + | var $tmpscope: _root_.scala.xml.NamespaceBinding = $scope; + | $tmpscope = new _root_.scala.xml.NamespaceBinding("foo", ns1, $tmpscope); + | { + | val $scope: _root_.scala.xml.NamespaceBinding = $tmpscope; + | new _root_.scala.xml.Elem(null, "sample", _root_.scala.xml.Null, $scope, true) + | } + |}""".stripMargin, + q"".toString) + } + + @UnitTest + def t8466lift: Unit = { + import scala.reflect.runtime.universe._ + + implicit val liftXmlComment = Liftable[Comment] { comment => + q"new _root_.scala.xml.Comment(${comment.commentText})" + } + liftXmlComment(Comment("foo")) + assertEquals(q"${Comment("foo")}".toString, q"".toString) + } + + @UnitTest + def t8466unlift: Unit = { + import scala.reflect.runtime.universe._ + + implicit val unliftXmlComment = Unliftable[Comment] { + case q"new _root_.scala.xml.Comment(${value: String})" => Comment(value) + } + unliftXmlComment.unapply(q"") + val q"${comment: Comment}" = q"" + assertEquals(comment.commentText, "foo") + } + + @UnitTest + def t9027: Unit = { + // used to be parsed as .println + + import reflect.runtime._, universe._ + + assertEquals( + """|{ + | { + | val $buf = new _root_.scala.xml.NodeBuffer(); + | $buf.$amp$plus(new _root_.scala.xml.Elem(null, "a", _root_.scala.xml.Null, $scope, true)); + | $buf.$amp$plus(new _root_.scala.xml.Elem(null, "b", _root_.scala.xml.Null, $scope, true)); + | $buf + | }; + | println("hello, world.") + |}""".stripMargin, + q""" + println("hello, world.")""".toString) + assertEquals( + """|{ + | { + | val $buf = new _root_.scala.xml.NodeBuffer(); + | $buf.$amp$plus(new _root_.scala.xml.Elem(null, "a", _root_.scala.xml.Null, $scope, true)); + | $buf.$amp$plus(new _root_.scala.xml.Elem(null, "b", _root_.scala.xml.Null, $scope, true)); + | $buf.$amp$plus(new _root_.scala.xml.Elem(null, "c", _root_.scala.xml.Null, $scope, true)); + | $buf + | }; + | println("hello, world.") + |}""".stripMargin, + q""" + + + println("hello, world.")""".toString) + } +} diff --git a/jvm/src/test/scala/scala/xml/XMLSyntaxTest.scala b/jvm/src/test/scala/scala/xml/XMLSyntaxTest.scala index 50dbf4a65..5030dcc04 100644 --- a/jvm/src/test/scala/scala/xml/XMLSyntaxTest.scala +++ b/jvm/src/test/scala/scala/xml/XMLSyntaxTest.scala @@ -16,7 +16,7 @@ class XMLSyntaxTestJVM { case _ => super.replacementText(entityName); } } - nextch; // !!important, to initialize the parser + nextch(); // !!important, to initialize the parser } val parsed = parser.element(TopScope) // parse the source as element // alternatively, we could call document() diff --git a/jvm/src/test/scala/scala/xml/XMLTest.scala b/jvm/src/test/scala/scala/xml/XMLTest.scala index 8266d9b18..efdb8165a 100644 --- a/jvm/src/test/scala/scala/xml/XMLTest.scala +++ b/jvm/src/test/scala/scala/xml/XMLTest.scala @@ -281,10 +281,6 @@ class XMLTestJVM { ; - def wsdlTemplate3(serviceName: String): Node = - - ; - def wsdlTemplate4(serviceName: String, targetNamespace: () => String): Node = ; @@ -295,8 +291,6 @@ class XMLTestJVM { """, wsdlTemplate1("service1") toString) assertEquals(""" """, wsdlTemplate2("service2", "target2") toString) - assertEquals(""" - """, wsdlTemplate3("service3") toString) assertEquals(""" """, wsdlTemplate4("service4", () => "target4") toString) } @@ -328,7 +322,7 @@ class XMLTestJVM { def t0663 = { val src = scala.io.Source.fromString("") val parser = xml.parsing.ConstructingParser.fromSource(src, true) - assertEquals("", parser.document toString) + assertEquals("", parser.document() toString) } @UnitTest @@ -367,18 +361,6 @@ class XMLTestJVM { for (x1 <- xs; x2 <- xs) assertTrue(x1 xml_== x2) } - @UnitTest - def t2354: Unit = { - val xml_good = "<![CDATA[Hello [tag]]]>" - val xml_bad = "<![CDATA[Hello [tag] ]]>" - - val parser1 = ConstructingParser.fromSource(io.Source.fromString(xml_good), false) - val parser2 = ConstructingParser.fromSource(io.Source.fromString(xml_bad), false) - - parser1.document - parser2.document - } - @UnitTest def t2771 = { val xml1 = @@ -480,115 +462,6 @@ class XMLTestJVM { assertEquals("""""", sort() toString) } - @UnitTest - def t8253: Unit = { - // `identity(foo)` used to match the overly permissive match in SymbolXMLBuilder - // which was intended to more specifically match `_root_.scala.xml.Text(...)` - - import reflect.runtime.universe._ // not using the XML library in compiler tests - - val ns1 = "ns1" - assertEquals(reify(ns1).tree.toString, q"ns1".toString) - assertEquals("", - """|{ - | var $tmpscope: _root_.scala.xml.NamespaceBinding = $scope; - | $tmpscope = new _root_.scala.xml.NamespaceBinding(null, "ns1", $tmpscope); - | { - | val $scope: _root_.scala.xml.NamespaceBinding = $tmpscope; - | new _root_.scala.xml.Elem(null, "sample", _root_.scala.xml.Null, $scope, true) - | } - |}""".stripMargin, - q"".toString) - assertEquals("", - """|{ - | var $tmpscope: _root_.scala.xml.NamespaceBinding = $scope; - | $tmpscope = new _root_.scala.xml.NamespaceBinding(null, ns1, $tmpscope); - | { - | val $scope: _root_.scala.xml.NamespaceBinding = $tmpscope; - | new _root_.scala.xml.Elem(null, "sample", _root_.scala.xml.Null, $scope, true) - | } - |}""".stripMargin, - q"".toString) - assertEquals("", - """|{ - | var $tmpscope: _root_.scala.xml.NamespaceBinding = $scope; - | $tmpscope = new _root_.scala.xml.NamespaceBinding("foo", "ns1", $tmpscope); - | { - | val $scope: _root_.scala.xml.NamespaceBinding = $tmpscope; - | new _root_.scala.xml.Elem(null, "sample", _root_.scala.xml.Null, $scope, true) - | } - |}""".stripMargin, - q"".toString) - assertEquals("", - """|{ - | var $tmpscope: _root_.scala.xml.NamespaceBinding = $scope; - | $tmpscope = new _root_.scala.xml.NamespaceBinding("foo", ns1, $tmpscope); - | { - | val $scope: _root_.scala.xml.NamespaceBinding = $tmpscope; - | new _root_.scala.xml.Elem(null, "sample", _root_.scala.xml.Null, $scope, true) - | } - |}""".stripMargin, - q"".toString) - } - - @UnitTest - def t8466lift: Unit = { - import scala.reflect.runtime.universe._ - - implicit val liftXmlComment = Liftable[Comment] { comment => - q"new _root_.scala.xml.Comment(${comment.commentText})" - } - liftXmlComment(Comment("foo")) - assertEquals(q"${Comment("foo")}".toString, q"".toString) - } - - @UnitTest - def t8466unlift: Unit = { - import scala.reflect.runtime.universe._ - - implicit val unliftXmlComment = Unliftable[Comment] { - case q"new _root_.scala.xml.Comment(${value: String})" => Comment(value) - } - unliftXmlComment.unapply(q"") - val q"${comment: Comment}" = q"" - assertEquals(comment.commentText, "foo") - } - - @UnitTest - def t9027: Unit = { - // used to be parsed as .println - - import reflect.runtime._, universe._ - - assertEquals( - """|{ - | { - | val $buf = new _root_.scala.xml.NodeBuffer(); - | $buf.$amp$plus(new _root_.scala.xml.Elem(null, "a", _root_.scala.xml.Null, $scope, true)); - | $buf.$amp$plus(new _root_.scala.xml.Elem(null, "b", _root_.scala.xml.Null, $scope, true)); - | $buf - | }; - | println("hello, world.") - |}""".stripMargin, - q""" - println("hello, world.")""".toString) - assertEquals( - """|{ - | { - | val $buf = new _root_.scala.xml.NodeBuffer(); - | $buf.$amp$plus(new _root_.scala.xml.Elem(null, "a", _root_.scala.xml.Null, $scope, true)); - | $buf.$amp$plus(new _root_.scala.xml.Elem(null, "b", _root_.scala.xml.Null, $scope, true)); - | $buf.$amp$plus(new _root_.scala.xml.Elem(null, "c", _root_.scala.xml.Null, $scope, true)); - | $buf - | }; - | println("hello, world.") - |}""".stripMargin, - q""" - - - println("hello, world.")""".toString) - } - @UnitTest def t9060 = { val expected = """""" @@ -637,7 +510,7 @@ class XMLTestJVM { val sink = new PrintStream(new ByteArrayOutputStream()) (Console withOut sink) { (Console withErr sink) { - ConstructingParser.fromSource((io.Source fromString xml), true).document.docElem + ConstructingParser.fromSource((io.Source fromString xml), true).document().docElem } } } @@ -843,35 +716,35 @@ class XMLTestJVM { def xmlProcInstrTest: Unit = { val x = xml.parsing.ConstructingParser.fromSource(toSource("aa"), false) - assertEquals(new UnprefixedAttribute("aa", Text(""), Null), x.xmlProcInstr) + assertEquals(new UnprefixedAttribute("aa", Text(""), Null), x.xmlProcInstr()) } @UnitTest(expected = classOf[FatalError]) def notationDeclFailure: Unit = { val x = xml.parsing.ConstructingParser.fromSource(toSource(""), false) - x.notationDecl + x.notationDecl() } @UnitTest def pubidLiteralTest: Unit = { val x = xml.parsing.ConstructingParser.fromSource(toSource(""), false) - assertEquals("", x.pubidLiteral) + assertEquals("", x.pubidLiteral()) } @UnitTest def xAttributeValueTest: Unit = { val x = xml.parsing.ConstructingParser.fromSource(toSource("'"), false) - assertEquals("", x.xAttributeValue) + assertEquals("", x.xAttributeValue()) } @UnitTest def xEntityValueTest: Unit = { val x = xml.parsing.ConstructingParser.fromSource(toSource(""), false) - assertEquals("", x.xEntityValue) + assertEquals("", x.xEntityValue()) } } diff --git a/jvm/src/test/scala/scala/xml/parsing/ConstructingParserTest.scala b/jvm/src/test/scala/scala/xml/parsing/ConstructingParserTest.scala index 7dfa33b6b..413cd9a74 100644 --- a/jvm/src/test/scala/scala/xml/parsing/ConstructingParserTest.scala +++ b/jvm/src/test/scala/scala/xml/parsing/ConstructingParserTest.scala @@ -46,7 +46,7 @@ class ConstructingParserTest { override def reportError(pos: Int, msg: String, out: java.io.PrintStream = Console.err) = {} } - val doc = ConstructingParser.fromSource(source, true).document + val doc = ConstructingParser.fromSource(source, true).document() assertEquals(expected, doc.theSeq) } diff --git a/project/plugins.sbt b/project/plugins.sbt index 8920d978b..12b171d4e 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -6,3 +6,4 @@ val scalaJSVersion = addSbtPlugin("org.scala-js" % "sbt-scalajs" % scalaJSVersion) addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "0.6.0") addSbtPlugin("org.scala-lang.modules" % "sbt-scala-module" % "2.0.0") +addSbtPlugin("ch.epfl.lamp" % "sbt-dotty" % "0.3.1") diff --git a/shared/src/main/scala/scala/xml/Elem.scala b/shared/src/main/scala/scala/xml/Elem.scala index f641ff7bd..cf156ed63 100755 --- a/shared/src/main/scala/scala/xml/Elem.scala +++ b/shared/src/main/scala/scala/xml/Elem.scala @@ -53,7 +53,7 @@ object Elem { implicit def xmlToProcess(command: scala.xml.Elem): ProcessBuilder = Process(command.text.trim) @deprecated("To create a scala.sys.process.Process from an xml.Elem, please use Process(elem.text.trim).", "2.11.0") - implicit def processXml(p: Process.type) = new { + implicit def processXml(p: Process.type): { def apply(command: Elem): ProcessBuilder } = new { /** * Creates a [[scala.sys.process.ProcessBuilder]] from a Scala XML Element. * This can be used as a way to template strings. diff --git a/shared/src/main/scala/scala/xml/Utility.scala b/shared/src/main/scala/scala/xml/Utility.scala index 9374ff990..776da5a7a 100755 --- a/shared/src/main/scala/scala/xml/Utility.scala +++ b/shared/src/main/scala/scala/xml/Utility.scala @@ -24,7 +24,7 @@ object Utility extends AnyRef with parsing.TokenTests { // [Martin] This looks dubious. We don't convert StringBuilders to // Strings anywhere else, why do it here? - implicit def implicitSbToString(sb: StringBuilder) = sb.toString() + implicit def implicitSbToString(sb: StringBuilder): String = sb.toString() // helper for the extremely oft-repeated sequence of creating a // StringBuilder, passing it around, and then grabbing its String. diff --git a/shared/src/test/scala-2.x/scala/xml/ShouldCompile.scala b/shared/src/test/scala-2.x/scala/xml/ShouldCompile.scala new file mode 100644 index 000000000..d1aab6826 --- /dev/null +++ b/shared/src/test/scala-2.x/scala/xml/ShouldCompile.scala @@ -0,0 +1,13 @@ +package scala.xml + +// these tests depend on xml, so they ended up here, +// though really they are compiler tests + +import scala.collection._ +import scala.collection.mutable.ArrayBuffer + +// t1626 +object o { + val n = + n.namespace == null +} diff --git a/shared/src/test/scala/scala/xml/TransformersTest.scala b/shared/src/test/scala-2.x/scala/xml/TransformersTest.scala similarity index 100% rename from shared/src/test/scala/scala/xml/TransformersTest.scala rename to shared/src/test/scala-2.x/scala/xml/TransformersTest.scala diff --git a/shared/src/test/scala-2.x/scala/xml/XMLTest2x.scala b/shared/src/test/scala-2.x/scala/xml/XMLTest2x.scala new file mode 100644 index 000000000..aa01266fa --- /dev/null +++ b/shared/src/test/scala-2.x/scala/xml/XMLTest2x.scala @@ -0,0 +1,42 @@ +package scala.xml + +import language.postfixOps + +import org.junit.{Test => UnitTest} +import org.junit.Assert.assertTrue +import org.junit.Assert.assertFalse +import org.junit.Assert.assertEquals +import scala.xml.parsing.ConstructingParser +import java.io.StringWriter +import java.io.ByteArrayOutputStream +import java.io.StringReader +import scala.collection.Iterable +import scala.collection.Seq +import scala.xml.Utility.sort + +class XMLTest2x { + // t-486 + def wsdlTemplate3(serviceName: String): Node = + + ; + + @UnitTest + def wsdl = { + assertEquals(""" + """, wsdlTemplate3("service3") toString) + } + + @UnitTest + def t5154: Unit = { + + // extra space made the pattern OK + def f = {{3}} match { case {{3}} => true } + + // lack of space used to error: illegal start of simple pattern + def g = {{3}} match { case {{3}} => true } + + assertTrue(f) + assertTrue(g) + } + +} diff --git a/shared/src/test/scala/scala/xml/PatternMatchingTest.scala b/shared/src/test/scala/scala/xml/PatternMatchingTest.scala index 6f241464a..2fce27208 100644 --- a/shared/src/test/scala/scala/xml/PatternMatchingTest.scala +++ b/shared/src/test/scala/scala/xml/PatternMatchingTest.scala @@ -5,7 +5,7 @@ import org.junit.Test import org.junit.Assert.assertTrue import org.junit.Assert.assertEquals -class PatternMatchingTest extends { +class PatternMatchingTest { @Test def unprefixedAttribute: Unit = { val li = List("1", "2", "3", "4") diff --git a/shared/src/test/scala/scala/xml/ShouldCompile.scala b/shared/src/test/scala/scala/xml/ShouldCompile.scala index c05bdc503..3ba589a90 100644 --- a/shared/src/test/scala/scala/xml/ShouldCompile.scala +++ b/shared/src/test/scala/scala/xml/ShouldCompile.scala @@ -6,12 +6,6 @@ package scala.xml import scala.collection._ import scala.collection.mutable.ArrayBuffer -// t1626 -object o { - val n = - n.namespace == null -} - // t1761 class Foo { val elements: Seq[Node] = Nil diff --git a/shared/src/test/scala/scala/xml/XMLTest.scala b/shared/src/test/scala/scala/xml/XMLTest.scala index 93e443119..3a8c42917 100644 --- a/shared/src/test/scala/scala/xml/XMLTest.scala +++ b/shared/src/test/scala/scala/xml/XMLTest.scala @@ -359,10 +359,6 @@ Ours is the portal of hope, come as you are." ; - def wsdlTemplate3(serviceName: String): Node = - - ; - def wsdlTemplate4(serviceName: String, targetNamespace: () => String): Node = ; @@ -373,8 +369,6 @@ Ours is the portal of hope, come as you are." """, wsdlTemplate1("service1") toString) assertEquals(""" """, wsdlTemplate2("service2", "target2") toString) - assertEquals(""" - """, wsdlTemplate3("service3") toString) assertEquals(""" """, wsdlTemplate4("service4", () => "target4") toString) } @@ -479,19 +473,6 @@ Ours is the portal of hope, come as you are." assertHonorsIterableContract(.attributes) } - @UnitTest - def t5154: Unit = { - - // extra space made the pattern OK - def f = {{3}} match { case {{3}} => true } - - // lack of space used to error: illegal start of simple pattern - def g = {{3}} match { case {{3}} => true } - - assertTrue(f) - assertTrue(g) - } - @UnitTest def t5843: Unit = { val foo = scala.xml.Attribute(null, "foo", "1", scala.xml.Null) From ad31b2d1add50b7df85fdfd2c31bf047cc50fda6 Mon Sep 17 00:00:00 2001 From: Guillaume Martres Date: Wed, 29 May 2019 17:30:02 +0200 Subject: [PATCH 329/789] Fix #313: Upgrade to sbt-dotty 0.3.2 This includes https://github.com/lampepfl/dotty/pull/6577 which fixes "sbt console" in Scala 2 projects. --- project/plugins.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/plugins.sbt b/project/plugins.sbt index 12b171d4e..3d7dda9d8 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -6,4 +6,4 @@ val scalaJSVersion = addSbtPlugin("org.scala-js" % "sbt-scalajs" % scalaJSVersion) addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "0.6.0") addSbtPlugin("org.scala-lang.modules" % "sbt-scala-module" % "2.0.0") -addSbtPlugin("ch.epfl.lamp" % "sbt-dotty" % "0.3.1") +addSbtPlugin("ch.epfl.lamp" % "sbt-dotty" % "0.3.2") From e2d340fde9bb7e00cfe299b7303bf8a0e4cbd968 Mon Sep 17 00:00:00 2001 From: Guillaume Martres Date: Wed, 29 May 2019 17:38:38 +0200 Subject: [PATCH 330/789] Upgrade to Dotty 0.15.0-RC1 --- .travis.yml | 6 +++--- build.sbt | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 95e17b1f9..13cde04cd 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,7 +7,7 @@ jdk: scala: - 2.12.8 - 2.13.0-RC2 - - 0.14.0-RC1 + - 0.15.0-RC1 env: global: @@ -29,9 +29,9 @@ matrix: env: SCALAJS_VERSION=0.6.27 - jdk: openjdk11 env: SCALAJS_VERSION=1.0.0-M7 - - scala: 0.14.0-RC1 + - scala: 0.15.0-RC1 env: SCALAJS_VERSION=0.6.27 - - scala: 0.14.0-RC1 + - scala: 0.15.0-RC1 env: SCALAJS_VERSION=1.0.0-M7 script: diff --git a/build.sbt b/build.sbt index d1eff4661..590bb9d18 100644 --- a/build.sbt +++ b/build.sbt @@ -30,7 +30,7 @@ lazy val xml = crossProject(JSPlatform, JVMPlatform) .settings(scalaModuleSettings) .jvmSettings(scalaModuleSettingsJVM) .jvmSettings( - crossScalaVersions += "0.14.0-RC1" + crossScalaVersions += "0.15.0-RC1" ) .settings( name := "scala-xml", From 97624387c3b9e6b8e0f109302bd78cd67f31c31c Mon Sep 17 00:00:00 2001 From: Guillaume Martres Date: Wed, 29 May 2019 17:43:23 +0200 Subject: [PATCH 331/789] Add test cases coming from the Dotty test suite These tests will be removed from Dotty once Dotty stops depending on scala-xml, so preserve them here. --- shared/src/test/scala/scala/xml/XMLTest.scala | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/shared/src/test/scala/scala/xml/XMLTest.scala b/shared/src/test/scala/scala/xml/XMLTest.scala index 3a8c42917..a9644ca6d 100644 --- a/shared/src/test/scala/scala/xml/XMLTest.scala +++ b/shared/src/test/scala/scala/xml/XMLTest.scala @@ -570,4 +570,14 @@ Ours is the portal of hope, come as you are." pp.format(x, sb) assertEquals(expected, sb.toString) } + + @UnitTest + def i1976: Unit = { + val node = { "whatever " } + } + + @UnitTest + def i6547: Unit = { + + } } From 23b23dd88bb44a191c0737fcff3bd5dc9135606e Mon Sep 17 00:00:00 2001 From: Seth Tisue Date: Wed, 29 May 2019 21:50:17 +0200 Subject: [PATCH 332/789] support Scala 2.13.0-RC3 (drop RC2) --- .travis.yml | 16 ++++++++-------- README.md | 2 +- build.sbt | 2 +- project/plugins.sbt | 2 +- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/.travis.yml b/.travis.yml index 1a54e7573..aead3ae98 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,7 +16,7 @@ jdk: scala: - 2.11.12 - 2.12.8 - - 2.13.0-RC2 + - 2.13.0-RC3 env: global: @@ -29,31 +29,31 @@ env: matrix: # The empty SCALAJS_VERSION will only compile for the JVM - SCALAJS_VERSION= - - SCALAJS_VERSION=0.6.27 - - SCALAJS_VERSION=1.0.0-M7 + - SCALAJS_VERSION=0.6.28 + - SCALAJS_VERSION=1.0.0-M8 matrix: exclude: - jdk: openjdk11 - env: SCALAJS_VERSION=0.6.27 + env: SCALAJS_VERSION=0.6.28 - jdk: openjdk11 - env: SCALAJS_VERSION=1.0.0-M7 + env: SCALAJS_VERSION=1.0.0-M8 - scala: 2.11.12 - env: SCALAJS_VERSION=1.0.0-M7 + env: SCALAJS_VERSION=1.0.0-M8 - scala: 2.11.12 jdk: oraclejdk8 - scala: 2.11.12 jdk: openjdk11 - scala: 2.12.8 jdk: openjdk6 - - scala: 2.13.0-RC2 + - scala: 2.13.0-RC3 jdk: openjdk6 before_script: - nvm install 8 - nvm use 8 -script: +script: # work around https://github.com/travis-ci/travis-ci/issues/9713 - if [[ $JAVA_HOME = *java-6* ]]; then jdk_switcher use openjdk6; fi - java -version diff --git a/README.md b/README.md index 9eaf06872..59014b256 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ scala-xml [![Travis](https://img.shields.io/travis/scala/scala-xml.svg)](https://travis-ci.org/scala/scala-xml) [![latest release for 2.11](https://img.shields.io/maven-central/v/org.scala-lang.modules/scala-xml_2.11.svg?label=scala+2.11)](http://mvnrepository.com/artifact/org.scala-lang.modules/scala-xml_2.11) [![latest release for 2.12](https://img.shields.io/maven-central/v/org.scala-lang.modules/scala-xml_2.12.svg?label=scala+2.12)](http://mvnrepository.com/artifact/org.scala-lang.modules/scala-xml_2.12) -[![latest release for 2.13.0-RC2](https://img.shields.io/maven-central/v/org.scala-lang.modules/scala-xml_2.13.0-RC2.svg?label=scala+2.13.0-RC2)](http://mvnrepository.com/artifact/org.scala-lang.modules/scala-xml_2.13.0-RC2) +[![latest release for 2.13.0-RC3](https://img.shields.io/maven-central/v/org.scala-lang.modules/scala-xml_2.13.0-RC3.svg?label=scala+2.13.0-RC3)](http://mvnrepository.com/artifact/org.scala-lang.modules/scala-xml_2.13.0-RC3) [![Gitter](https://badges.gitter.im/Join+Chat.svg)](https://gitter.im/scala/scala-xml) ========= diff --git a/build.sbt b/build.sbt index 97e0e55fd..b3e383a21 100644 --- a/build.sbt +++ b/build.sbt @@ -1,7 +1,7 @@ import sbtcrossproject.{crossProject, CrossType} import ScalaModulePlugin._ -crossScalaVersions in ThisBuild := List("2.12.8", "2.11.12", "2.13.0-RC2") +crossScalaVersions in ThisBuild := List("2.12.8", "2.11.12", "2.13.0-RC3") lazy val xml = crossProject(JSPlatform, JVMPlatform) .withoutSuffixFor(JVMPlatform) diff --git a/project/plugins.sbt b/project/plugins.sbt index 983887349..8fd973271 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -6,7 +6,7 @@ else Seq(addSbtPlugin("com.typesafe.sbt" % "sbt-osgi" % "0.9.3")) val scalaJSVersion = - Option(System.getenv("SCALAJS_VERSION")).filter(_.nonEmpty).getOrElse("0.6.27") + Option(System.getenv("SCALAJS_VERSION")).filter(_.nonEmpty).getOrElse("0.6.28") addSbtPlugin("org.scala-js" % "sbt-scalajs" % scalaJSVersion) addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "0.6.0") From 0c53c45a3a9c21b2116334cacfde7a0e9f0d3fb5 Mon Sep 17 00:00:00 2001 From: Seth Tisue Date: Wed, 29 May 2019 23:00:41 +0200 Subject: [PATCH 333/789] restore MiMa exemption temporarily --- build.sbt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index b3e383a21..d4d8dcdfa 100644 --- a/build.sbt +++ b/build.sbt @@ -22,7 +22,8 @@ lazy val xml = crossProject(JSPlatform, JVMPlatform) scalacOptions in Test += "-Xxml:coalescing", mimaPreviousVersion := { - Some("1.2.0") + if (System.getenv("SCALAJS_VERSION") == "1.0.0-M8") None // No such release yet + else Some("1.2.0") }, unmanagedSourceDirectories in Compile ++= { From fb772d55a974eac1e680e5f23253181d27124bd3 Mon Sep 17 00:00:00 2001 From: Seth Tisue Date: Thu, 30 May 2019 10:14:22 +0200 Subject: [PATCH 334/789] upgrade 1.x branch to sbt 0.13.18 --- project/build.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/build.properties b/project/build.properties index 133a8f197..8e682c526 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version=0.13.17 +sbt.version=0.13.18 From c0c75ba3a4ea2b5b863786e32585528634490c2a Mon Sep 17 00:00:00 2001 From: Seth Tisue Date: Wed, 29 May 2019 21:50:17 +0200 Subject: [PATCH 335/789] support Scala 2.13.0-RC3 (drop RC2) --- .travis.yml | 16 ++++++++-------- README.md | 2 +- build.sbt | 2 +- project/plugins.sbt | 2 +- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/.travis.yml b/.travis.yml index 13cde04cd..9401fdafb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,7 +6,7 @@ jdk: scala: - 2.12.8 - - 2.13.0-RC2 + - 2.13.0-RC3 - 0.15.0-RC1 env: @@ -20,21 +20,21 @@ env: matrix: # The empty SCALAJS_VERSION will only compile for the JVM - SCALAJS_VERSION= - - SCALAJS_VERSION=0.6.27 - - SCALAJS_VERSION=1.0.0-M7 + - SCALAJS_VERSION=0.6.28 + - SCALAJS_VERSION=1.0.0-M8 matrix: exclude: - jdk: openjdk11 - env: SCALAJS_VERSION=0.6.27 + env: SCALAJS_VERSION=0.6.28 - jdk: openjdk11 - env: SCALAJS_VERSION=1.0.0-M7 + env: SCALAJS_VERSION=1.0.0-M8 - scala: 0.15.0-RC1 - env: SCALAJS_VERSION=0.6.27 + env: SCALAJS_VERSION=0.6.28 - scala: 0.15.0-RC1 - env: SCALAJS_VERSION=1.0.0-M7 + env: SCALAJS_VERSION=1.0.0-M8 -script: +script: - admin/build.sh before_cache: diff --git a/README.md b/README.md index f17c1947d..6a3d1c824 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ scala-xml [![Travis](https://img.shields.io/travis/scala/scala-xml.svg)](https://travis-ci.org/scala/scala-xml) [![latest release for 2.11](https://img.shields.io/maven-central/v/org.scala-lang.modules/scala-xml_2.11.svg?label=scala+2.11)](http://mvnrepository.com/artifact/org.scala-lang.modules/scala-xml_2.11) [![latest release for 2.12](https://img.shields.io/maven-central/v/org.scala-lang.modules/scala-xml_2.12.svg?label=scala+2.12)](http://mvnrepository.com/artifact/org.scala-lang.modules/scala-xml_2.12) -[![latest release for 2.13.0-RC2](https://img.shields.io/maven-central/v/org.scala-lang.modules/scala-xml_2.13.0-RC2.svg?label=scala+2.13.0-RC2)](http://mvnrepository.com/artifact/org.scala-lang.modules/scala-xml_2.13.0-RC2) +[![latest release for 2.13.0-RC3](https://img.shields.io/maven-central/v/org.scala-lang.modules/scala-xml_2.13.0-RC3.svg?label=scala+2.13.0-RC3)](http://mvnrepository.com/artifact/org.scala-lang.modules/scala-xml_2.13.0-RC3) [![Gitter](https://badges.gitter.im/Join+Chat.svg)](https://gitter.im/scala/scala-xml) ========= diff --git a/build.sbt b/build.sbt index 590bb9d18..b04f80405 100644 --- a/build.sbt +++ b/build.sbt @@ -2,7 +2,7 @@ import sbtcrossproject.CrossType import sbtcrossproject.CrossPlugin.autoImport.crossProject import ScalaModulePlugin._ -crossScalaVersions in ThisBuild := List("2.12.8", "2.13.0-RC2") +crossScalaVersions in ThisBuild := List("2.12.8", "2.13.0-RC3") lazy val configSettings: Seq[Setting[_]] = Seq( unmanagedSourceDirectories ++= { diff --git a/project/plugins.sbt b/project/plugins.sbt index 3d7dda9d8..0d0418e6d 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,7 +1,7 @@ addSbtPlugin("com.typesafe.sbt" % "sbt-osgi" % "0.9.5") val scalaJSVersion = - Option(System.getenv("SCALAJS_VERSION")).filter(_.nonEmpty).getOrElse("0.6.27") + Option(System.getenv("SCALAJS_VERSION")).filter(_.nonEmpty).getOrElse("0.6.28") addSbtPlugin("org.scala-js" % "sbt-scalajs" % scalaJSVersion) addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "0.6.0") From af1120bd404317ec6ecea57f951b5fb791b49461 Mon Sep 17 00:00:00 2001 From: Seth Tisue Date: Wed, 29 May 2019 23:00:41 +0200 Subject: [PATCH 336/789] restore MiMa exemption temporarily --- build.sbt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index b04f80405..f47b6fb3a 100644 --- a/build.sbt +++ b/build.sbt @@ -50,7 +50,8 @@ lazy val xml = crossProject(JSPlatform, JVMPlatform) scalacOptions in Test += "-Xxml:coalescing", mimaPreviousVersion := { - Some("1.2.0") + if (System.getenv("SCALAJS_VERSION") == "1.0.0-M8") None // No such release yet + else Some("1.2.0") }, mimaBinaryIssueFilters ++= { import com.typesafe.tools.mima.core._ From 4abaf7c6c5197285e3f9f30624d7c0f1eae15fbc Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Fri, 7 Jun 2019 13:22:04 -0400 Subject: [PATCH 337/789] Use Scala 2.13.0 --- .travis.yml | 4 ++-- README.md | 2 +- build.sbt | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index aead3ae98..3dc48bdd6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,7 +16,7 @@ jdk: scala: - 2.11.12 - 2.12.8 - - 2.13.0-RC3 + - 2.13.0 env: global: @@ -46,7 +46,7 @@ matrix: jdk: openjdk11 - scala: 2.12.8 jdk: openjdk6 - - scala: 2.13.0-RC3 + - scala: 2.13.0 jdk: openjdk6 before_script: diff --git a/README.md b/README.md index 59014b256..0d7a8046c 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ scala-xml [![Travis](https://img.shields.io/travis/scala/scala-xml.svg)](https://travis-ci.org/scala/scala-xml) [![latest release for 2.11](https://img.shields.io/maven-central/v/org.scala-lang.modules/scala-xml_2.11.svg?label=scala+2.11)](http://mvnrepository.com/artifact/org.scala-lang.modules/scala-xml_2.11) [![latest release for 2.12](https://img.shields.io/maven-central/v/org.scala-lang.modules/scala-xml_2.12.svg?label=scala+2.12)](http://mvnrepository.com/artifact/org.scala-lang.modules/scala-xml_2.12) -[![latest release for 2.13.0-RC3](https://img.shields.io/maven-central/v/org.scala-lang.modules/scala-xml_2.13.0-RC3.svg?label=scala+2.13.0-RC3)](http://mvnrepository.com/artifact/org.scala-lang.modules/scala-xml_2.13.0-RC3) +[![latest release for 2.13.0](https://img.shields.io/maven-central/v/org.scala-lang.modules/scala-xml_2.13.0.svg?label=scala+2.13.0)](http://mvnrepository.com/artifact/org.scala-lang.modules/scala-xml_2.13.0) [![Gitter](https://badges.gitter.im/Join+Chat.svg)](https://gitter.im/scala/scala-xml) ========= diff --git a/build.sbt b/build.sbt index d4d8dcdfa..238704630 100644 --- a/build.sbt +++ b/build.sbt @@ -1,7 +1,7 @@ import sbtcrossproject.{crossProject, CrossType} import ScalaModulePlugin._ -crossScalaVersions in ThisBuild := List("2.12.8", "2.11.12", "2.13.0-RC3") +crossScalaVersions in ThisBuild := List("2.12.8", "2.11.12", "2.13.0") lazy val xml = crossProject(JSPlatform, JVMPlatform) .withoutSuffixFor(JVMPlatform) From 0a8ba0d37cdbc936a5d55af122cf5f17c8a64f50 Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Fri, 7 Jun 2019 18:08:36 -0400 Subject: [PATCH 338/789] Use Scala 2.13.0 --- .travis.yml | 2 +- README.md | 2 +- build.sbt | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 9401fdafb..0d13e6abd 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,7 +6,7 @@ jdk: scala: - 2.12.8 - - 2.13.0-RC3 + - 2.13.0 - 0.15.0-RC1 env: diff --git a/README.md b/README.md index 6a3d1c824..0013ffcaf 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ scala-xml [![Travis](https://img.shields.io/travis/scala/scala-xml.svg)](https://travis-ci.org/scala/scala-xml) [![latest release for 2.11](https://img.shields.io/maven-central/v/org.scala-lang.modules/scala-xml_2.11.svg?label=scala+2.11)](http://mvnrepository.com/artifact/org.scala-lang.modules/scala-xml_2.11) [![latest release for 2.12](https://img.shields.io/maven-central/v/org.scala-lang.modules/scala-xml_2.12.svg?label=scala+2.12)](http://mvnrepository.com/artifact/org.scala-lang.modules/scala-xml_2.12) -[![latest release for 2.13.0-RC3](https://img.shields.io/maven-central/v/org.scala-lang.modules/scala-xml_2.13.0-RC3.svg?label=scala+2.13.0-RC3)](http://mvnrepository.com/artifact/org.scala-lang.modules/scala-xml_2.13.0-RC3) +[![latest release for 2.13.0](https://img.shields.io/maven-central/v/org.scala-lang.modules/scala-xml_2.13.0.svg?label=scala+2.13.0)](http://mvnrepository.com/artifact/org.scala-lang.modules/scala-xml_2.13.0) [![Gitter](https://badges.gitter.im/Join+Chat.svg)](https://gitter.im/scala/scala-xml) ========= diff --git a/build.sbt b/build.sbt index f47b6fb3a..8397b845a 100644 --- a/build.sbt +++ b/build.sbt @@ -2,7 +2,7 @@ import sbtcrossproject.CrossType import sbtcrossproject.CrossPlugin.autoImport.crossProject import ScalaModulePlugin._ -crossScalaVersions in ThisBuild := List("2.12.8", "2.13.0-RC3") +crossScalaVersions in ThisBuild := List("2.12.8", "2.13.0") lazy val configSettings: Seq[Setting[_]] = Seq( unmanagedSourceDirectories ++= { From 1f7e4c3c52e6abf20f379c3671dc713f726195ab Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Tue, 18 Jun 2019 15:13:23 -0400 Subject: [PATCH 339/789] Use openjdk8 in Travis --- .travis.yml | 2 +- admin/README.md | 3 +-- admin/build.sh | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 0d13e6abd..97ff62774 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,7 @@ language: scala jdk: - - oraclejdk8 + - openjdk8 - openjdk11 scala: diff --git a/admin/README.md b/admin/README.md index 3e9d1bfa2..2659187a7 100644 --- a/admin/README.md +++ b/admin/README.md @@ -23,8 +23,7 @@ After these steps, your `.travis.yml` should contain config of the form: language: scala jdk: - - openjdk6 - - oraclejdk8 + - openjdk8 scala: - 2.11.12 diff --git a/admin/build.sh b/admin/build.sh index 01548ad8d..8dedd052f 100755 --- a/admin/build.sh +++ b/admin/build.sh @@ -16,7 +16,7 @@ set -e # of the existing tag. Then a new tag can be created for that commit, e.g., `v1.2.3#2.13.0-M5`. # Everything after the `#` in the tag name is ignored. -if [[ "$TRAVIS_JDK_VERSION" == "oraclejdk8" && "$TRAVIS_SCALA_VERSION" =~ 2\.1[23]\..* ]]; then +if [[ "$TRAVIS_JDK_VERSION" == "openjdk8" && "$TRAVIS_SCALA_VERSION" =~ 2\.1[23]\..* ]]; then RELEASE_COMBO=true; fi From 9c0b747e71c0bd6d9214790487e9af01d8c67f9d Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Tue, 18 Jun 2019 16:04:14 -0400 Subject: [PATCH 340/789] Use openjdk8 in Travis --- .travis.yml | 2 +- admin/README.md | 3 +-- admin/build.sh | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 3dc48bdd6..274b1b794 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,7 +9,7 @@ addons: hostname: localhost.local jdk: - - openjdk6 + - openjdk8 - oraclejdk8 - openjdk11 diff --git a/admin/README.md b/admin/README.md index 3e9d1bfa2..2659187a7 100644 --- a/admin/README.md +++ b/admin/README.md @@ -23,8 +23,7 @@ After these steps, your `.travis.yml` should contain config of the form: language: scala jdk: - - openjdk6 - - oraclejdk8 + - openjdk8 scala: - 2.11.12 diff --git a/admin/build.sh b/admin/build.sh index 2ebd80311..315ca0eb1 100755 --- a/admin/build.sh +++ b/admin/build.sh @@ -17,7 +17,7 @@ set -e # Everything after the `#` in the tag name is ignored. if [[ "$TRAVIS_JDK_VERSION" == "openjdk6" && "$TRAVIS_SCALA_VERSION" =~ 2\.11\..* \ - || "$TRAVIS_JDK_VERSION" == "oraclejdk8" && "$TRAVIS_SCALA_VERSION" =~ 2\.1[23]\..* ]]; then + || "$TRAVIS_JDK_VERSION" == "openjdk8" && "$TRAVIS_SCALA_VERSION" =~ 2\.1[23]\..* ]]; then RELEASE_COMBO=true; fi From 58f7f6f71f2c9f028c205ac2bca69e29f199f1dc Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Tue, 18 Jun 2019 18:26:30 -0400 Subject: [PATCH 341/789] Revert openjdk8 since it's not available on Ubuntu 12 precise --- .travis.yml | 2 +- admin/README.md | 3 ++- admin/build.sh | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 274b1b794..3dc48bdd6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,7 +9,7 @@ addons: hostname: localhost.local jdk: - - openjdk8 + - openjdk6 - oraclejdk8 - openjdk11 diff --git a/admin/README.md b/admin/README.md index 2659187a7..3e9d1bfa2 100644 --- a/admin/README.md +++ b/admin/README.md @@ -23,7 +23,8 @@ After these steps, your `.travis.yml` should contain config of the form: language: scala jdk: - - openjdk8 + - openjdk6 + - oraclejdk8 scala: - 2.11.12 diff --git a/admin/build.sh b/admin/build.sh index 315ca0eb1..2ebd80311 100755 --- a/admin/build.sh +++ b/admin/build.sh @@ -17,7 +17,7 @@ set -e # Everything after the `#` in the tag name is ignored. if [[ "$TRAVIS_JDK_VERSION" == "openjdk6" && "$TRAVIS_SCALA_VERSION" =~ 2\.11\..* \ - || "$TRAVIS_JDK_VERSION" == "openjdk8" && "$TRAVIS_SCALA_VERSION" =~ 2\.1[23]\..* ]]; then + || "$TRAVIS_JDK_VERSION" == "oraclejdk8" && "$TRAVIS_SCALA_VERSION" =~ 2\.1[23]\..* ]]; then RELEASE_COMBO=true; fi From adf8bf15092cde759f626526482701b190730868 Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Thu, 20 Jun 2019 09:26:29 +0200 Subject: [PATCH 342/789] Update sbt-dotty to 0.3.3 --- project/plugins.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/plugins.sbt b/project/plugins.sbt index 0d0418e6d..9e1bbf191 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -6,4 +6,4 @@ val scalaJSVersion = addSbtPlugin("org.scala-js" % "sbt-scalajs" % scalaJSVersion) addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "0.6.0") addSbtPlugin("org.scala-lang.modules" % "sbt-scala-module" % "2.0.0") -addSbtPlugin("ch.epfl.lamp" % "sbt-dotty" % "0.3.2") +addSbtPlugin("ch.epfl.lamp" % "sbt-dotty" % "0.3.3") From 4b47d1f73393deb541e6ec300c25eac2480ce3f5 Mon Sep 17 00:00:00 2001 From: Seth Tisue Date: Thu, 20 Jun 2019 09:36:39 +0200 Subject: [PATCH 343/789] bump Dotty version --- .travis.yml | 2 +- build.sbt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 97ff62774..db3d2abce 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,7 +7,7 @@ jdk: scala: - 2.12.8 - 2.13.0 - - 0.15.0-RC1 + - 0.16.0-RC3 env: global: diff --git a/build.sbt b/build.sbt index 8397b845a..cb3d84d41 100644 --- a/build.sbt +++ b/build.sbt @@ -30,7 +30,7 @@ lazy val xml = crossProject(JSPlatform, JVMPlatform) .settings(scalaModuleSettings) .jvmSettings(scalaModuleSettingsJVM) .jvmSettings( - crossScalaVersions += "0.15.0-RC1" + crossScalaVersions += "0.16.0-RC3" ) .settings( name := "scala-xml", From 0fbb3fa2cf20518fb67eb82991ba4f936492c3b0 Mon Sep 17 00:00:00 2001 From: Seth Tisue Date: Thu, 20 Jun 2019 09:36:54 +0200 Subject: [PATCH 344/789] bump sbt version --- project/build.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/build.properties b/project/build.properties index c66f82ead..c9f29468d 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version=1.3.0-RC1 +sbt.version=1.3.0-RC2 From e73ebfd3a601dc88dcf6264129f98d6242f9deac Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Fri, 21 Jun 2019 13:24:45 -0400 Subject: [PATCH 345/789] Remove deprecated methods from Elem --- build.sbt | 2 ++ shared/src/main/scala/scala/xml/Elem.scala | 18 ++---------------- .../test/scala/scala/xml/AttributeTest.scala | 2 +- .../test/scala/scala/xml/ShouldCompile.scala | 2 +- 4 files changed, 6 insertions(+), 18 deletions(-) diff --git a/build.sbt b/build.sbt index cb3d84d41..013873cf0 100644 --- a/build.sbt +++ b/build.sbt @@ -89,6 +89,8 @@ lazy val xml = crossProject(JSPlatform, JVMPlatform) exclude[MissingTypesProblem]("scala.xml.SpecialNode"), exclude[MissingTypesProblem]("scala.xml.Text"), exclude[MissingTypesProblem]("scala.xml.Unparsed"), + exclude[DirectMissingMethodProblem]("scala.xml.Elem.this"), + exclude[DirectMissingMethodProblem]("scala.xml.Elem.apply"), // Scala 2.12 deprecated mutable.Stack, so we broke // binary compatibility for 2.0.0 in the following way: exclude[IncompatibleMethTypeProblem]("scala.xml.parsing.FactoryAdapter.scopeStack_="), diff --git a/shared/src/main/scala/scala/xml/Elem.scala b/shared/src/main/scala/scala/xml/Elem.scala index cf156ed63..c111393ff 100755 --- a/shared/src/main/scala/scala/xml/Elem.scala +++ b/shared/src/main/scala/scala/xml/Elem.scala @@ -20,16 +20,6 @@ import scala.collection.Seq * syntax `case Elem(prefix, label, attribs, scope, child @ _*) => ...` */ object Elem { - /** - * Build an Elem, setting its minimizeEmpty property to `true` if it has no children. Note that this - * default may not be exactly what you want, as some XML dialects don't permit some elements to be minimized. - * - * @deprecated This factory method is retained for backward compatibility; please use the other one, with which you - * can specify your own preference for minimizeEmpty. - */ - @deprecated("Use the other apply method in this object", "2.10.0") - def apply(prefix: String, label: String, attributes: MetaData, scope: NamespaceBinding, child: Node*): Elem = - apply(prefix, label, attributes, scope, child.isEmpty, child: _*) def apply(prefix: String, label: String, attributes: MetaData, scope: NamespaceBinding, minimizeEmpty: Boolean, child: Node*): Elem = new Elem(prefix, label, attributes, scope, minimizeEmpty, child: _*) @@ -91,12 +81,8 @@ class Elem( attributes1: MetaData, override val scope: NamespaceBinding, val minimizeEmpty: Boolean, - val child: Node*) - extends Node with Serializable { - @deprecated("This constructor is retained for backward compatibility. Please use the primary constructor, which lets you specify your own preference for `minimizeEmpty`.", "2.10.0") - def this(prefix: String, label: String, attributes: MetaData, scope: NamespaceBinding, child: Node*) = { - this(prefix, label, attributes, scope, child.isEmpty, child: _*) - } + val child: Node* +) extends Node with Serializable { final override def doCollectNamespaces = true final override def doTransform = true diff --git a/shared/src/test/scala/scala/xml/AttributeTest.scala b/shared/src/test/scala/scala/xml/AttributeTest.scala index 159946231..e1e7f911a 100644 --- a/shared/src/test/scala/scala/xml/AttributeTest.scala +++ b/shared/src/test/scala/scala/xml/AttributeTest.scala @@ -95,7 +95,7 @@ class AttributeTest { def attributePathDuplicateAttribute: Unit = { val xml = Elem(null, "foo", Attribute("bar", Text("apple"), - Attribute("bar", Text("orange"), Null)), TopScope) + Attribute("bar", Text("orange"), Null)), TopScope, true) assertEquals(Group(Text("apple")), xml \ "@bar") } diff --git a/shared/src/test/scala/scala/xml/ShouldCompile.scala b/shared/src/test/scala/scala/xml/ShouldCompile.scala index 3ba589a90..0059a0b83 100644 --- a/shared/src/test/scala/scala/xml/ShouldCompile.scala +++ b/shared/src/test/scala/scala/xml/ShouldCompile.scala @@ -58,7 +58,7 @@ class t2281B { // SI-5858 object SI_5858 { - new Elem(null, null, Null, TopScope, Nil: _*) // was ambiguous + new Elem(null, null, Null, TopScope, true, Nil: _*) // was ambiguous } class Floozy { From fee065c6f5a7b9cae12413468e2325f0ba6eed74 Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Fri, 21 Jun 2019 15:03:25 -0400 Subject: [PATCH 346/789] Add config for CircleCI --- .circleci/config.yml | 115 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 115 insertions(+) create mode 100644 .circleci/config.yml diff --git a/.circleci/config.yml b/.circleci/config.yml new file mode 100644 index 000000000..e73d224e3 --- /dev/null +++ b/.circleci/config.yml @@ -0,0 +1,115 @@ +version: 2.1 + +executors: + scala_jdk8_executor: + docker: + - image: circleci/openjdk:8-jdk-node + scala_jdk11_executor: + docker: + - image: circleci/openjdk:11-jdk + +commands: + sbt_cmd: + description: "Build with sbt" + parameters: + scala_version: + type: string + default: 2.12.8 + sbt_tasks: + type: string + default: update compile test:compile test doc package + steps: + - restore_cache: + keys: + - sbt-deps-v1-{{ checksum "build.sbt" }} + - sbt-deps-v1- + - run: sbt ++<< parameters.scala_version >> << parameters.sbt_tasks >> + - save_cache: + key: sbt-deps-v1-{{ checksum "build.sbt" }} + paths: + - "~/.ivy2/cache" + - "~/.sbt" + - "~/.m2" + +jobs: + scala_job: + executor: scala_<>_executor + parameters: + scala_version: + description: "Scala version" + default: 2.12.8 + type: string + java_version: + description: "Java version" + default: jdk8 + type: string + steps: + - checkout + - run: java -version + - sbt_cmd: + scala_version: << parameters.scala_version >> + sbt_tasks: xml/update xml/compile xml/test:compile xml/test xml/doc xml/package + scalajs_job: + executor: scala_jdk8_executor + parameters: + scala_version: + description: "Scala version" + default: 2.12.8 + type: string + scalajs_version: + description: "ScalaJS version" + default: 0.6.28 + type: string + environment: + SCALAJS_VERSION: << parameters.scalajs_version >> + steps: + - checkout + - run: java -version + - run: node -v + - sbt_cmd: + scala_version: << parameters.scala_version >> + sbt_tasks: xmlJS/update xmlJS/compile xmlJS/test:compile xmlJS/test xmlJS/doc xmlJS/package + +workflows: + build: + jobs: + - scala_job: + name: 2.12.8 + java_version: jdk8 + scala_version: 2.12.8 + - scala_job: + name: 2.13.0 + java_version: jdk8 + scala_version: 2.13.0 + - scala_job: + name: dotty_0.16 + java_version: jdk8 + scala_version: 0.16.0-RC3 + - scala_job: + name: jdk11_2.12.8 + java_version: jdk11 + scala_version: 2.12.8 + - scala_job: + name: jdk11_2.13.0 + java_version: jdk11 + scala_version: 2.13.0 + - scala_job: + name: dotty_0.16 + java_version: jdk11 + scala_version: 0.16.0-RC3 + - scalajs_job: + name: sjs0.6_2.12 + scala_version: 2.12.8 + scalajs_version: 0.6.28 + - scalajs_job: + name: sjs0.6_2.13 + scala_version: 2.13.0 + scalajs_version: 0.6.28 + - scalajs_job: + name: sjs1.0.0-M8_2.12 + scala_version: 2.12.8 + scalajs_version: 1.0.0-M8 + - scalajs_job: + name: sjs1.0.0-M8_2.13 + scala_version: 2.13.0 + scalajs_version: 1.0.0-M8 From 3240670296e9e35b0aceb21e27a5582a8afbcfcc Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Fri, 21 Jun 2019 15:28:28 -0400 Subject: [PATCH 347/789] Fix names of dotty jobs in Circle --- .circleci/config.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index e73d224e3..58d3f8b50 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -82,7 +82,7 @@ workflows: java_version: jdk8 scala_version: 2.13.0 - scala_job: - name: dotty_0.16 + name: dotty java_version: jdk8 scala_version: 0.16.0-RC3 - scala_job: @@ -94,7 +94,7 @@ workflows: java_version: jdk11 scala_version: 2.13.0 - scala_job: - name: dotty_0.16 + name: jdk11_dotty java_version: jdk11 scala_version: 0.16.0-RC3 - scalajs_job: From 1c420431fc62cf275f8a14f6eefb3a9f1621b8cf Mon Sep 17 00:00:00 2001 From: Philippus Baalman Date: Mon, 24 Jun 2019 10:24:39 +0200 Subject: [PATCH 348/789] Fix link to latest release for scala 2.13 --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 0013ffcaf..adfde8bae 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ scala-xml [![Travis](https://img.shields.io/travis/scala/scala-xml.svg)](https://travis-ci.org/scala/scala-xml) [![latest release for 2.11](https://img.shields.io/maven-central/v/org.scala-lang.modules/scala-xml_2.11.svg?label=scala+2.11)](http://mvnrepository.com/artifact/org.scala-lang.modules/scala-xml_2.11) [![latest release for 2.12](https://img.shields.io/maven-central/v/org.scala-lang.modules/scala-xml_2.12.svg?label=scala+2.12)](http://mvnrepository.com/artifact/org.scala-lang.modules/scala-xml_2.12) -[![latest release for 2.13.0](https://img.shields.io/maven-central/v/org.scala-lang.modules/scala-xml_2.13.0.svg?label=scala+2.13.0)](http://mvnrepository.com/artifact/org.scala-lang.modules/scala-xml_2.13.0) +[![latest release for 2.13](https://img.shields.io/maven-central/v/org.scala-lang.modules/scala-xml_2.13.svg?label=scala+2.13)](http://mvnrepository.com/artifact/org.scala-lang.modules/scala-xml_2.13) [![Gitter](https://badges.gitter.im/Join+Chat.svg)](https://gitter.im/scala/scala-xml) ========= From d51da3a396c2ae52bc13b11fa4e7bd81ca1adaa6 Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Tue, 25 Jun 2019 11:14:44 -0400 Subject: [PATCH 349/789] Remove Elem.xmlToProcess and Elem.processXml --- build.sbt | 2 ++ shared/src/main/scala/scala/xml/Elem.scala | 26 ---------------------- 2 files changed, 2 insertions(+), 26 deletions(-) diff --git a/build.sbt b/build.sbt index 013873cf0..9efc50531 100644 --- a/build.sbt +++ b/build.sbt @@ -91,6 +91,8 @@ lazy val xml = crossProject(JSPlatform, JVMPlatform) exclude[MissingTypesProblem]("scala.xml.Unparsed"), exclude[DirectMissingMethodProblem]("scala.xml.Elem.this"), exclude[DirectMissingMethodProblem]("scala.xml.Elem.apply"), + exclude[DirectMissingMethodProblem]("scala.xml.Elem.processXml"), + exclude[DirectMissingMethodProblem]("scala.xml.Elem.xmlToProcess"), // Scala 2.12 deprecated mutable.Stack, so we broke // binary compatibility for 2.0.0 in the following way: exclude[IncompatibleMethTypeProblem]("scala.xml.parsing.FactoryAdapter.scopeStack_="), diff --git a/shared/src/main/scala/scala/xml/Elem.scala b/shared/src/main/scala/scala/xml/Elem.scala index c111393ff..2b1f895c2 100755 --- a/shared/src/main/scala/scala/xml/Elem.scala +++ b/shared/src/main/scala/scala/xml/Elem.scala @@ -28,32 +28,6 @@ object Elem { case _: SpecialNode | _: Group => None case _ => Some((n.prefix, n.label, n.attributes, n.scope, n.child.toSeq)) } - - import scala.sys.process._ - import scala.language.implicitConversions - - /** - * Implicitly convert a [[scala.xml.Elem]] into a - * [[scala.sys.process.ProcessBuilder]]. This is done by obtaining the text - * elements of the element, trimming spaces, and then converting the result - * from string to a process. Importantly, tags are completely ignored, so - * they cannot be used to separate parameters. - */ - @deprecated("To create a scala.sys.process.Process from an xml.Elem, please use Process(elem.text.trim).", "2.11.0") - implicit def xmlToProcess(command: scala.xml.Elem): ProcessBuilder = Process(command.text.trim) - - @deprecated("To create a scala.sys.process.Process from an xml.Elem, please use Process(elem.text.trim).", "2.11.0") - implicit def processXml(p: Process.type): { def apply(command: Elem): ProcessBuilder } = new { - /** - * Creates a [[scala.sys.process.ProcessBuilder]] from a Scala XML Element. - * This can be used as a way to template strings. - * - * @example {{{ - * apply( {dxPath.absolutePath} --dex --output={classesDexPath.absolutePath} {classesMinJarPath.absolutePath}) - * }}} - */ - def apply(command: Elem): ProcessBuilder = Process(command.text.trim) - } } /** From fed1d504dcb46c4275769466caa8b23b72d857ff Mon Sep 17 00:00:00 2001 From: Philippus Baalman Date: Mon, 24 Jun 2019 10:24:39 +0200 Subject: [PATCH 350/789] Fix link to latest release for scala 2.13 --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 0d7a8046c..f103ad9a0 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ scala-xml [![Travis](https://img.shields.io/travis/scala/scala-xml.svg)](https://travis-ci.org/scala/scala-xml) [![latest release for 2.11](https://img.shields.io/maven-central/v/org.scala-lang.modules/scala-xml_2.11.svg?label=scala+2.11)](http://mvnrepository.com/artifact/org.scala-lang.modules/scala-xml_2.11) [![latest release for 2.12](https://img.shields.io/maven-central/v/org.scala-lang.modules/scala-xml_2.12.svg?label=scala+2.12)](http://mvnrepository.com/artifact/org.scala-lang.modules/scala-xml_2.12) -[![latest release for 2.13.0](https://img.shields.io/maven-central/v/org.scala-lang.modules/scala-xml_2.13.0.svg?label=scala+2.13.0)](http://mvnrepository.com/artifact/org.scala-lang.modules/scala-xml_2.13.0) +[![latest release for 2.13](https://img.shields.io/maven-central/v/org.scala-lang.modules/scala-xml_2.13.svg?label=scala+2.13)](http://mvnrepository.com/artifact/org.scala-lang.modules/scala-xml_2.13) [![Gitter](https://badges.gitter.im/Join+Chat.svg)](https://gitter.im/scala/scala-xml) ========= From 273bd64ce39cd7425d789019653625b45d30f7e8 Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Tue, 25 Jun 2019 11:55:37 -0400 Subject: [PATCH 351/789] Deprecate scala.xml.persistent --- .../src/main/scala/scala/xml/persistent/CachedFileStorage.scala | 1 + shared/src/main/scala/scala/xml/persistent/Index.scala | 1 + shared/src/main/scala/scala/xml/persistent/SetStorage.scala | 1 + 3 files changed, 3 insertions(+) diff --git a/shared/src/main/scala/scala/xml/persistent/CachedFileStorage.scala b/shared/src/main/scala/scala/xml/persistent/CachedFileStorage.scala index 1a932cc34..41f8d96a7 100644 --- a/shared/src/main/scala/scala/xml/persistent/CachedFileStorage.scala +++ b/shared/src/main/scala/scala/xml/persistent/CachedFileStorage.scala @@ -26,6 +26,7 @@ import scala.collection.Iterator * * @author Burak Emir */ +@deprecated("This class will be removed", "1.3.0") abstract class CachedFileStorage(private val file1: File) extends Thread { private val file2 = new File(file1.getParent, file1.getName + "$") diff --git a/shared/src/main/scala/scala/xml/persistent/Index.scala b/shared/src/main/scala/scala/xml/persistent/Index.scala index 249e0b765..f121333ce 100644 --- a/shared/src/main/scala/scala/xml/persistent/Index.scala +++ b/shared/src/main/scala/scala/xml/persistent/Index.scala @@ -13,4 +13,5 @@ package persistent /** * an Index returns some unique key that is part of a node */ +@deprecated("This class will be removed", "1.3.0") abstract class Index[A] extends Function1[Node, A] {} diff --git a/shared/src/main/scala/scala/xml/persistent/SetStorage.scala b/shared/src/main/scala/scala/xml/persistent/SetStorage.scala index abe44be53..c8c44b164 100644 --- a/shared/src/main/scala/scala/xml/persistent/SetStorage.scala +++ b/shared/src/main/scala/scala/xml/persistent/SetStorage.scala @@ -19,6 +19,7 @@ import java.io.File * * @author Burak Emir */ +@deprecated("This class will be removed", "1.3.0") class SetStorage(file: File) extends CachedFileStorage(file) { private val theSet = mutable.HashSet[Node]() From adb40f3f78fff373a7536fe73ccc3d1a4e3233da Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Fri, 21 Jun 2019 15:25:03 -0400 Subject: [PATCH 352/789] Fix SI-5645 Don't escape quotes in PCDATA --- jvm/src/test/scala/scala/xml/XMLTest.scala | 5 ++++- shared/src/main/scala/scala/xml/Text.scala | 2 +- shared/src/main/scala/scala/xml/Utility.scala | 14 +++++++++++++ shared/src/test/scala/scala/xml/XMLTest.scala | 20 +++++++++++++++++-- 4 files changed, 37 insertions(+), 4 deletions(-) diff --git a/jvm/src/test/scala/scala/xml/XMLTest.scala b/jvm/src/test/scala/scala/xml/XMLTest.scala index efdb8165a..0ca1ff1ce 100644 --- a/jvm/src/test/scala/scala/xml/XMLTest.scala +++ b/jvm/src/test/scala/scala/xml/XMLTest.scala @@ -315,7 +315,10 @@ class XMLTestJVM { val inputStream = new java.io.ByteArrayInputStream(outputStream.toByteArray) val streamReader = new java.io.InputStreamReader(inputStream, XML.encoding) - assertEquals(xml.toString, XML.load(streamReader).toString) + def unescapeQuotes(str: String) = + """.r.replaceFirstIn(str, "\"") + val xmlFixed = unescapeQuotes(xml.toString) + assertEquals(xmlFixed, XML.load(streamReader).toString) } @UnitTest diff --git a/shared/src/main/scala/scala/xml/Text.scala b/shared/src/main/scala/scala/xml/Text.scala index 8e2ee498f..caa7fa294 100644 --- a/shared/src/main/scala/scala/xml/Text.scala +++ b/shared/src/main/scala/scala/xml/Text.scala @@ -23,7 +23,7 @@ class Text(data: String) extends Atom[String](data) { * specification. */ override def buildString(sb: StringBuilder): StringBuilder = - Utility.escape(data, sb) + Utility.escapeText(data, sb) } /** diff --git a/shared/src/main/scala/scala/xml/Utility.scala b/shared/src/main/scala/scala/xml/Utility.scala index 776da5a7a..43776af94 100755 --- a/shared/src/main/scala/scala/xml/Utility.scala +++ b/shared/src/main/scala/scala/xml/Utility.scala @@ -127,6 +127,20 @@ object Utility extends AnyRef with parsing.TokenTests { } } + /** + * Appends escaped string to `s`, but not ". + */ + final def escapeText(text: String, s: StringBuilder): StringBuilder = { + val escTextMap = escMap - '"' // Remove quotes from escMap + text.iterator.foldLeft(s) { (s, c) => + escTextMap.get(c) match { + case Some(str) => s ++= str + case _ if c >= ' ' || "\n\r\t".contains(c) => s += c + case _ => s // noop + } + } + } + /** * Appends unescaped string to `s`, `amp` becomes `&`, * `lt` becomes `<` etc.. diff --git a/shared/src/test/scala/scala/xml/XMLTest.scala b/shared/src/test/scala/scala/xml/XMLTest.scala index a9644ca6d..1e0a304c7 100644 --- a/shared/src/test/scala/scala/xml/XMLTest.scala +++ b/shared/src/test/scala/scala/xml/XMLTest.scala @@ -307,10 +307,10 @@ class XMLTest { @UnitTest def escape = assertEquals(""" - "Come, come again, whoever you are, come! + "Come, come again, whoever you are, come! Heathen, fire worshipper or idolatrous, come! Come even if you broke your penitence a hundred times, -Ours is the portal of hope, come as you are." +Ours is the portal of hope, come as you are." Mevlana Celaleddin Rumi""", .attributes) } + @UnitTest + def t5645: Unit = { + + val bar = "baz" + val script = + + val expected = + """|""".stripMargin + + assertEquals(expected, script.toString) + } + @UnitTest def t5843: Unit = { val foo = scala.xml.Attribute(null, "foo", "1", scala.xml.Null) From 10f10d478cdafc035989d2f9e42ab6ae658b1542 Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Thu, 27 Jun 2019 21:06:28 +0200 Subject: [PATCH 353/789] Update sbt-scalajs-crossproject to 0.6.1 --- project/plugins.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/plugins.sbt b/project/plugins.sbt index 9e1bbf191..21860801c 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -4,6 +4,6 @@ val scalaJSVersion = Option(System.getenv("SCALAJS_VERSION")).filter(_.nonEmpty).getOrElse("0.6.28") addSbtPlugin("org.scala-js" % "sbt-scalajs" % scalaJSVersion) -addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "0.6.0") +addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "0.6.1") addSbtPlugin("org.scala-lang.modules" % "sbt-scala-module" % "2.0.0") addSbtPlugin("ch.epfl.lamp" % "sbt-dotty" % "0.3.3") From 2998e2921225d640646510e508df9ad94501e3a7 Mon Sep 17 00:00:00 2001 From: Eugene Yokota Date: Mon, 8 Jul 2019 13:45:59 -0400 Subject: [PATCH 354/789] Use AdoptOpenJDK JDK 8 and 11 Ref https://github.com/scala/scala-dev/issues/587 Fixes https://github.com/scala/scala-xml/issues/335 --- .travis.yml | 40 +++++++++++++++++++++++----------------- admin/build.sh | 2 +- 2 files changed, 24 insertions(+), 18 deletions(-) diff --git a/.travis.yml b/.travis.yml index db3d2abce..95ce06264 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,9 +1,5 @@ language: scala -jdk: - - openjdk8 - - openjdk11 - scala: - 2.12.8 - 2.13.0 @@ -19,20 +15,29 @@ env: - secure: "Xw7rI/qlML1nD2e2XwlakkhKAWNGZKqqE+Q3ntTvFpfHryl7KLCvVzJ4LIavnL6kGJaWOgy9vlSoEWn5g9nqHSfE31C/k5pY5nTMAKiwiJzfAS+r0asKXW2gmKhwtcTBkqyLVOZLCJSPVlFRQyfBJHY+Fs0L3KWcnMQgtBlyDhU=" matrix: # The empty SCALAJS_VERSION will only compile for the JVM - - SCALAJS_VERSION= - - SCALAJS_VERSION=0.6.28 - - SCALAJS_VERSION=1.0.0-M8 + - SCALAJS_VERSION= ADOPTOPENJDK=8 + - SCALAJS_VERSION=0.6.28 ADOPTOPENJDK=8 + - SCALAJS_VERSION=1.0.0-M8 ADOPTOPENJDK=8 + - SCALAJS_VERSION= ADOPTOPENJDK=11 matrix: exclude: - - jdk: openjdk11 - env: SCALAJS_VERSION=0.6.28 - - jdk: openjdk11 - env: SCALAJS_VERSION=1.0.0-M8 - - scala: 0.15.0-RC1 - env: SCALAJS_VERSION=0.6.28 - - scala: 0.15.0-RC1 - env: SCALAJS_VERSION=1.0.0-M8 + - scala: 0.16.0-RC3 + env: SCALAJS_VERSION=0.6.28 ADOPTOPENJDK=8 + - scala: 0.16.0-RC3 + env: SCALAJS_VERSION=1.0.0-M8 ADOPTOPENJDK=8 + +before_install: + # adding $HOME/.sdkman to cache would create an empty directory, which interferes with the initial installation + - "[[ -d $HOME/.sdkman/bin ]] || rm -rf $HOME/.sdkman/" + - curl -sL https://get.sdkman.io | bash + - echo sdkman_auto_answer=true > "$HOME/.sdkman/etc/config" + - source "$HOME/.sdkman/bin/sdkman-init.sh" + +install: + - sdk install java $(sdk list java | grep -o "$ADOPTOPENJDK\.[0-9\.]*hs-adpt" | head -1) + - unset JAVA_HOME + - java -Xmx32m -version script: - admin/build.sh @@ -42,5 +47,6 @@ before_cache: - find $HOME/.ivy2/cache -name "ivydata-*.properties" | xargs rm cache: directories: - - $HOME/.ivy2/cache - - $HOME/.sbt + - $HOME/.ivy2/cache + - $HOME/.sbt + - $HOME/.sdkman diff --git a/admin/build.sh b/admin/build.sh index 8dedd052f..812454f4b 100755 --- a/admin/build.sh +++ b/admin/build.sh @@ -16,7 +16,7 @@ set -e # of the existing tag. Then a new tag can be created for that commit, e.g., `v1.2.3#2.13.0-M5`. # Everything after the `#` in the tag name is ignored. -if [[ "$TRAVIS_JDK_VERSION" == "openjdk8" && "$TRAVIS_SCALA_VERSION" =~ 2\.1[23]\..* ]]; then +if [[ "$ADOPTOPENJDK" == "8" && "$TRAVIS_SCALA_VERSION" =~ 2\.1[23]\..* ]]; then RELEASE_COMBO=true; fi From 6a5dce62323951e37080b7f60cc6f0c298a1706d Mon Sep 17 00:00:00 2001 From: Scala Steward <43047562+scala-steward@users.noreply.github.com> Date: Fri, 19 Jul 2019 01:36:19 +0200 Subject: [PATCH 355/789] Update sbt to 1.3.0-RC3 (#337) --- project/build.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/build.properties b/project/build.properties index c9f29468d..36b2e30f6 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version=1.3.0-RC2 +sbt.version=1.3.0-RC3 From 6350cca5aee5a19f044480f295c866a94b063fc8 Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Tue, 25 Jun 2019 13:30:21 -0400 Subject: [PATCH 356/789] Drop scala.xml.persistent --- build.sbt | 4 + .../xml/persistent/CachedFileStorage.scala | 135 ------------------ .../scala/scala/xml/persistent/Index.scala | 16 --- .../scala/xml/persistent/SetStorage.scala | 42 ------ 4 files changed, 4 insertions(+), 193 deletions(-) delete mode 100644 shared/src/main/scala/scala/xml/persistent/CachedFileStorage.scala delete mode 100644 shared/src/main/scala/scala/xml/persistent/Index.scala delete mode 100644 shared/src/main/scala/scala/xml/persistent/SetStorage.scala diff --git a/build.sbt b/build.sbt index 9efc50531..22f3c1d62 100644 --- a/build.sbt +++ b/build.sbt @@ -89,6 +89,10 @@ lazy val xml = crossProject(JSPlatform, JVMPlatform) exclude[MissingTypesProblem]("scala.xml.SpecialNode"), exclude[MissingTypesProblem]("scala.xml.Text"), exclude[MissingTypesProblem]("scala.xml.Unparsed"), + // Miscellaneous deprecations + exclude[MissingClassProblem]("scala.xml.persistent.CachedFileStorage"), + exclude[MissingClassProblem]("scala.xml.persistent.Index"), + exclude[MissingClassProblem]("scala.xml.persistent.SetStorage"), exclude[DirectMissingMethodProblem]("scala.xml.Elem.this"), exclude[DirectMissingMethodProblem]("scala.xml.Elem.apply"), exclude[DirectMissingMethodProblem]("scala.xml.Elem.processXml"), diff --git a/shared/src/main/scala/scala/xml/persistent/CachedFileStorage.scala b/shared/src/main/scala/scala/xml/persistent/CachedFileStorage.scala deleted file mode 100644 index 1a932cc34..000000000 --- a/shared/src/main/scala/scala/xml/persistent/CachedFileStorage.scala +++ /dev/null @@ -1,135 +0,0 @@ -/* __ *\ -** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2002-2019, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** -** /____/\___/_/ |_/____/_/ | | ** -** |/ ** -\* */ - -package scala -package xml -package persistent - -import java.io.{ File, FileOutputStream } -import java.nio.channels.Channels -import java.lang.Thread - -import scala.collection.Iterator - -/** - * Mutable storage of immutable xml trees. Everything is kept in memory, - * with a thread periodically checking for changes and writing to file. - * - * To ensure atomicity, two files are used, `filename1` and `'$'+filename1`. - * The implementation switches between the two, deleting the older one - * after a complete dump of the database has been written. - * - * @author Burak Emir - */ -abstract class CachedFileStorage(private val file1: File) extends Thread { - - private val file2 = new File(file1.getParent, file1.getName + "$") - - /** - * Either equals `file1` or `file2`, references the next file in which - * updates will be stored. - */ - private var theFile: File = null - - private def switch() = { theFile = if (theFile == file1) file2 else file1; } - - /** this storage modified since last modification check */ - protected var dirty = false - - /** period between modification checks, in milliseconds */ - protected val interval = 1000 - - /** - * finds and loads the storage file. subclasses should call this method - * prior to any other, but only once, to obtain the initial sequence of nodes. - */ - protected def initialNodes: Iterator[Node] = (file1.exists, file2.exists) match { - case (false, false) => - theFile = file1 - Iterator.empty - case (true, true) if (file1.lastModified < file2.lastModified) => - theFile = file2 - load - case (true, _) => - theFile = file1 - load - case _ => - theFile = file2 - load - } - - /** returns an iterator over the nodes in this storage */ - def nodes: Iterator[Node] - - /** adds a node, setting this.dirty to true as a side effect */ - def +=(e: Node): Unit - - /** removes a tree, setting this.dirty to true as a side effect */ - def -=(e: Node): Unit - - /* loads and parses XML from file */ - private def load: Iterator[Node] = { - import scala.io.Source - import scala.xml.parsing.ConstructingParser - // println("[load]\nloading " + theFile) - val src = Source.fromFile(theFile) - // println("parsing " + theFile) - val res = ConstructingParser.fromSource(src, preserveWS = false).document.docElem(0) - switch() - // println("[load done]") - res.child.iterator - } - - /** saves the XML to file */ - private def save() = if (this.dirty) { - // println("[save]\ndeleting " + theFile) - theFile.delete() - // println("creating new " + theFile) - theFile.createNewFile() - val fos = new FileOutputStream(theFile) - val c = fos.getChannel() - - // @todo: optimize - val storageNode = { nodes.toList } - val w = Channels.newWriter(c, "utf-8") - XML.write(w, storageNode, "utf-8", xmlDecl = true, doctype = null) - - // println("writing to " + theFile) - - w.close - c.close - fos.close - dirty = false - switch() - // println("[save done]") - } - - /** - * Run method of the thread. remember to use `start()` to start a thread, - * not `run`. - */ - override def run = { - // println("[run]\nstarting storage thread, checking every " + interval + " ms") - while (true) { - Thread.sleep(this.interval.toLong) - save() - } - } - - /** - * Force writing of contents to the file, even if there has not been any - * update. - */ - def flush() = { - this.dirty = true - save() - } - - @deprecated("This method and its usages will be removed. Use a debugger to debug code.", "2.11") - def log(msg: String): Unit = {} -} diff --git a/shared/src/main/scala/scala/xml/persistent/Index.scala b/shared/src/main/scala/scala/xml/persistent/Index.scala deleted file mode 100644 index 249e0b765..000000000 --- a/shared/src/main/scala/scala/xml/persistent/Index.scala +++ /dev/null @@ -1,16 +0,0 @@ -/* __ *\ -** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2002-2019, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** -** /____/\___/_/ |_/____/_/ | | ** -** |/ ** -\* */ - -package scala -package xml -package persistent - -/** - * an Index returns some unique key that is part of a node - */ -abstract class Index[A] extends Function1[Node, A] {} diff --git a/shared/src/main/scala/scala/xml/persistent/SetStorage.scala b/shared/src/main/scala/scala/xml/persistent/SetStorage.scala deleted file mode 100644 index abe44be53..000000000 --- a/shared/src/main/scala/scala/xml/persistent/SetStorage.scala +++ /dev/null @@ -1,42 +0,0 @@ -/* __ *\ -** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2002-2019, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** -** /____/\___/_/ |_/____/_/ | | ** -** |/ ** -\* */ - -package scala -package xml -package persistent - -import scala.collection.mutable -import java.io.File - -/** - * A persistent store with set semantics. This class allows to add and remove - * trees, but never contains two structurally equal trees. - * - * @author Burak Emir - */ -class SetStorage(file: File) extends CachedFileStorage(file) { - - private val theSet = mutable.HashSet[Node]() - - // initialize - - { - val it = super.initialNodes - dirty = it.hasNext - theSet ++= it - } - - /* forwarding methods to hashset*/ - - def +=(e: Node): Unit = synchronized { this.dirty = true; theSet += e } - - def -=(e: Node): Unit = synchronized { this.dirty = true; theSet -= e } - - def nodes = synchronized { theSet.iterator } - -} From affdf2a5086973f055c416ac865c150a12904ee1 Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Tue, 6 Aug 2019 12:05:37 -0400 Subject: [PATCH 357/789] Update dotty 0.17.0-RC1 --- .circleci/config.yml | 4 ++-- .travis.yml | 6 +++--- build.sbt | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 58d3f8b50..acd8ab56e 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -84,7 +84,7 @@ workflows: - scala_job: name: dotty java_version: jdk8 - scala_version: 0.16.0-RC3 + scala_version: 0.17.0-RC1 - scala_job: name: jdk11_2.12.8 java_version: jdk11 @@ -96,7 +96,7 @@ workflows: - scala_job: name: jdk11_dotty java_version: jdk11 - scala_version: 0.16.0-RC3 + scala_version: 0.17.0-RC1 - scalajs_job: name: sjs0.6_2.12 scala_version: 2.12.8 diff --git a/.travis.yml b/.travis.yml index 95ce06264..7bd988dae 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,7 +3,7 @@ language: scala scala: - 2.12.8 - 2.13.0 - - 0.16.0-RC3 + - 0.17.0-RC1 env: global: @@ -22,9 +22,9 @@ env: matrix: exclude: - - scala: 0.16.0-RC3 + - scala: 0.17.0-RC1 env: SCALAJS_VERSION=0.6.28 ADOPTOPENJDK=8 - - scala: 0.16.0-RC3 + - scala: 0.17.0-RC1 env: SCALAJS_VERSION=1.0.0-M8 ADOPTOPENJDK=8 before_install: diff --git a/build.sbt b/build.sbt index 22f3c1d62..61e5a2154 100644 --- a/build.sbt +++ b/build.sbt @@ -30,7 +30,7 @@ lazy val xml = crossProject(JSPlatform, JVMPlatform) .settings(scalaModuleSettings) .jvmSettings(scalaModuleSettingsJVM) .jvmSettings( - crossScalaVersions += "0.16.0-RC3" + crossScalaVersions += "0.17.0-RC1" ) .settings( name := "scala-xml", From af640cba5e1a43910a9144af7d6e95ce0e2cfdf1 Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Thu, 8 Aug 2019 08:56:32 -0400 Subject: [PATCH 358/789] Update 2.12.9 --- .circleci/config.yml | 18 +++++++++--------- .travis.yml | 2 +- build.sbt | 2 +- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index acd8ab56e..e5c58df20 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -14,7 +14,7 @@ commands: parameters: scala_version: type: string - default: 2.12.8 + default: 2.12.9 sbt_tasks: type: string default: update compile test:compile test doc package @@ -37,7 +37,7 @@ jobs: parameters: scala_version: description: "Scala version" - default: 2.12.8 + default: 2.12.9 type: string java_version: description: "Java version" @@ -54,7 +54,7 @@ jobs: parameters: scala_version: description: "Scala version" - default: 2.12.8 + default: 2.12.9 type: string scalajs_version: description: "ScalaJS version" @@ -74,9 +74,9 @@ workflows: build: jobs: - scala_job: - name: 2.12.8 + name: 2.12.9 java_version: jdk8 - scala_version: 2.12.8 + scala_version: 2.12.9 - scala_job: name: 2.13.0 java_version: jdk8 @@ -86,9 +86,9 @@ workflows: java_version: jdk8 scala_version: 0.17.0-RC1 - scala_job: - name: jdk11_2.12.8 + name: jdk11_2.12.9 java_version: jdk11 - scala_version: 2.12.8 + scala_version: 2.12.9 - scala_job: name: jdk11_2.13.0 java_version: jdk11 @@ -99,7 +99,7 @@ workflows: scala_version: 0.17.0-RC1 - scalajs_job: name: sjs0.6_2.12 - scala_version: 2.12.8 + scala_version: 2.12.9 scalajs_version: 0.6.28 - scalajs_job: name: sjs0.6_2.13 @@ -107,7 +107,7 @@ workflows: scalajs_version: 0.6.28 - scalajs_job: name: sjs1.0.0-M8_2.12 - scala_version: 2.12.8 + scala_version: 2.12.9 scalajs_version: 1.0.0-M8 - scalajs_job: name: sjs1.0.0-M8_2.13 diff --git a/.travis.yml b/.travis.yml index 7bd988dae..9c839c897 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,7 @@ language: scala scala: - - 2.12.8 + - 2.12.9 - 2.13.0 - 0.17.0-RC1 diff --git a/build.sbt b/build.sbt index 61e5a2154..1361a671f 100644 --- a/build.sbt +++ b/build.sbt @@ -2,7 +2,7 @@ import sbtcrossproject.CrossType import sbtcrossproject.CrossPlugin.autoImport.crossProject import ScalaModulePlugin._ -crossScalaVersions in ThisBuild := List("2.12.8", "2.13.0") +crossScalaVersions in ThisBuild := List("2.12.9", "2.13.0") lazy val configSettings: Seq[Setting[_]] = Seq( unmanagedSourceDirectories ++= { From f454dd679a138815d98df08837fc8451d3020bd4 Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Tue, 27 Aug 2019 15:51:52 -0400 Subject: [PATCH 359/789] Add support for autoAPIMappings Publish info.apiURL in ivy data, by adding apiURL to build.sbt --- build.sbt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/build.sbt b/build.sbt index 1361a671f..ba9be57f5 100644 --- a/build.sbt +++ b/build.sbt @@ -107,6 +107,9 @@ lazy val xml = crossProject(JSPlatform, JVMPlatform) ) }, + apiURL := Some( + url(s"""https://scala.github.io/scala-xml/api/${"-.*".r.replaceAllIn(version.value, "")}/""") + ), apiMappings ++= Map( scalaInstance.value.libraryJar -> url(s"http://www.scala-lang.org/api/${scalaVersion.value}/") From 4d45d613f2e002de8079044ca348d56a4cd0c54c Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Thu, 29 Aug 2019 04:34:23 +0200 Subject: [PATCH 360/789] Update sbt-dotty to 0.3.4 --- project/plugins.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/plugins.sbt b/project/plugins.sbt index 21860801c..4bb390d59 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -6,4 +6,4 @@ val scalaJSVersion = addSbtPlugin("org.scala-js" % "sbt-scalajs" % scalaJSVersion) addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "0.6.1") addSbtPlugin("org.scala-lang.modules" % "sbt-scala-module" % "2.0.0") -addSbtPlugin("ch.epfl.lamp" % "sbt-dotty" % "0.3.3") +addSbtPlugin("ch.epfl.lamp" % "sbt-dotty" % "0.3.4") From 4dc4372ad683ac905d9de82e3803966104da9993 Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Fri, 13 Sep 2019 09:44:05 -0400 Subject: [PATCH 361/789] Add Coursier to Travis cache --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 9c839c897..30be86699 100644 --- a/.travis.yml +++ b/.travis.yml @@ -50,3 +50,4 @@ cache: - $HOME/.ivy2/cache - $HOME/.sbt - $HOME/.sdkman + - $HOME/.coursier From 5948e730673eb8c4d65cdeb46b05ac998e4fb3fb Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Fri, 13 Sep 2019 12:18:20 -0400 Subject: [PATCH 362/789] Remove lock files for Coursier in Travis --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 30be86699..7a6500752 100644 --- a/.travis.yml +++ b/.travis.yml @@ -45,6 +45,7 @@ script: before_cache: - find $HOME/.sbt -name "*.lock" | xargs rm - find $HOME/.ivy2/cache -name "ivydata-*.properties" | xargs rm + - find $HOME/.coursier -name "*.lock" | xargs rm cache: directories: - $HOME/.ivy2/cache From 9e07d8f0c1dd28a40f127971675b5ea78996ed82 Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Fri, 13 Sep 2019 12:19:46 -0400 Subject: [PATCH 363/789] Add Coursier to Circle cache --- .circleci/config.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index e5c58df20..639118c93 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -27,6 +27,7 @@ commands: - save_cache: key: sbt-deps-v1-{{ checksum "build.sbt" }} paths: + - "~/.coursier" - "~/.ivy2/cache" - "~/.sbt" - "~/.m2" From 279dacd601ecc0de203539dbb2e26ac7ced40e88 Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Fri, 13 Sep 2019 14:50:28 -0400 Subject: [PATCH 364/789] Temporarily disable Coursier in sbt 1.3.0 --- build.sbt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/build.sbt b/build.sbt index ba9be57f5..a9d546eb0 100644 --- a/build.sbt +++ b/build.sbt @@ -36,6 +36,10 @@ lazy val xml = crossProject(JSPlatform, JVMPlatform) name := "scala-xml", version := "2.0.0-SNAPSHOT", + // See https://github.com/sbt/sbt/issues/4995 + // doc task broken in sbt 1.3.0-RC4 and Scala 2.12.9 + useCoursier := false, + scalacOptions ++= { val opts = if (isDotty.value) From d19b7f6249fd82d4bc30439a766b235be96b9b8c Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Wed, 4 Sep 2019 22:12:01 +0200 Subject: [PATCH 365/789] Update sbt to 1.3.0 --- project/build.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/build.properties b/project/build.properties index 36b2e30f6..080a737ed 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version=1.3.0-RC3 +sbt.version=1.3.0 From 7ee7852c4e70a2dc1e68c76466a770616741b03d Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Fri, 13 Sep 2019 15:03:43 -0400 Subject: [PATCH 366/789] Update dotty 0.18.1-RC1 Change abstract isNullable in scala.xml.dtd.impl.Base to a def. Co-authored-by: Jamie Thompson --- .circleci/config.yml | 4 ++-- .travis.yml | 6 +++--- build.sbt | 3 ++- shared/src/main/scala/scala/xml/dtd/impl/Base.scala | 2 +- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 639118c93..715992acd 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -85,7 +85,7 @@ workflows: - scala_job: name: dotty java_version: jdk8 - scala_version: 0.17.0-RC1 + scala_version: 0.18.1-RC1 - scala_job: name: jdk11_2.12.9 java_version: jdk11 @@ -97,7 +97,7 @@ workflows: - scala_job: name: jdk11_dotty java_version: jdk11 - scala_version: 0.17.0-RC1 + scala_version: 0.18.1-RC1 - scalajs_job: name: sjs0.6_2.12 scala_version: 2.12.9 diff --git a/.travis.yml b/.travis.yml index 7a6500752..bfb72d9e6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,7 +3,7 @@ language: scala scala: - 2.12.9 - 2.13.0 - - 0.17.0-RC1 + - 0.18.1-RC1 env: global: @@ -22,9 +22,9 @@ env: matrix: exclude: - - scala: 0.17.0-RC1 + - scala: 0.18.1-RC1 env: SCALAJS_VERSION=0.6.28 ADOPTOPENJDK=8 - - scala: 0.17.0-RC1 + - scala: 0.18.1-RC1 env: SCALAJS_VERSION=1.0.0-M8 ADOPTOPENJDK=8 before_install: diff --git a/build.sbt b/build.sbt index a9d546eb0..bf2eb7c83 100644 --- a/build.sbt +++ b/build.sbt @@ -11,6 +11,7 @@ lazy val configSettings: Seq[Setting[_]] = Seq( Seq( CrossVersion.partialVersion(sv) match { case Some((2, 13)) => file(dir.getPath ++ "-2.13+") + case Some((0, _)) => file(dir.getPath ++ "-2.13+") case _ => file(dir.getPath ++ "-2.13-") }, CrossVersion.partialVersion(sv) match { @@ -30,7 +31,7 @@ lazy val xml = crossProject(JSPlatform, JVMPlatform) .settings(scalaModuleSettings) .jvmSettings(scalaModuleSettingsJVM) .jvmSettings( - crossScalaVersions += "0.17.0-RC1" + crossScalaVersions += "0.18.1-RC1" ) .settings( name := "scala-xml", diff --git a/shared/src/main/scala/scala/xml/dtd/impl/Base.scala b/shared/src/main/scala/scala/xml/dtd/impl/Base.scala index 3283e2ba0..7bfb995d6 100644 --- a/shared/src/main/scala/scala/xml/dtd/impl/Base.scala +++ b/shared/src/main/scala/scala/xml/dtd/impl/Base.scala @@ -20,7 +20,7 @@ private[dtd] abstract class Base { type _regexpT <: RegExp abstract class RegExp { - val isNullable: Boolean + def isNullable: Boolean } object Alt { From 3987a9ecb17b467bde9f53691418c511a62ba612 Mon Sep 17 00:00:00 2001 From: Lukas Rytz Date: Fri, 13 Sep 2019 12:53:23 +0200 Subject: [PATCH 367/789] New scala-module-plugin with sbt-ci-release / travisci / dynver / header --- .travis.yml | 26 +++++-------- admin/README.md | 68 ---------------------------------- admin/api-docs.sh | 71 ----------------------------------- admin/build.sh | 54 --------------------------- admin/encryptEnvVars.sh | 11 ------ admin/genKeyPair.sh | 41 -------------------- admin/gpg.sbt | 2 - admin/publish-settings.sbt | 8 ---- admin/pubring.asc | 18 --------- admin/secring.asc.enc | Bin 1872 -> 0 bytes build.sbt | 23 ++++-------- build.sh | 74 +++++++++++++++++++++++++++++++++++++ project/plugins.sbt | 6 +-- 13 files changed, 92 insertions(+), 310 deletions(-) delete mode 100644 admin/README.md delete mode 100755 admin/api-docs.sh delete mode 100755 admin/build.sh delete mode 100755 admin/encryptEnvVars.sh delete mode 100755 admin/genKeyPair.sh delete mode 100644 admin/gpg.sbt delete mode 100644 admin/publish-settings.sbt delete mode 100644 admin/pubring.asc delete mode 100644 admin/secring.asc.enc create mode 100755 build.sh diff --git a/.travis.yml b/.travis.yml index bfb72d9e6..f53ae079b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,24 +1,15 @@ language: scala scala: + - 0.18.1-RC1 - 2.12.9 - 2.13.0 - - 0.18.1-RC1 env: - global: - # PGP_PASSPHRASE - - secure: "BYC1kEnHjNrINrHYWPGEuTTJ2V340/0ByzqeihLecjoZ75yrjWdsh6MI1JEUWgv5kb+58vLzib21JfnjsPK6Yb2bSXuCFCsEtJNh6RJKgxkWlCOzfTSh5I2wl7PCjRClRL6gseX2uTSvFjL4Z//pmxwxeXlLp7voQe4QAUq1+sE=" - # SONA_USER - - secure: "OpBwPc1GNvauageYOH3RscAa7wpZxgpmqDz15aigIKLNWzAhAtVUx0MleZ8rQeoqml6nrAvlnzuVHjKL2lVcjMPpjUis7bcQ5UAGK7tZK8x+qZNQxXmpXu8+pENwQA2yFaqt/xy7K5jFOrHJHTRxcPnyVG1yKakPWz53PPYUwbc=" - # SONA_PASS - - secure: "Xw7rI/qlML1nD2e2XwlakkhKAWNGZKqqE+Q3ntTvFpfHryl7KLCvVzJ4LIavnL6kGJaWOgy9vlSoEWn5g9nqHSfE31C/k5pY5nTMAKiwiJzfAS+r0asKXW2gmKhwtcTBkqyLVOZLCJSPVlFRQyfBJHY+Fs0L3KWcnMQgtBlyDhU=" - matrix: - # The empty SCALAJS_VERSION will only compile for the JVM - - SCALAJS_VERSION= ADOPTOPENJDK=8 - - SCALAJS_VERSION=0.6.28 ADOPTOPENJDK=8 - - SCALAJS_VERSION=1.0.0-M8 ADOPTOPENJDK=8 - - SCALAJS_VERSION= ADOPTOPENJDK=11 + - SCALAJS_VERSION= ADOPTOPENJDK=8 + - SCALAJS_VERSION=0.6.28 ADOPTOPENJDK=8 + - SCALAJS_VERSION=1.0.0-M8 ADOPTOPENJDK=8 + - SCALAJS_VERSION= ADOPTOPENJDK=11 matrix: exclude: @@ -31,20 +22,21 @@ before_install: # adding $HOME/.sdkman to cache would create an empty directory, which interferes with the initial installation - "[[ -d $HOME/.sdkman/bin ]] || rm -rf $HOME/.sdkman/" - curl -sL https://get.sdkman.io | bash - - echo sdkman_auto_answer=true > "$HOME/.sdkman/etc/config" + - echo sdkman_auto_answer=true > $HOME/.sdkman/etc/config - source "$HOME/.sdkman/bin/sdkman-init.sh" install: - sdk install java $(sdk list java | grep -o "$ADOPTOPENJDK\.[0-9\.]*hs-adpt" | head -1) - unset JAVA_HOME - java -Xmx32m -version + - git fetch --tags # get all tags for sbt-dynver -script: - - admin/build.sh +script: ./build.sh before_cache: - find $HOME/.sbt -name "*.lock" | xargs rm - find $HOME/.ivy2/cache -name "ivydata-*.properties" | xargs rm + - rm -f $HOME/.ivy2/.sbt.ivy.lock - find $HOME/.coursier -name "*.lock" | xargs rm cache: directories: diff --git a/admin/README.md b/admin/README.md deleted file mode 100644 index 2659187a7..000000000 --- a/admin/README.md +++ /dev/null @@ -1,68 +0,0 @@ -## Tag Driven Releasing - -### Initial setup for the repository - -To configure tag driven releases from Travis CI. - - 1. Generate a key pair for this repository with `./admin/genKeyPair.sh`. - Edit `.travis.yml` and `admin/build.sh` as prompted. - 1. Publish the public key to https://pgp.mit.edu - 1. Store other secrets as encrypted environment variables with `./admin/encryptEnvVars.sh`. - Edit `.travis.yml` as prompted. - 1. Edit `.travis.yml` to use `./admin/build.sh` as the build script, - and edit that script to use the tasks required for this project. - Ensure that `RELEASE_COMBO` is `true` for build matrix combinations - that should be released to sonatype (when building a tag). - -It is important to add comments in `.travis.yml` to identify the name -of each environment variable encoded in a `secure` section. - -After these steps, your `.travis.yml` should contain config of the form: - -``` -language: scala - -jdk: - - openjdk8 - -scala: - - 2.11.12 - - 2.12.6 - -env: - global: - # PGP_PASSPHRASE - - secure: "XXXXXX" - # SONA_USER - - secure: "XXXXXX" - # SONA_PASS - - secure: "XXXXXX" - -script: admin/build.sh - -notifications: - email: - - a@b.com -``` - -If Sonatype credentials change in the future, step 3 can be repeated -without generating a new key. - -### Testing - - 1. Follow the release process below to create a dummy release (e.g., `v0.1.0-TEST1`). - Confirm that the release was staged to Sonatype but do not release it to Maven - central. Instead, drop the staging repository. - -### Performing a release - - 1. Create a GitHub "Release" with a corresponding tag (e.g., `v0.1.1`) via the GitHub - web interface. - 1. The release will be published using the Scala and JVM version combinations specified - in the travis build matrix where `[ "$RELEASE_COMBO" = "true" ]`. - - If you need to release against a different Scala version, create a new commit that modifies - `.travis.yml` and push a new tag, e.g., `v1.2.3#2.13.0-M5`. The suffix after `#` is ignored. - 1. Travis CI will schedule a build for this release. Review the build logs. - 1. Log into https://oss.sonatype.org/ and identify the staging repository. - 1. Sanity check its contents. - 1. Release staging repository to Maven and send out release announcement. diff --git a/admin/api-docs.sh b/admin/api-docs.sh deleted file mode 100755 index ece2b11e1..000000000 --- a/admin/api-docs.sh +++ /dev/null @@ -1,71 +0,0 @@ -#!/bin/bash - -### - # Copyright (C) 2019 LAMP/EPFL and Lightbend, Inc. - # - # Build API docs for scala-xml. - # - # Runs Scaladoc, then commits to the gh-pages branch, so they are - # published to https://docs.scala-lang.org/scala-xml/api/1.0.0/ - # - # Usage: - # ./admin/api-docs.sh SCALA-XML-VERSION SCALA-VERSION - # - # SCALA-XML-VERSION is the scala-xml version, e.g. v1.0.5 - # SCALA-VERSION is the Scala version, e.g. 2.11.12 - # - # Example: - # ./admin/api-docs.sh v1.0.6 2.12.0 - # - # Required dependencies: - # - sbt 1.x - # - git - # - rsync - ## - -set -e - -if [ -z "$1" ]; then - echo "Error: Missing scala-xml version" >&2 - exit 1 -elif [ -z "$2" ]; then - echo "Error: Missing Scala version" >&2 - exit 1 -fi - -SCALA_XML_VERSION=${1%%#*} # Cleanup tags, e.g. v1.1.1#2.13.0-M5#8 -SCALA_VERSION=$2 - -TARGET_DIR=${TARGET_DIR-./jvm/target} -API_DIR=$TARGET_DIR/scala-${SCALA_VERSION%.*}/api -GIT_DIR=${GIT_DIR-./jvm/target} -DOC_DIR=$GIT_DIR/api/${SCALA_XML_VERSION#v} - -git checkout $SCALA_XML_VERSION -sbt "++$SCALA_VERSION" doc -mkdir $GIT_DIR/api -rsync -a $API_DIR/ $DOC_DIR/ -echo "Initializing git directory in $GIT_DIR" -cd $GIT_DIR -git init -git remote add upstream git@github.com:scala/scala-xml.git -git fetch upstream gh-pages -git checkout gh-pages -git add -A ./api -git commit -m"Scaladoc for $SCALA_XML_VERSION with Scala $SCALA_VERSION" -echo "Please review the commit in $GIT_DIR and push upstream" - -exit 0 -## End of script - -## Rebuild the universe with: - -env JAVA_HOME=$(/usr/libexec/java_home -v 1.6) TARGET_DIR=./target ./admin/api-docs.sh v1.0.1 2.11.12 -env JAVA_HOME=$(/usr/libexec/java_home -v 1.6) TARGET_DIR=./target ./admin/api-docs.sh v1.0.2 2.11.12 -env JAVA_HOME=$(/usr/libexec/java_home -v 1.6) TARGET_DIR=./target ./admin/api-docs.sh v1.0.3 2.11.12 -env JAVA_HOME=$(/usr/libexec/java_home -v 1.6) TARGET_DIR=./target ./admin/api-docs.sh v1.0.4 2.11.12 -env JAVA_HOME=$(/usr/libexec/java_home -v 1.6) TARGET_DIR=./target ./admin/api-docs.sh v1.0.5 2.11.12 -env JAVA_HOME=$(/usr/libexec/java_home -v 1.8) TARGET_DIR=./target ./admin/api-docs.sh v1.0.6 2.12.0 -env JAVA_HOME=$(/usr/libexec/java_home -v 1.8) ./admin/api-docs.sh v1.1.0 2.12.4 -env JAVA_HOME=$(/usr/libexec/java_home -v 1.8) ./admin/api-docs.sh v1.1.1 2.12.6 -env JAVA_HOME=$(/usr/libexec/java_home -v 1.8) ./admin/api-docs.sh v1.2.0 2.12.8 diff --git a/admin/build.sh b/admin/build.sh deleted file mode 100755 index 812454f4b..000000000 --- a/admin/build.sh +++ /dev/null @@ -1,54 +0,0 @@ -#!/bin/bash - -set -e - -# Builds of tagged revisions are published to sonatype staging. - -# Travis runs a build on revisions, including on new tags. -# Builds for a tag have TRAVIS_TAG defined, which we use for identifying tagged builds. -# Checking the local git clone would not work because git on travis does not fetch tags. - -# The version number to be published is extracted from the tag, e.g., v1.2.3 publishes -# version 1.2.3 on all combinations of the travis matrix where `[ "$RELEASE_COMBO" = "true" ]`. - -# In order to build a previously released version against a new (binary incompatible) Scala release, -# a new commit that modifies (and prunes) the Scala versions in .travis.yml needs to be added on top -# of the existing tag. Then a new tag can be created for that commit, e.g., `v1.2.3#2.13.0-M5`. -# Everything after the `#` in the tag name is ignored. - -if [[ "$ADOPTOPENJDK" == "8" && "$TRAVIS_SCALA_VERSION" =~ 2\.1[23]\..* ]]; then - RELEASE_COMBO=true; -fi - -if [ "$SCALAJS_VERSION" = "" ]; then - projectPrefix="xml" -else - projectPrefix="xmlJS" -fi - -verPat="[0-9]+\.[0-9]+\.[0-9]+(-[A-Za-z0-9-]+)?" -tagPat="^v$verPat(#.*)?$" - -if [[ "$TRAVIS_TAG" =~ $tagPat ]]; then - tagVer=${TRAVIS_TAG} - tagVer=${tagVer#v} # Remove `v` at beginning. - tagVer=${tagVer%%#*} # Remove anything after `#`. - publishVersion='set every version := "'$tagVer'"' - - if [ "$RELEASE_COMBO" = "true" ]; then - currentJvmVer=$(java -version 2>&1 | awk -F '"' '/version/ {print $2}' | sed 's/^1\.//' | sed 's/[^0-9].*//') - echo "Releasing $tagVer with Scala $TRAVIS_SCALA_VERSION on Java version $currentJvmVer." - - publishTask="$projectPrefix/publishSigned" - - cat admin/gpg.sbt >> project/plugins.sbt - cp admin/publish-settings.sbt . - - # Copied from the output of genKeyPair.sh - K=$encrypted_6b8d67feaab7_key - IV=$encrypted_6b8d67feaab7_iv - openssl aes-256-cbc -K $K -iv $IV -in admin/secring.asc.enc -out admin/secring.asc -d - fi -fi - -sbt "++$TRAVIS_SCALA_VERSION" "$publishVersion" "$projectPrefix/clean" "$projectPrefix/test" "$projectPrefix/publishLocal" "$publishTask" diff --git a/admin/encryptEnvVars.sh b/admin/encryptEnvVars.sh deleted file mode 100755 index b62566798..000000000 --- a/admin/encryptEnvVars.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/bash -# -# Encrypt sonatype credentials so that they can be -# decrypted in trusted builds on Travis CI. -# -set -e - -read -s -p 'SONA_USER: ' SONA_USER -travis encrypt SONA_USER="$SONA_USER" -read -s -p 'SONA_PASS: ' SONA_PASS -travis encrypt SONA_PASS="$SONA_PASS" diff --git a/admin/genKeyPair.sh b/admin/genKeyPair.sh deleted file mode 100755 index 17db3f39b..000000000 --- a/admin/genKeyPair.sh +++ /dev/null @@ -1,41 +0,0 @@ -#!/bin/bash -# -# Generates a key pair for this repository to sign artifacts. -# Encrypt the private key and its passphrase in trusted builds -# on Travis CI. -# -set -e - -# Based on https://gist.github.com/kzap/5819745: -function promptDelete() { - if [[ -f "$1" ]]; then - echo About to delete $1, Enter for okay / CTRL-C to cancel - read - rm "$1" - fi -} -for f in admin/secring.asc.enc admin/secring.asc admin/pubring.asc; do promptDelete "$f"; done - -echo Generating key pair. Please enter 1. repo name 2. scala-internals@googlegroups.com, 3. a new passphrase -echo Be careful when using special characters in the passphrase, see http://docs.travis-ci.com/user/encryption-keys/#Note-on-escaping-certain-symbols -cp admin/gpg.sbt project -sbt 'set pgpReadOnly := false' \ - 'set pgpPublicRing := file("admin/pubring.asc")' \ - 'set pgpSecretRing := file("admin/secring.asc")' \ - 'pgp-cmd gen-key' -rm project/gpg.sbt - -echo ============================================================================================ -echo Encrypting admin/secring.asc. Update K and IV variables in admin/build.sh accordingly. -echo ============================================================================================ -travis encrypt-file admin/secring.asc -rm admin/secring.asc -mv secring.asc.enc admin - -echo ============================================================================================ -echo Encrypting environment variables. Add each to a line in .travis.yml. Include a comment -echo with the name of the corresponding variable -echo ============================================================================================ -read -s -p 'PGP_PASSPHRASE: ' PGP_PASSPHRASE -travis encrypt PGP_PASSPHRASE="$PGP_PASSPHRASE" - diff --git a/admin/gpg.sbt b/admin/gpg.sbt deleted file mode 100644 index 68ae46411..000000000 --- a/admin/gpg.sbt +++ /dev/null @@ -1,2 +0,0 @@ - -addSbtPlugin("com.typesafe.sbt" % "sbt-pgp" % "0.8.3") // only added when publishing, see build.sh diff --git a/admin/publish-settings.sbt b/admin/publish-settings.sbt deleted file mode 100644 index 026c6ee3e..000000000 --- a/admin/publish-settings.sbt +++ /dev/null @@ -1,8 +0,0 @@ -def env(key: String) = Option(System.getenv(key)).getOrElse("") - -inThisBuild(Seq( - pgpPassphrase := Some(env("PGP_PASSPHRASE").toArray), - pgpPublicRing := file("admin/pubring.asc"), - pgpSecretRing := file("admin/secring.asc"), - credentials += Credentials("Sonatype Nexus Repository Manager", "oss.sonatype.org", env("SONA_USER"), env("SONA_PASS")) -)) diff --git a/admin/pubring.asc b/admin/pubring.asc deleted file mode 100644 index df4501ad6..000000000 --- a/admin/pubring.asc +++ /dev/null @@ -1,18 +0,0 @@ ------BEGIN PGP PUBLIC KEY BLOCK----- -Version: BCPG v1.49 - -mQENBFVQohwBCACi9Hupi/27JFgcRypkruHZNKXa4+QO380B5hp0UFUzJHBqEvUd -p9niOq30yCgfByLiPv2qr7g1lAg2DltH9WyN5zhp3MzOt/m1w66IwZqgCS364gtD -56udK2R6YCFMfiJxGXFsSbStfIoD8N5S++NJGv0GuFc2m3sSuTunRFoRWN4Dce0g -a16nyVR2dPfqOkL7LLzMR4Tl8VQFb36WPrFBmJKzZWxt0r2pQhEDMwItuZeKrBhm -K/RZWtNqiBO61JCBHfWZdpduUcTjlr5cW+jkRtw8La0qgglJcSN/sErQamAtU6vo -sdTZ2aQQZnYyVBt00yrLV+9Dq/dBS6cfV9NHABEBAAG0LHNjYWxhLXhtbCA8c2Nh -bGEtaW50ZXJuYWxzQGdvb2dsZWdyb3Vwcy5jb20+iQEcBBMBAgAGBQJVUKIcAAoJ -EO/sfqhmzEOuHtkH/25VVvDzMo85E8KlCtsnkD5Alb83zV1XF6+mZaRHikzKkQRz -phZEGaU6ee3V6CH5qXsmKTU2B1WaOYIdPkuBjwdpRPJbaX0zzrWUCCv1vLKDb+z2 -nlcg0AehMUM3UinbGR6QCh06p3O/tBokJvZM+Ng3pkXtLOS4HphRfindpy7+u1Y/ -szcIQS88AH1g5xPt8nwrh9VQbrYD04K20mLckGIWnjSzgFB9hntMF5arAP9Q1RkS -52xiOZB8RTZZCkFeHIdMKjjmoM9Vn/3JZzsy8Om4FWYa/l2fEExxKWFupvQetjFk -VTTOG+T7/WwVPQQ0xQLROgWL7z5UgxHly64WClA= -=/6/b ------END PGP PUBLIC KEY BLOCK----- diff --git a/admin/secring.asc.enc b/admin/secring.asc.enc deleted file mode 100644 index 626ff5d10725214624e7c797a9eb74864127bd10..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1872 zcmV-W2e0@fqpgw+LsRd7u2o)%di3Y_9iX0wgGZTvHLMnHOVRsifjxLtWxXi~jtiA- z#bq1(7NwM*VTQi!XlB8CsKd6Vb?RVs+LcSU9mzPJDW))Y09x4*M_jRHK)t!Hd4Q#^ zO`Scgult5G8x2H&A-0j`lh54Vrp6$rFgVxY6$uvk(})PKqp0haRYw=fux{Ig7Qu6A-9wVubfVV=|G z{{Z;GKKc2I{ka&)nadAV;*EN7&jC)0u}wYPd-5ljH#csr$>A#+8jUmzjBLne>Avff z3?1)>MJ>&-io7mY8FL`pIy-Tn{kTvT#`k}16tuGOF17oD2ZHATYgY;uhAK@rXf}kl zp607sR*Jd2LOK)9pPiB$@4#{4Og(yRHtXuAgTfzmJfJ>*A*eiD8lDSvP8#G$4s3iU zEJ0eveZ&S;+l1zzAc|x=O;DYO_d%VY>1R#%xUm11l13?Pr)58ok6V{A3B{AcPLeOz zHN1P;pm_lsgMQ@gBZ?|Nj&C5`;se!}aM{k)@St|b6>!b>j_Gap>MY?wgi>JVOeq>3y7QnnjZl0{hi zXWt-ZUv$bfpY_hP(%^1SH&F@i{xP{l@P$l5w5ahNHyHWmdMPdNoOEQ-D6Ot~G%!jH z8C=WK?{W(e-#}y}pQxUqRjM6MGWqRnZ2U$a%q|N-F#aCrUA)O#e=F22p06Mx=91=! zp0ee_ zinPL)?)@Q>7zfvkXg+(zjt39zCpg3QfsKSX_EYNI!k`N%2xL~a2oBK(_|TU4E> z-?=Wv{0)yf&29)J#J>mMwR$UB%fxSFDsgPQrN8H@+G7z3$ESL+$b{3%4*?8Sm6E)y zikukNt?wZvD^SgpDH7IMkb|92-dGZ`k3j7$;76!SM{(W!CWcno+}w z2oehz#zkCAYaip?YJds7E}L5Y2C@b~5fW76^s`B>=D4pZ$2-435i0wq0NNeBNvctx zmDF@(NO0g8drhqd5;C4vd5666m(VH0j-$jyZaptkAYq zZUMD=c9deNngez7wj9wG2}4S zY~0z1gifa^iboBmjK8RC0+btk0<64If91L05m61O{WXtiQfE|0n?YUqCHI!b=~S?m zoA_vx?*xLiq$|1`5QNMP6Ex^a&Ys#DiTk>Ch5T@$ekg90Q{+n$?8(el+Ez#ZKV??yD^UK>7g^QMT!iq_w8~%Ft z;e=?o3MaHmjV%^%U8ghL_1v%U4YBdm^hZF}5P-W=XC%;{FCh+tl#$+Kmx?H{USO`4 z3~G!xl?T?kK$Mp8t;mj7)FJgZw`IHv*~N!`3QR`FG-?t^pb>w8+^j9Jk2VKk3k2`x z^Z>-mIhY*18?LHpvCkIoxfJI>8{3KWu_U~3J;jq_{)~myM;Oh zrVpt^YOu3jtsmU`FY>-1AkO4qi4B>Rlp-9&NiC_Cma+CWnu~X?FgLGa(n>9Hnwd)M z7o9CM_iWSfdrm%(X%^6z&p8t$RhU-8a^v0HVA0ZJ@3VcmJy@UZvr4b*@)4%7(C*e# KL)moSr4dnNG@(HN diff --git a/build.sbt b/build.sbt index bf2eb7c83..7ce710144 100644 --- a/build.sbt +++ b/build.sbt @@ -1,8 +1,4 @@ -import sbtcrossproject.CrossType -import sbtcrossproject.CrossPlugin.autoImport.crossProject -import ScalaModulePlugin._ - -crossScalaVersions in ThisBuild := List("2.12.9", "2.13.0") +import sbtcrossproject.CrossPlugin.autoImport.{crossProject, CrossType} lazy val configSettings: Seq[Setting[_]] = Seq( unmanagedSourceDirectories ++= { @@ -28,14 +24,10 @@ lazy val xml = crossProject(JSPlatform, JVMPlatform) .withoutSuffixFor(JVMPlatform) .crossType(CrossType.Full) .in(file(".")) - .settings(scalaModuleSettings) - .jvmSettings(scalaModuleSettingsJVM) - .jvmSettings( - crossScalaVersions += "0.18.1-RC1" - ) + .settings(ScalaModulePlugin.scalaModuleSettings) + .jvmSettings(ScalaModulePlugin.scalaModuleSettingsJVM) .settings( name := "scala-xml", - version := "2.0.0-SNAPSHOT", // See https://github.com/sbt/sbt/issues/4995 // doc task broken in sbt 1.3.0-RC4 and Scala 2.12.9 @@ -54,7 +46,7 @@ lazy val xml = crossProject(JSPlatform, JVMPlatform) scalacOptions in Test += "-Xxml:coalescing", - mimaPreviousVersion := { + scalaModuleMimaPreviousVersion := { if (System.getenv("SCALAJS_VERSION") == "1.0.0-M8") None // No such release yet else Some("1.2.0") }, @@ -108,7 +100,9 @@ lazy val xml = crossProject(JSPlatform, JVMPlatform) exclude[IncompatibleResultTypeProblem]("scala.xml.parsing.FactoryAdapter.hStack"), exclude[IncompatibleResultTypeProblem]("scala.xml.parsing.FactoryAdapter.scopeStack"), exclude[IncompatibleResultTypeProblem]("scala.xml.parsing.FactoryAdapter.attribStack"), - exclude[IncompatibleResultTypeProblem]("scala.xml.parsing.FactoryAdapter.tagStack") + exclude[IncompatibleResultTypeProblem]("scala.xml.parsing.FactoryAdapter.tagStack"), + // New MiMa checks for generic signature changes + exclude[IncompatibleSignatureProblem]("*"), ) }, @@ -159,6 +153,3 @@ lazy val xml = crossProject(JSPlatform, JVMPlatform) fork in Test := false ) .jsConfigure(_.enablePlugins(ScalaJSJUnitPlugin)) - -lazy val xmlJVM = xml.jvm -lazy val xmlJS = xml.js diff --git a/build.sh b/build.sh new file mode 100755 index 000000000..f8949d977 --- /dev/null +++ b/build.sh @@ -0,0 +1,74 @@ +#!/bin/bash + +set -e + +# Builds of tagged revisions are published to sonatype staging. + +# Travis runs a build on new revisions and on new tags, so a tagged revision is built twice. +# Builds for a tag have TRAVIS_TAG defined, which we use for identifying tagged builds. + +# sbt-dynver sets the version number from the tag +# sbt-travisci sets the Scala version from the travis job matrix + +# When a new binary incompatible Scala version becomes available, a previously released version +# can be released using that new Scala version by creating a new tag containing the Scala version +# after a hash, e.g., v1.2.3#2.13.0-M3. In this situation, the first job of the travis job +# matrix builds the release. All other jobs are stopped. Make sure that the first job uses +# the desired JVM version. + +# For normal tags that are cross-built, we release on JDK 8 for Scala 2.x +isReleaseJob() { + if [[ "$ADOPTOPENJDK" == "8" && "$TRAVIS_SCALA_VERSION" =~ ^2\.1[234]\..*$ ]]; then + true + else + false + fi +} + +# For tags that define a Scala version, we pick the jobs of one Scala version (2.13.x) to do the releases +isTagScalaReleaseJob() { + if [[ "$ADOPTOPENJDK" == "8" && "$TRAVIS_SCALA_VERSION" =~ ^2\.13\.[0-9]+$ ]]; then + true + else + false + fi +} + +if [[ "$SCALAJS_VERSION" == "" ]]; then + projectPrefix="xml" +else + projectPrefix="xmlJS" +fi + +verPat="[0-9]+\.[0-9]+\.[0-9]+(-[A-Za-z0-9-]+)?" +tagPat="^v$verPat(#$verPat)?$" + +if [[ "$TRAVIS_TAG" =~ $tagPat ]]; then + releaseTask="ci-release" + tagScalaVer=$(echo $TRAVIS_TAG | sed s/[^#]*// | sed s/^#//) + if [[ "$tagScalaVer" == "" ]]; then + if ! isReleaseJob; then + echo "Not releasing on Java $ADOPTOPENJDK with Scala $TRAVIS_SCALA_VERSION" + exit 0 + fi + else + if isTagScalaReleaseJob; then + setTagScalaVersion='set every scalaVersion := "'$tagScalaVer'"' + else + echo "The releases for Scala $tagScalaVer are built by other jobs in the travis job matrix" + exit 0 + fi + fi +fi + +# default is +publishSigned; we cross-build with travis jobs, not sbt's crossScalaVersions +# re-define pgp files to work around https://github.com/olafurpg/sbt-ci-release/issues/64 +export CI_RELEASE="; set pgpSecretRing := pgpSecretRing.value; set pgpPublicRing := pgpPublicRing.value; $projectPrefix/publishSigned" +export CI_SNAPSHOT_RELEASE="$projectPrefix/publish" + +# default is sonatypeBundleRelease, which closes and releases the staging repo +# see https://github.com/xerial/sbt-sonatype#commands +# for now, until we're confident in the new release scripts, just close the staging repo. +export CI_SONATYPE_RELEASE="; sonatypePrepare; sonatypeBundleUpload; sonatypeClose" + +sbt "$setTagScalaVersion" clean $projectPrefix/test $projectPrefix/publishLocal $releaseTask diff --git a/project/plugins.sbt b/project/plugins.sbt index 4bb390d59..7cae141ef 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,9 +1,7 @@ -addSbtPlugin("com.typesafe.sbt" % "sbt-osgi" % "0.9.5") - val scalaJSVersion = Option(System.getenv("SCALAJS_VERSION")).filter(_.nonEmpty).getOrElse("0.6.28") -addSbtPlugin("org.scala-js" % "sbt-scalajs" % scalaJSVersion) +addSbtPlugin("org.scala-lang.modules" % "sbt-scala-module" % "2.1.1") addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "0.6.1") -addSbtPlugin("org.scala-lang.modules" % "sbt-scala-module" % "2.0.0") +addSbtPlugin("org.scala-js" % "sbt-scalajs" % scalaJSVersion) addSbtPlugin("ch.epfl.lamp" % "sbt-dotty" % "0.3.4") From 8d20556ea88356a61f648bdd9dbfb96ff9d5ffb0 Mon Sep 17 00:00:00 2001 From: Lukas Rytz Date: Fri, 13 Sep 2019 13:16:30 +0200 Subject: [PATCH 368/789] Update Scala to 2.12.10 --- .circleci/config.yml | 18 +++++++++--------- .travis.yml | 2 +- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 715992acd..27a217058 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -14,7 +14,7 @@ commands: parameters: scala_version: type: string - default: 2.12.9 + default: 2.12.10 sbt_tasks: type: string default: update compile test:compile test doc package @@ -38,7 +38,7 @@ jobs: parameters: scala_version: description: "Scala version" - default: 2.12.9 + default: 2.12.10 type: string java_version: description: "Java version" @@ -55,7 +55,7 @@ jobs: parameters: scala_version: description: "Scala version" - default: 2.12.9 + default: 2.12.10 type: string scalajs_version: description: "ScalaJS version" @@ -75,9 +75,9 @@ workflows: build: jobs: - scala_job: - name: 2.12.9 + name: 2.12.10 java_version: jdk8 - scala_version: 2.12.9 + scala_version: 2.12.10 - scala_job: name: 2.13.0 java_version: jdk8 @@ -87,9 +87,9 @@ workflows: java_version: jdk8 scala_version: 0.18.1-RC1 - scala_job: - name: jdk11_2.12.9 + name: jdk11_2.12.10 java_version: jdk11 - scala_version: 2.12.9 + scala_version: 2.12.10 - scala_job: name: jdk11_2.13.0 java_version: jdk11 @@ -100,7 +100,7 @@ workflows: scala_version: 0.18.1-RC1 - scalajs_job: name: sjs0.6_2.12 - scala_version: 2.12.9 + scala_version: 2.12.10 scalajs_version: 0.6.28 - scalajs_job: name: sjs0.6_2.13 @@ -108,7 +108,7 @@ workflows: scalajs_version: 0.6.28 - scalajs_job: name: sjs1.0.0-M8_2.12 - scala_version: 2.12.9 + scala_version: 2.12.10 scalajs_version: 1.0.0-M8 - scalajs_job: name: sjs1.0.0-M8_2.13 diff --git a/.travis.yml b/.travis.yml index f53ae079b..c7d57ba61 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,7 +2,7 @@ language: scala scala: - 0.18.1-RC1 - - 2.12.9 + - 2.12.10 - 2.13.0 env: From 0c03833c71b9399fa1a3c13d7555815ff9a5deed Mon Sep 17 00:00:00 2001 From: Lukas Rytz Date: Tue, 17 Sep 2019 14:04:06 +0200 Subject: [PATCH 369/789] update module plugin to 2.1.2, remove workaround --- build.sh | 3 +-- project/plugins.sbt | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/build.sh b/build.sh index f8949d977..364fb3be4 100755 --- a/build.sh +++ b/build.sh @@ -62,8 +62,7 @@ if [[ "$TRAVIS_TAG" =~ $tagPat ]]; then fi # default is +publishSigned; we cross-build with travis jobs, not sbt's crossScalaVersions -# re-define pgp files to work around https://github.com/olafurpg/sbt-ci-release/issues/64 -export CI_RELEASE="; set pgpSecretRing := pgpSecretRing.value; set pgpPublicRing := pgpPublicRing.value; $projectPrefix/publishSigned" +export CI_RELEASE="$projectPrefix/publishSigned" export CI_SNAPSHOT_RELEASE="$projectPrefix/publish" # default is sonatypeBundleRelease, which closes and releases the staging repo diff --git a/project/plugins.sbt b/project/plugins.sbt index 7cae141ef..65055033d 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,7 +1,7 @@ val scalaJSVersion = Option(System.getenv("SCALAJS_VERSION")).filter(_.nonEmpty).getOrElse("0.6.28") -addSbtPlugin("org.scala-lang.modules" % "sbt-scala-module" % "2.1.1") +addSbtPlugin("org.scala-lang.modules" % "sbt-scala-module" % "2.1.2") addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "0.6.1") addSbtPlugin("org.scala-js" % "sbt-scalajs" % scalaJSVersion) addSbtPlugin("ch.epfl.lamp" % "sbt-dotty" % "0.3.4") From 7772168414710bbd992c2deae64d6d980932ac02 Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Wed, 18 Sep 2019 01:49:28 +0200 Subject: [PATCH 370/789] Update sbt-scalajs to 0.6.29 --- .travis.yml | 4 ++-- project/plugins.sbt | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index c7d57ba61..3a1bd6c86 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,14 +7,14 @@ scala: env: - SCALAJS_VERSION= ADOPTOPENJDK=8 - - SCALAJS_VERSION=0.6.28 ADOPTOPENJDK=8 + - SCALAJS_VERSION=0.6.29 ADOPTOPENJDK=8 - SCALAJS_VERSION=1.0.0-M8 ADOPTOPENJDK=8 - SCALAJS_VERSION= ADOPTOPENJDK=11 matrix: exclude: - scala: 0.18.1-RC1 - env: SCALAJS_VERSION=0.6.28 ADOPTOPENJDK=8 + env: SCALAJS_VERSION=0.6.29 ADOPTOPENJDK=8 - scala: 0.18.1-RC1 env: SCALAJS_VERSION=1.0.0-M8 ADOPTOPENJDK=8 diff --git a/project/plugins.sbt b/project/plugins.sbt index 65055033d..30d03d28b 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,5 +1,5 @@ val scalaJSVersion = - Option(System.getenv("SCALAJS_VERSION")).filter(_.nonEmpty).getOrElse("0.6.28") + Option(System.getenv("SCALAJS_VERSION")).filter(_.nonEmpty).getOrElse("0.6.29") addSbtPlugin("org.scala-lang.modules" % "sbt-scala-module" % "2.1.2") addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "0.6.1") From 55ed22b6386dd8b9c104cd98e9bf03296af559af Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Fri, 20 Sep 2019 11:25:59 +0200 Subject: [PATCH 371/789] Update sbt to 1.3.1 --- project/build.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/build.properties b/project/build.properties index 080a737ed..ea6d47b2e 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version=1.3.0 +sbt.version=1.3.1 From 26cb5d49fab018dcab968c77e4295516e5462528 Mon Sep 17 00:00:00 2001 From: Lukas Rytz Date: Fri, 20 Sep 2019 13:50:34 +0200 Subject: [PATCH 372/789] Update module plugin to 2.1.3 --- project/plugins.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/plugins.sbt b/project/plugins.sbt index 65055033d..dbf842398 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,7 +1,7 @@ val scalaJSVersion = Option(System.getenv("SCALAJS_VERSION")).filter(_.nonEmpty).getOrElse("0.6.28") -addSbtPlugin("org.scala-lang.modules" % "sbt-scala-module" % "2.1.2") +addSbtPlugin("org.scala-lang.modules" % "sbt-scala-module" % "2.1.3") addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "0.6.1") addSbtPlugin("org.scala-js" % "sbt-scalajs" % scalaJSVersion) addSbtPlugin("ch.epfl.lamp" % "sbt-dotty" % "0.3.4") From d497f81bf05c0b2357738a029caf195cd55d8424 Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Fri, 20 Sep 2019 11:21:46 -0400 Subject: [PATCH 373/789] Update Scala.js 0.6.29 in Circle --- .circleci/config.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 27a217058..6c5947f46 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -59,7 +59,7 @@ jobs: type: string scalajs_version: description: "ScalaJS version" - default: 0.6.28 + default: 0.6.29 type: string environment: SCALAJS_VERSION: << parameters.scalajs_version >> @@ -101,11 +101,11 @@ workflows: - scalajs_job: name: sjs0.6_2.12 scala_version: 2.12.10 - scalajs_version: 0.6.28 + scalajs_version: 0.6.29 - scalajs_job: name: sjs0.6_2.13 scala_version: 2.13.0 - scalajs_version: 0.6.28 + scalajs_version: 0.6.29 - scalajs_job: name: sjs1.0.0-M8_2.12 scala_version: 2.12.10 From 3a835e16b338fa8601175709fe4e09e5da995cec Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Sat, 21 Sep 2019 08:53:44 +0200 Subject: [PATCH 374/789] Update sbt to 1.3.2 --- project/build.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/build.properties b/project/build.properties index ea6d47b2e..8522443de 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version=1.3.1 +sbt.version=1.3.2 From 976662200d2b66a39928dab6067eb111214d769b Mon Sep 17 00:00:00 2001 From: Lukas Rytz Date: Mon, 23 Sep 2019 10:26:11 +0200 Subject: [PATCH 375/789] Update comment in build.sh --- build.sh | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/build.sh b/build.sh index 364fb3be4..0c027a657 100755 --- a/build.sh +++ b/build.sh @@ -12,9 +12,7 @@ set -e # When a new binary incompatible Scala version becomes available, a previously released version # can be released using that new Scala version by creating a new tag containing the Scala version -# after a hash, e.g., v1.2.3#2.13.0-M3. In this situation, the first job of the travis job -# matrix builds the release. All other jobs are stopped. Make sure that the first job uses -# the desired JVM version. +# after a hash, e.g., v1.2.3#2.13.0-M3. # For normal tags that are cross-built, we release on JDK 8 for Scala 2.x isReleaseJob() { From 94fb400441e21aec07d241bfb0eb88f2b9086268 Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Sat, 5 Oct 2019 18:35:32 -0400 Subject: [PATCH 376/789] Drop scala.xml.dtd.impl.PointedHedgeExp --- build.sbt | 6 ++++ .../scala/xml/dtd/impl/PointedHedgeExp.scala | 35 ------------------- 2 files changed, 6 insertions(+), 35 deletions(-) delete mode 100644 shared/src/main/scala/scala/xml/dtd/impl/PointedHedgeExp.scala diff --git a/build.sbt b/build.sbt index 7ce710144..32b5d1424 100644 --- a/build.sbt +++ b/build.sbt @@ -87,6 +87,12 @@ lazy val xml = crossProject(JSPlatform, JVMPlatform) exclude[MissingTypesProblem]("scala.xml.Text"), exclude[MissingTypesProblem]("scala.xml.Unparsed"), // Miscellaneous deprecations + exclude[MissingClassProblem]("scala.xml.dtd.impl.PointedHedgeExp"), + exclude[MissingClassProblem]("scala.xml.dtd.impl.PointedHedgeExp$TopIter$"), + exclude[MissingClassProblem]("scala.xml.dtd.impl.PointedHedgeExp$Node$"), + exclude[MissingClassProblem]("scala.xml.dtd.impl.PointedHedgeExp$Point$"), + exclude[MissingClassProblem]("scala.xml.dtd.impl.PointedHedgeExp$TopIter"), + exclude[MissingClassProblem]("scala.xml.dtd.impl.PointedHedgeExp$Node"), exclude[MissingClassProblem]("scala.xml.persistent.CachedFileStorage"), exclude[MissingClassProblem]("scala.xml.persistent.Index"), exclude[MissingClassProblem]("scala.xml.persistent.SetStorage"), diff --git a/shared/src/main/scala/scala/xml/dtd/impl/PointedHedgeExp.scala b/shared/src/main/scala/scala/xml/dtd/impl/PointedHedgeExp.scala deleted file mode 100644 index 9c4263ab3..000000000 --- a/shared/src/main/scala/scala/xml/dtd/impl/PointedHedgeExp.scala +++ /dev/null @@ -1,35 +0,0 @@ -/* __ *\ -** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2019, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** -** /____/\___/_/ |_/____/_/ | | ** -** |/ ** -\* */ - -package scala -package xml.dtd.impl - -/** - * Pointed regular hedge expressions, a useful subclass of regular hedge expressions. - * - * @author Burak Emir - */ -@deprecated("This class will be removed", "2.10.0") -private[dtd] abstract class PointedHedgeExp extends Base { - - type _regexpT <: RegExp - type _labelT - - case class Node(label: _labelT, r: _regexpT) extends RegExp { - final val isNullable = false - } - - case class TopIter(r1: _regexpT, r2: _regexpT) extends RegExp { - final val isNullable = r1.isNullable && r2.isNullable //? - } - - case object Point extends RegExp { - final val isNullable = false - } - -} From 0e62af0245baf820acc5d3078e7224baeb341f61 Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Sun, 6 Oct 2019 09:27:04 -0400 Subject: [PATCH 377/789] Drop scala.xml.factory.Binder --- build.sbt | 6 + .../scala/scala/xml/dtd/ContentModel.scala | 1 - .../scala/xml/dtd/ContentModelParser.scala | 137 ------------------ .../main/scala/scala/xml/dtd/Scanner.scala | 89 ------------ .../main/scala/scala/xml/factory/Binder.scala | 59 -------- .../xml/parsing/ValidatingMarkupHandler.scala | 102 ------------- 6 files changed, 6 insertions(+), 388 deletions(-) delete mode 100644 shared/src/main/scala/scala/xml/dtd/ContentModelParser.scala delete mode 100644 shared/src/main/scala/scala/xml/dtd/Scanner.scala delete mode 100755 shared/src/main/scala/scala/xml/factory/Binder.scala delete mode 100644 shared/src/main/scala/scala/xml/parsing/ValidatingMarkupHandler.scala diff --git a/build.sbt b/build.sbt index 32b5d1424..8d9863a97 100644 --- a/build.sbt +++ b/build.sbt @@ -93,9 +93,15 @@ lazy val xml = crossProject(JSPlatform, JVMPlatform) exclude[MissingClassProblem]("scala.xml.dtd.impl.PointedHedgeExp$Point$"), exclude[MissingClassProblem]("scala.xml.dtd.impl.PointedHedgeExp$TopIter"), exclude[MissingClassProblem]("scala.xml.dtd.impl.PointedHedgeExp$Node"), + exclude[MissingClassProblem]("scala.xml.dtd.Scanner"), + exclude[MissingClassProblem]("scala.xml.dtd.ContentModelParser$"), + exclude[MissingClassProblem]("scala.xml.dtd.ContentModelParser"), + exclude[MissingClassProblem]("scala.xml.factory.Binder"), + exclude[MissingClassProblem]("scala.xml.parsing.ValidatingMarkupHandler"), exclude[MissingClassProblem]("scala.xml.persistent.CachedFileStorage"), exclude[MissingClassProblem]("scala.xml.persistent.Index"), exclude[MissingClassProblem]("scala.xml.persistent.SetStorage"), + exclude[DirectMissingMethodProblem]("scala.xml.dtd.ContentModel.parse"), exclude[DirectMissingMethodProblem]("scala.xml.Elem.this"), exclude[DirectMissingMethodProblem]("scala.xml.Elem.apply"), exclude[DirectMissingMethodProblem]("scala.xml.Elem.processXml"), diff --git a/shared/src/main/scala/scala/xml/dtd/ContentModel.scala b/shared/src/main/scala/scala/xml/dtd/ContentModel.scala index 4ef9fec55..444e93e8a 100644 --- a/shared/src/main/scala/scala/xml/dtd/ContentModel.scala +++ b/shared/src/main/scala/scala/xml/dtd/ContentModel.scala @@ -39,7 +39,6 @@ object ContentModel extends WordExp { def isMixed(cm: ContentModel) = cond(cm) { case _: MIXED => true } def containsText(cm: ContentModel) = (cm == PCDATA) || isMixed(cm) - def parse(s: String): ContentModel = ContentModelParser.parse(s) def getLabels(r: RegExp): Set[String] = { def traverse(r: RegExp): Set[String] = r match { // !!! check for match translation problem diff --git a/shared/src/main/scala/scala/xml/dtd/ContentModelParser.scala b/shared/src/main/scala/scala/xml/dtd/ContentModelParser.scala deleted file mode 100644 index c69dca9f2..000000000 --- a/shared/src/main/scala/scala/xml/dtd/ContentModelParser.scala +++ /dev/null @@ -1,137 +0,0 @@ -/* __ *\ -** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2002-2019, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | http://www.scala-lang.org/ ** -** /____/\___/_/ |_/____/_/ | | ** -** |/ ** -\* */ - -package scala -package xml -package dtd - -/** Parser for regexps (content models in DTD element declarations) */ - -object ContentModelParser extends Scanner { // a bit too permissive concerning #PCDATA - import ContentModel._ - - /** parses the argument to a regexp */ - def parse(s: String): ContentModel = { initScanner(s); contentspec } - - def accept(tok: Int) = { - if (token != tok) { - if ((tok == STAR) && (token == END)) // common mistake - scala.sys.error("in DTDs, \n" + - "mixed content models must be like (#PCDATA|Name|Name|...)*") - else - scala.sys.error("expected " + token2string(tok) + - ", got unexpected token:" + token2string(token)) - } - nextToken() - } - - // s [ '+' | '*' | '?' ] - def maybeSuffix(s: RegExp) = token match { - case STAR => - nextToken(); Star(s) - case PLUS => - nextToken(); Sequ(s, Star(s)) - case OPT => - nextToken(); Alt(Eps, s) - case _ => s - } - - // contentspec ::= EMPTY | ANY | (#PCDATA) | "(#PCDATA|"regexp) - - def contentspec: ContentModel = token match { - - case NAME => value match { - case "ANY" => ANY - case "EMPTY" => EMPTY - case _ => scala.sys.error("expected ANY, EMPTY or '(' instead of " + value) - } - case LPAREN => - - nextToken() - sOpt() - if (token != TOKEN_PCDATA) - ELEMENTS(regexp) - else { - nextToken() - token match { - case RPAREN => - PCDATA - case CHOICE => - val res = MIXED(choiceRest(Eps)) - sOpt() - accept(RPAREN) - accept(STAR) - res - case _ => - scala.sys.error("unexpected token:" + token2string(token)) - } - } - - case _ => - scala.sys.error("unexpected token:" + token2string(token)) - } - // sopt ::= S? - def sOpt() = if (token == S) nextToken() - - // (' S? mixed ::= '#PCDATA' S? ')' - // | '#PCDATA' (S? '|' S? atom)* S? ')*' - - // '(' S? regexp ::= cp S? [seqRest|choiceRest] ')' [ '+' | '*' | '?' ] - def regexp: RegExp = { - val p = particle - sOpt() - maybeSuffix(token match { - case RPAREN => - nextToken(); p - case CHOICE => - val q = choiceRest(p); accept(RPAREN); q - case COMMA => val q = seqRest(p); accept(RPAREN); q - }) - } - - // seqRest ::= (',' S? cp S?)+ - def seqRest(p: RegExp) = { - var k = List(p) - while (token == COMMA) { - nextToken() - sOpt() - k = particle :: k - sOpt() - } - Sequ(k.reverse: _*) - } - - // choiceRest ::= ('|' S? cp S?)+ - def choiceRest(p: RegExp) = { - var k = List(p) - while (token == CHOICE) { - nextToken() - sOpt() - k = particle :: k - sOpt() - } - Alt(k.reverse: _*) - } - - // particle ::= '(' S? regexp - // | name [ '+' | '*' | '?' ] - def particle = token match { - case LPAREN => - nextToken(); sOpt(); regexp - case NAME => - val a = Letter(ElemName(value)); nextToken(); maybeSuffix(a) - case _ => scala.sys.error("expected '(' or Name, got:" + token2string(token)) - } - - // atom ::= name - def atom = token match { - case NAME => - val a = Letter(ElemName(value)); nextToken(); a - case _ => scala.sys.error("expected Name, got:" + token2string(token)) - } -} diff --git a/shared/src/main/scala/scala/xml/dtd/Scanner.scala b/shared/src/main/scala/scala/xml/dtd/Scanner.scala deleted file mode 100644 index cb042d5a9..000000000 --- a/shared/src/main/scala/scala/xml/dtd/Scanner.scala +++ /dev/null @@ -1,89 +0,0 @@ -/* __ *\ -** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2002-2019, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** -** /____/\___/_/ |_/____/_/ | | ** -** |/ ** -\* */ - -package scala -package xml -package dtd - -import scala.collection.Seq - -/** - * Scanner for regexps (content models in DTD element declarations) - * todo: cleanup - */ -class Scanner extends Tokens with parsing.TokenTests { - - final val ENDCH = '\u0000' - - var token: Int = END - var value: String = _ - - private var it: Iterator[Char] = null - private var c: Char = 'z' - - /** initializes the scanner on input s */ - final def initScanner(s: String): Unit = { - value = "" - it = (s).iterator - token = 1 + END - next() - nextToken() - } - - /** scans the next token */ - final def nextToken(): Unit = { - if (token != END) token = readToken - } - - // todo: see XML specification... probably isLetter,isDigit is fine - final def isIdentChar = (('a' <= c && c <= 'z') - || ('A' <= c && c <= 'Z')) - - final def next() = if (it.hasNext) c = it.next() else c = ENDCH - - final def acc(d: Char): Unit = { - if (c == d) next() else scala.sys.error("expected '" + d + "' found '" + c + "' !") - } - - final def accS(ds: Seq[Char]): Unit = { ds foreach acc } - - final def readToken: Int = - if (isSpace(c)) { - while (isSpace(c)) c = it.next() - S - } else c match { - case '(' => - next(); LPAREN - case ')' => - next(); RPAREN - case ',' => - next(); COMMA - case '*' => - next(); STAR - case '+' => - next(); PLUS - case '?' => - next(); OPT - case '|' => - next(); CHOICE - case '#' => - next(); accS("PCDATA"); TOKEN_PCDATA - case ENDCH => END - case _ => - if (isNameStart(c)) name; // NAME - else scala.sys.error("unexpected character:" + c) - } - - final def name = { - val sb = new StringBuilder() - do { sb.append(c); next() } while (isNameChar(c)) - value = sb.toString() - NAME - } - -} diff --git a/shared/src/main/scala/scala/xml/factory/Binder.scala b/shared/src/main/scala/scala/xml/factory/Binder.scala deleted file mode 100755 index 3c1b595ac..000000000 --- a/shared/src/main/scala/scala/xml/factory/Binder.scala +++ /dev/null @@ -1,59 +0,0 @@ -/* __ *\ -** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2002-2019, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** -** /____/\___/_/ |_/____/_/ | | ** -** |/ ** -\* */ - -package scala -package xml -package factory - -import parsing.ValidatingMarkupHandler - -/** - * @author Burak Emir - */ -abstract class Binder(val preserveWS: Boolean) extends ValidatingMarkupHandler { - - var result: NodeBuffer = new NodeBuffer() - - def reportSyntaxError(pos: Int, str: String) = {} - - final def procInstr(pos: Int, target: String, txt: String) = - ProcInstr(target, txt) - - final def comment(pos: Int, txt: String) = - Comment(txt) - - final def entityRef(pos: Int, n: String) = - EntityRef(n) - - final def text(pos: Int, txt: String) = - Text(txt) - - final def traverse(n: Node): Unit = n match { - case x: ProcInstr => - result &+ procInstr(0, x.target, x.text) - case x: Comment => - result &+ comment(0, x.text) - case x: Text => - result &+ text(0, x.data) - case x: EntityRef => - result &+ entityRef(0, x.entityName) - case x: Elem => - elemStart(0, x.prefix, x.label, x.attributes, x.scope) - val old = result - result = new NodeBuffer() - for (m <- x.child) traverse(m) - result = old &+ elem(0, x.prefix, x.label, x.attributes, x.scope, x.minimizeEmpty, NodeSeq.fromSeq(result)).toList - elemEnd(0, x.prefix, x.label) - } - - final def validate(n: Node): Node = { - this.rootLabel = n.label - traverse(n) - result(0) - } -} diff --git a/shared/src/main/scala/scala/xml/parsing/ValidatingMarkupHandler.scala b/shared/src/main/scala/scala/xml/parsing/ValidatingMarkupHandler.scala deleted file mode 100644 index a1821bd95..000000000 --- a/shared/src/main/scala/scala/xml/parsing/ValidatingMarkupHandler.scala +++ /dev/null @@ -1,102 +0,0 @@ -/* __ *\ -** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2002-2019, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** -** /____/\___/_/ |_/____/_/ | | ** -** |/ ** -\* */ - -package scala -package xml -package parsing - -import scala.xml.dtd._ - -abstract class ValidatingMarkupHandler extends MarkupHandler { - - var rootLabel: String = _ - var qStack: List[Int] = Nil - var qCurrent: Int = -1 - - var declStack: List[ElemDecl] = Nil - var declCurrent: ElemDecl = null - - final override val isValidating = true - - override def endDTD(n: String) = { - rootLabel = n - } - override def elemStart(pos: Int, pre: String, label: String, attrs: MetaData, scope: NamespaceBinding): Unit = { - - def advanceDFA(dm: DFAContentModel) = { - val trans = dm.dfa.delta(qCurrent) - // println("advanceDFA(dm): " + dm) - // println("advanceDFA(trans): " + trans) - trans.get(ContentModel.ElemName(label)) match { - case Some(qNew) => qCurrent = qNew - case _ => reportValidationError(pos, "DTD says, wrong element, expected one of " + trans.keys) - } - } - // advance in current automaton - // println("[qCurrent = " + qCurrent + " visiting " + label + "]") - - if (qCurrent == -1) { // root - // println(" checking root") - if (label != rootLabel) - reportValidationError(pos, "this element should be " + rootLabel) - } else { - // println(" checking node") - declCurrent.contentModel match { - case ANY => - case EMPTY => - reportValidationError(pos, "DTD says, no elems, no text allowed here") - case PCDATA => - reportValidationError(pos, "DTD says, no elements allowed here") - case m@MIXED(r) => - advanceDFA(m) - case e@ELEMENTS(r) => - advanceDFA(e) - } - } - // push state, decl - qStack = qCurrent :: qStack - declStack = declCurrent :: declStack - - declCurrent = lookupElemDecl(label) - qCurrent = 0 - // println(" done now") - } - - override def elemEnd(pos: Int, pre: String, label: String): Unit = { - // println(" elemEnd") - qCurrent = qStack.head - qStack = qStack.tail - declCurrent = declStack.head - declStack = declStack.tail - // println(" qCurrent now" + qCurrent) - // println(" declCurrent now" + declCurrent) - } - - final override def elemDecl(name: String, cmstr: String): Unit = { - decls = ElemDecl(name, ContentModel.parse(cmstr)) :: decls - } - - final override def attListDecl(name: String, attList: List[AttrDecl]): Unit = { - decls = AttListDecl(name, attList) :: decls - } - - final override def unparsedEntityDecl(name: String, extID: ExternalID, notat: String): Unit = { - decls = UnparsedEntityDecl(name, extID, notat) :: decls - } - - final override def notationDecl(notat: String, extID: ExternalID): Unit = { - decls = NotationDecl(notat, extID) :: decls - } - - final override def peReference(name: String): Unit = { - decls = PEReference(name) :: decls - } - - /** report a syntax error */ - def reportValidationError(pos: Int, str: String): Unit -} From 728d8d119e5bf6ab50bae877691d19461ec38d18 Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Sun, 6 Oct 2019 12:21:31 -0400 Subject: [PATCH 378/789] Re-enable Coursier in sbt 1.3.2 --- .circleci/config.yml | 2 +- .travis.yml | 2 +- build.sbt | 4 ---- 3 files changed, 2 insertions(+), 6 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 6c5947f46..e08040400 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -27,7 +27,7 @@ commands: - save_cache: key: sbt-deps-v1-{{ checksum "build.sbt" }} paths: - - "~/.coursier" + - "~/.cache/coursier" - "~/.ivy2/cache" - "~/.sbt" - "~/.m2" diff --git a/.travis.yml b/.travis.yml index 3a1bd6c86..fa663752f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -43,4 +43,4 @@ cache: - $HOME/.ivy2/cache - $HOME/.sbt - $HOME/.sdkman - - $HOME/.coursier + - $HOME/.cache/coursier diff --git a/build.sbt b/build.sbt index 8d9863a97..8edca710d 100644 --- a/build.sbt +++ b/build.sbt @@ -29,10 +29,6 @@ lazy val xml = crossProject(JSPlatform, JVMPlatform) .settings( name := "scala-xml", - // See https://github.com/sbt/sbt/issues/4995 - // doc task broken in sbt 1.3.0-RC4 and Scala 2.12.9 - useCoursier := false, - scalacOptions ++= { val opts = if (isDotty.value) From 7aea8dc7933e4580737a9ac8d06bc56d08e13dc1 Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Tue, 15 Oct 2019 00:30:51 +0200 Subject: [PATCH 379/789] Update sbt to 1.3.3 --- project/build.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/build.properties b/project/build.properties index 8522443de..6adcdc753 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version=1.3.2 +sbt.version=1.3.3 From 2e7a6b7cfcf69ac8da10b157dc66a969aa19a8c0 Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Sun, 20 Oct 2019 19:19:49 -0400 Subject: [PATCH 380/789] Add CHANGELOG file for 2.0.0-M1 --- CHANGELOG.md | 61 ++++++++++++++++++++++++++++++++++++++++++++++++++++ README.md | 4 ++++ 2 files changed, 65 insertions(+) create mode 100644 CHANGELOG.md diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 000000000..c725ae694 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,61 @@ +# Scala XML Changes + +## 2.0.0-M1 (2019-10-21) + +Not binary compatible with Scala XML 1.2.0. + +Published for Scala 2.12, 2.13 and Scala.js 0.6, 1.0.0-M8. +Artifacts are no longer published for Scala 2.11. + +There have been a number of deprecated elements that have been +removed, see the "[Removed](#Removed)" section below. + +### Added + +- The `apiURL` is now published in ivy metadata so that hyperlinks + exist in downstream projects that reference Scala XML in their + Scaladocs. + +### Changed + +- Changed use of `scala.collection.mutable.Stack` in `FactoryAdapter` to a + `scala.collection.immutable.List`. These members were affected. + - `attribStack` + - `hStack` + - `tagStack` + - `scopeStack` +- The abstract class `FactoryAdapter`, see above, is used elsewhere + within the library, as well, so the previous changes are also + inherited by: + - `scala.xml.parsing.NoBindingFactoryAdapter` implemented class + - `scala.xml.factory.XMLLoader.adapter` static member + +### Fixed + +- Attribute order is preserved for XML elements, not reversed. +- Don't escape quotes in `scala.xml.PCData` and `CDATA` as an XML `"` + +### Removed + +Most of these deletions are of vestigial code that is either unused, +of poor quality or both. Very few users of Scala XML will even notice +the removed parts. Most users will not be affected. + +The deletions represent about one thousand lines of code (sloc). By +comparison Scala XML is 10,000 sloc, so this is about 10% reduction in +sloc. The code that supports XML literals is maintained upstream in +the Scala compiler, not in the Scala XML library. + +- Remove deprecated `scala.xml.pull.XMLEventReader` +- Remove deprecated versions of `scala.xml.Elem` constructors +- Remove deprecated `scala.xml.Elem.xmlToProcess` and + `scala.xml.Elem.processXml` +- Remove deprecated definitions under `scala.xml.persistent` + - `CachedFileStorage` + - `Index` + - `SetStorage` +- Remove `scala.xml.dtd.impl.PointedHedgeExp` +- Remove `scala.xml.dtd.Scanner` +- Remove `scala.xml.dtd.ContentModelParser` +- Remove `scala.xml.factory.Binder` +- Remove `scala.xml.parsing.ValidatingMarkupHandler` diff --git a/README.md b/README.md index adfde8bae..84bcfe1ef 100644 --- a/README.md +++ b/README.md @@ -14,6 +14,10 @@ API documentation is available [here](https://scala.github.io/scala-xml/api/1.2. How to documentation is available in the [wiki](https://github.com/scala/scala-xml/wiki) +The latest stable release of Scala XML is 1.2.0. + +Milestone releases of Scala XML version 2.0 are available, starting with 2.0.0-M1. See the changes for 2.0 in `CHANGELOG.md`. + ## Maintenance status This library is community-maintained. The lead maintainer is [@aaron_s_hawley](https://github.com/ashawley). From 8440c0113914147099d72096ff113d563b50d277 Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Mon, 21 Oct 2019 22:05:36 -0400 Subject: [PATCH 381/789] Update Scala 2.13.1 --- .circleci/config.yml | 16 ++++++++-------- .travis.yml | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index e08040400..c171cb643 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -79,21 +79,21 @@ workflows: java_version: jdk8 scala_version: 2.12.10 - scala_job: - name: 2.13.0 + name: 2.13.1 java_version: jdk8 - scala_version: 2.13.0 + scala_version: 2.13.1 - scala_job: - name: dotty + name: dotty-0.18 java_version: jdk8 scala_version: 0.18.1-RC1 - scala_job: - name: jdk11_2.12.10 + name: jdk11_2.12 java_version: jdk11 scala_version: 2.12.10 - scala_job: - name: jdk11_2.13.0 + name: jdk11_2.13 java_version: jdk11 - scala_version: 2.13.0 + scala_version: 2.13.1 - scala_job: name: jdk11_dotty java_version: jdk11 @@ -104,7 +104,7 @@ workflows: scalajs_version: 0.6.29 - scalajs_job: name: sjs0.6_2.13 - scala_version: 2.13.0 + scala_version: 2.13.1 scalajs_version: 0.6.29 - scalajs_job: name: sjs1.0.0-M8_2.12 @@ -112,5 +112,5 @@ workflows: scalajs_version: 1.0.0-M8 - scalajs_job: name: sjs1.0.0-M8_2.13 - scala_version: 2.13.0 + scala_version: 2.13.1 scalajs_version: 1.0.0-M8 diff --git a/.travis.yml b/.travis.yml index fa663752f..ffe3aec9d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,7 +3,7 @@ language: scala scala: - 0.18.1-RC1 - 2.12.10 - - 2.13.0 + - 2.13.1 env: - SCALAJS_VERSION= ADOPTOPENJDK=8 From 7fc6c0dae65a278edc57a27007e74678f08ce031 Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Thu, 21 Nov 2019 20:26:21 +0100 Subject: [PATCH 382/789] Update sbt-scalajs to 0.6.31 --- .travis.yml | 4 ++-- project/plugins.sbt | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index ffe3aec9d..bc3d6fbbb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,14 +7,14 @@ scala: env: - SCALAJS_VERSION= ADOPTOPENJDK=8 - - SCALAJS_VERSION=0.6.29 ADOPTOPENJDK=8 + - SCALAJS_VERSION=0.6.31 ADOPTOPENJDK=8 - SCALAJS_VERSION=1.0.0-M8 ADOPTOPENJDK=8 - SCALAJS_VERSION= ADOPTOPENJDK=11 matrix: exclude: - scala: 0.18.1-RC1 - env: SCALAJS_VERSION=0.6.29 ADOPTOPENJDK=8 + env: SCALAJS_VERSION=0.6.31 ADOPTOPENJDK=8 - scala: 0.18.1-RC1 env: SCALAJS_VERSION=1.0.0-M8 ADOPTOPENJDK=8 diff --git a/project/plugins.sbt b/project/plugins.sbt index 08ca7aec6..410065be8 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,5 +1,5 @@ val scalaJSVersion = - Option(System.getenv("SCALAJS_VERSION")).filter(_.nonEmpty).getOrElse("0.6.29") + Option(System.getenv("SCALAJS_VERSION")).filter(_.nonEmpty).getOrElse("0.6.31") addSbtPlugin("org.scala-lang.modules" % "sbt-scala-module" % "2.1.3") addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "0.6.1") From 59b24c176eee681e4e9ee45fb662d7a56ea38e69 Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Thu, 21 Nov 2019 14:36:53 -0500 Subject: [PATCH 383/789] Update Scala.js 0.6.31 in Circle --- .circleci/config.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index c171cb643..6c4000bdd 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -59,7 +59,7 @@ jobs: type: string scalajs_version: description: "ScalaJS version" - default: 0.6.29 + default: 0.6.31 type: string environment: SCALAJS_VERSION: << parameters.scalajs_version >> @@ -101,11 +101,11 @@ workflows: - scalajs_job: name: sjs0.6_2.12 scala_version: 2.12.10 - scalajs_version: 0.6.29 + scalajs_version: 0.6.31 - scalajs_job: name: sjs0.6_2.13 scala_version: 2.13.1 - scalajs_version: 0.6.29 + scalajs_version: 0.6.31 - scalajs_job: name: sjs1.0.0-M8_2.12 scala_version: 2.12.10 From 1681cc28b16af93a90265e02ba5662c542e932fb Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Fri, 22 Nov 2019 09:51:02 -0500 Subject: [PATCH 384/789] Use install-jdk.sh for AdoptOpenJDK --- .travis.yml | 35 +++++++++++++++++++---------------- build.sh | 6 +++--- 2 files changed, 22 insertions(+), 19 deletions(-) diff --git a/.travis.yml b/.travis.yml index bc3d6fbbb..f14bbf290 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,33 +1,37 @@ language: scala +# This sets $TRAVIS_JDK_VERSION which is used, in turn, to get a +# version of AdoptOpenJDK with the install-jdk.sh command. +jdk: + - openjdk8 + - openjdk11 + scala: - 0.18.1-RC1 - 2.12.10 - 2.13.1 env: - - SCALAJS_VERSION= ADOPTOPENJDK=8 - - SCALAJS_VERSION=0.6.31 ADOPTOPENJDK=8 - - SCALAJS_VERSION=1.0.0-M8 ADOPTOPENJDK=8 - - SCALAJS_VERSION= ADOPTOPENJDK=11 + # The empty SCALAJS_VERSION will only compile for the JVM + - SCALAJS_VERSION= + - SCALAJS_VERSION=0.6.31 + - SCALAJS_VERSION=1.0.0-M8 matrix: exclude: + - jdk: openjdk11 + env: SCALAJS_VERSION=0.6.29 + - jdk: openjdk11 + env: SCALAJS_VERSION=1.0.0-M8 - scala: 0.18.1-RC1 - env: SCALAJS_VERSION=0.6.31 ADOPTOPENJDK=8 + env: SCALAJS_VERSION=0.6.31 - scala: 0.18.1-RC1 - env: SCALAJS_VERSION=1.0.0-M8 ADOPTOPENJDK=8 - -before_install: - # adding $HOME/.sdkman to cache would create an empty directory, which interferes with the initial installation - - "[[ -d $HOME/.sdkman/bin ]] || rm -rf $HOME/.sdkman/" - - curl -sL https://get.sdkman.io | bash - - echo sdkman_auto_answer=true > $HOME/.sdkman/etc/config - - source "$HOME/.sdkman/bin/sdkman-init.sh" + env: SCALAJS_VERSION=1.0.0-M8 install: - - sdk install java $(sdk list java | grep -o "$ADOPTOPENJDK\.[0-9\.]*hs-adpt" | head -1) - - unset JAVA_HOME + - export JAVA_HOME=$HOME/$TRAVIS_JDK_VERSION + - install-jdk.sh --url "https://api.adoptopenjdk.net/v2/binary/releases/$TRAVIS_JDK_VERSION?openjdk_impl=hotspot&os=linux&arch=x64&release=latest&heap_size=normal&type=jdk" --target $JAVA_HOME + - export PATH=$JAVA_HOME/bin:$PATH - java -Xmx32m -version - git fetch --tags # get all tags for sbt-dynver @@ -42,5 +46,4 @@ cache: directories: - $HOME/.ivy2/cache - $HOME/.sbt - - $HOME/.sdkman - $HOME/.cache/coursier diff --git a/build.sh b/build.sh index 0c027a657..d2b1cfe2f 100755 --- a/build.sh +++ b/build.sh @@ -16,7 +16,7 @@ set -e # For normal tags that are cross-built, we release on JDK 8 for Scala 2.x isReleaseJob() { - if [[ "$ADOPTOPENJDK" == "8" && "$TRAVIS_SCALA_VERSION" =~ ^2\.1[234]\..*$ ]]; then + if [[ "$TRAVIS_JDK_VERSION" == "openjdk8" && "$TRAVIS_SCALA_VERSION" =~ ^2\.1[234]\..*$ ]]; then true else false @@ -25,7 +25,7 @@ isReleaseJob() { # For tags that define a Scala version, we pick the jobs of one Scala version (2.13.x) to do the releases isTagScalaReleaseJob() { - if [[ "$ADOPTOPENJDK" == "8" && "$TRAVIS_SCALA_VERSION" =~ ^2\.13\.[0-9]+$ ]]; then + if [[ "$TRAVIS_JDK_VERSION" == "openjdk8" && "$TRAVIS_SCALA_VERSION" =~ ^2\.13\.[0-9]+$ ]]; then true else false @@ -46,7 +46,7 @@ if [[ "$TRAVIS_TAG" =~ $tagPat ]]; then tagScalaVer=$(echo $TRAVIS_TAG | sed s/[^#]*// | sed s/^#//) if [[ "$tagScalaVer" == "" ]]; then if ! isReleaseJob; then - echo "Not releasing on Java $ADOPTOPENJDK with Scala $TRAVIS_SCALA_VERSION" + echo "Not releasing on Java ${TRAVIS_JDK_VERSION#openjdk} with Scala $TRAVIS_SCALA_VERSION" exit 0 fi else From d5e3bf381b22946099652554f2ce73d796bb7caa Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Sat, 23 Nov 2019 23:58:24 +0100 Subject: [PATCH 385/789] Update sbt to 1.3.4 --- project/build.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/build.properties b/project/build.properties index 6adcdc753..5a9ed9251 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version=1.3.3 +sbt.version=1.3.4 From 729fcf17e0a2a53956d6040c6cbf32f4eeeaf89a Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Thu, 21 Nov 2019 17:35:50 -0500 Subject: [PATCH 386/789] Update dotty 0.20.0-RC1 --- .circleci/config.yml | 4 ++-- .travis.yml | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 6c4000bdd..213aa6208 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -85,7 +85,7 @@ workflows: - scala_job: name: dotty-0.18 java_version: jdk8 - scala_version: 0.18.1-RC1 + scala_version: 0.20.0-RC1 - scala_job: name: jdk11_2.12 java_version: jdk11 @@ -97,7 +97,7 @@ workflows: - scala_job: name: jdk11_dotty java_version: jdk11 - scala_version: 0.18.1-RC1 + scala_version: 0.20.0-RC1 - scalajs_job: name: sjs0.6_2.12 scala_version: 2.12.10 diff --git a/.travis.yml b/.travis.yml index f14bbf290..4c7f1cbcc 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,7 +7,7 @@ jdk: - openjdk11 scala: - - 0.18.1-RC1 + - 0.20.0-RC1 - 2.12.10 - 2.13.1 @@ -23,9 +23,9 @@ matrix: env: SCALAJS_VERSION=0.6.29 - jdk: openjdk11 env: SCALAJS_VERSION=1.0.0-M8 - - scala: 0.18.1-RC1 + - scala: 0.20.0-RC1 env: SCALAJS_VERSION=0.6.31 - - scala: 0.18.1-RC1 + - scala: 0.20.0-RC1 env: SCALAJS_VERSION=1.0.0-M8 install: From b017e847f4f60dc4cf1aa43a37daabb29c189a49 Mon Sep 17 00:00:00 2001 From: Lukas Rytz Date: Tue, 3 Dec 2019 11:53:17 +0100 Subject: [PATCH 387/789] Import travis caching config and JDK install from scala-dev --- .travis.yml | 41 ++++++++++------------------------------- build.sh | 6 +++--- 2 files changed, 13 insertions(+), 34 deletions(-) diff --git a/.travis.yml b/.travis.yml index 4c7f1cbcc..9b507a7a9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,10 +1,8 @@ -language: scala +version: ~> 1.0 # needed for imports + +import: scala/scala-dev:travis/default.yml -# This sets $TRAVIS_JDK_VERSION which is used, in turn, to get a -# version of AdoptOpenJDK with the install-jdk.sh command. -jdk: - - openjdk8 - - openjdk11 +language: scala scala: - 0.20.0-RC1 @@ -12,38 +10,19 @@ scala: - 2.13.1 env: - # The empty SCALAJS_VERSION will only compile for the JVM - - SCALAJS_VERSION= - - SCALAJS_VERSION=0.6.31 - - SCALAJS_VERSION=1.0.0-M8 + - SCALAJS_VERSION= ADOPTOPENJDK=8 + - SCALAJS_VERSION=0.6.31 ADOPTOPENJDK=8 + - SCALAJS_VERSION=1.0.0-M8 ADOPTOPENJDK=8 + - SCALAJS_VERSION= ADOPTOPENJDK=11 matrix: exclude: - - jdk: openjdk11 - env: SCALAJS_VERSION=0.6.29 - - jdk: openjdk11 - env: SCALAJS_VERSION=1.0.0-M8 - scala: 0.20.0-RC1 - env: SCALAJS_VERSION=0.6.31 + env: SCALAJS_VERSION=0.6.31 ADOPTOPENJDK=8 - scala: 0.20.0-RC1 - env: SCALAJS_VERSION=1.0.0-M8 + env: SCALAJS_VERSION=1.0.0-M8 ADOPTOPENJDK=8 install: - - export JAVA_HOME=$HOME/$TRAVIS_JDK_VERSION - - install-jdk.sh --url "https://api.adoptopenjdk.net/v2/binary/releases/$TRAVIS_JDK_VERSION?openjdk_impl=hotspot&os=linux&arch=x64&release=latest&heap_size=normal&type=jdk" --target $JAVA_HOME - - export PATH=$JAVA_HOME/bin:$PATH - - java -Xmx32m -version - git fetch --tags # get all tags for sbt-dynver script: ./build.sh - -before_cache: - - find $HOME/.sbt -name "*.lock" | xargs rm - - find $HOME/.ivy2/cache -name "ivydata-*.properties" | xargs rm - - rm -f $HOME/.ivy2/.sbt.ivy.lock - - find $HOME/.coursier -name "*.lock" | xargs rm -cache: - directories: - - $HOME/.ivy2/cache - - $HOME/.sbt - - $HOME/.cache/coursier diff --git a/build.sh b/build.sh index d2b1cfe2f..0c027a657 100755 --- a/build.sh +++ b/build.sh @@ -16,7 +16,7 @@ set -e # For normal tags that are cross-built, we release on JDK 8 for Scala 2.x isReleaseJob() { - if [[ "$TRAVIS_JDK_VERSION" == "openjdk8" && "$TRAVIS_SCALA_VERSION" =~ ^2\.1[234]\..*$ ]]; then + if [[ "$ADOPTOPENJDK" == "8" && "$TRAVIS_SCALA_VERSION" =~ ^2\.1[234]\..*$ ]]; then true else false @@ -25,7 +25,7 @@ isReleaseJob() { # For tags that define a Scala version, we pick the jobs of one Scala version (2.13.x) to do the releases isTagScalaReleaseJob() { - if [[ "$TRAVIS_JDK_VERSION" == "openjdk8" && "$TRAVIS_SCALA_VERSION" =~ ^2\.13\.[0-9]+$ ]]; then + if [[ "$ADOPTOPENJDK" == "8" && "$TRAVIS_SCALA_VERSION" =~ ^2\.13\.[0-9]+$ ]]; then true else false @@ -46,7 +46,7 @@ if [[ "$TRAVIS_TAG" =~ $tagPat ]]; then tagScalaVer=$(echo $TRAVIS_TAG | sed s/[^#]*// | sed s/^#//) if [[ "$tagScalaVer" == "" ]]; then if ! isReleaseJob; then - echo "Not releasing on Java ${TRAVIS_JDK_VERSION#openjdk} with Scala $TRAVIS_SCALA_VERSION" + echo "Not releasing on Java $ADOPTOPENJDK with Scala $TRAVIS_SCALA_VERSION" exit 0 fi else From e82662695a366b33b25f7010924c11ae5d8c53f1 Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Wed, 4 Dec 2019 00:27:21 -0500 Subject: [PATCH 388/789] Update Scala.js to 1.0.0-RC1 --- .circleci/config.yml | 8 ++++---- .travis.yml | 6 +++--- build.sbt | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 213aa6208..dbc0258ef 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -107,10 +107,10 @@ workflows: scala_version: 2.13.1 scalajs_version: 0.6.31 - scalajs_job: - name: sjs1.0.0-M8_2.12 + name: sjs1.0.0-RC1_2.12 scala_version: 2.12.10 - scalajs_version: 1.0.0-M8 + scalajs_version: 1.0.0-RC1 - scalajs_job: - name: sjs1.0.0-M8_2.13 + name: sjs1.0.0-RC1_2.13 scala_version: 2.13.1 - scalajs_version: 1.0.0-M8 + scalajs_version: 1.0.0-RC1 diff --git a/.travis.yml b/.travis.yml index 9b507a7a9..7c3995bdd 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,15 +12,15 @@ scala: env: - SCALAJS_VERSION= ADOPTOPENJDK=8 - SCALAJS_VERSION=0.6.31 ADOPTOPENJDK=8 - - SCALAJS_VERSION=1.0.0-M8 ADOPTOPENJDK=8 + - SCALAJS_VERSION=1.0.0-RC1 ADOPTOPENJDK=8 - SCALAJS_VERSION= ADOPTOPENJDK=11 matrix: exclude: - scala: 0.20.0-RC1 - env: SCALAJS_VERSION=0.6.31 ADOPTOPENJDK=8 + env: SCALAJS_VERSION=0.6.31 ADOPTOPENJDK=8 - scala: 0.20.0-RC1 - env: SCALAJS_VERSION=1.0.0-M8 ADOPTOPENJDK=8 + env: SCALAJS_VERSION=1.0.0-RC1 ADOPTOPENJDK=8 install: - git fetch --tags # get all tags for sbt-dynver diff --git a/build.sbt b/build.sbt index 8edca710d..48bfacc12 100644 --- a/build.sbt +++ b/build.sbt @@ -43,7 +43,7 @@ lazy val xml = crossProject(JSPlatform, JVMPlatform) scalacOptions in Test += "-Xxml:coalescing", scalaModuleMimaPreviousVersion := { - if (System.getenv("SCALAJS_VERSION") == "1.0.0-M8") None // No such release yet + if (System.getenv("SCALAJS_VERSION") == "1.0.0-RC1") None // No such release yet else Some("1.2.0") }, mimaBinaryIssueFilters ++= { From 7cc948981515f474ab13017faec35252da6ec6fe Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Sat, 14 Dec 2019 16:07:12 +0100 Subject: [PATCH 389/789] Update sbt to 1.3.5 --- project/build.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/build.properties b/project/build.properties index 5a9ed9251..6624da70b 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version=1.3.4 +sbt.version=1.3.5 From 84442204c8651635e2bfe6ce6c18b3a0f033fde7 Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Tue, 17 Dec 2019 00:17:25 -0500 Subject: [PATCH 390/789] Publish Scala.js from tag in Travis --- build.sh | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/build.sh b/build.sh index 0c027a657..4603378bc 100755 --- a/build.sh +++ b/build.sh @@ -32,6 +32,15 @@ isTagScalaReleaseJob() { fi } +# For tags that define a Scala.js version, we pick the jobs of one Scala.js version (1.0.0) to do the releases +isTagScalaJsReleaseJob() { + if [[ "$ADOPTOPENJDK" == "8" && "$SCALAJS_VERSION" =~ ^1\.0\.0(-[A-Za-z0-9-]+)?$ ]]; then + true + else + false + fi +} + if [[ "$SCALAJS_VERSION" == "" ]]; then projectPrefix="xml" else @@ -39,7 +48,7 @@ else fi verPat="[0-9]+\.[0-9]+\.[0-9]+(-[A-Za-z0-9-]+)?" -tagPat="^v$verPat(#$verPat)?$" +tagPat="^v$verPat(#(sjs_)?$verPat)?$" if [[ "$TRAVIS_TAG" =~ $tagPat ]]; then releaseTask="ci-release" @@ -49,6 +58,11 @@ if [[ "$TRAVIS_TAG" =~ $tagPat ]]; then echo "Not releasing on Java $ADOPTOPENJDK with Scala $TRAVIS_SCALA_VERSION" exit 0 fi + elif [[ "$tagScalaVer" == "sjs_$SCALAJS_VERSION" ]]; then + if ! isTagScalaJsReleaseJob; then + echo "The releases for Scala.js $tagScalaVer are built by other jobs in the travis job matrix" + exit 0 + fi else if isTagScalaReleaseJob; then setTagScalaVersion='set every scalaVersion := "'$tagScalaVer'"' From 908e0a049a3969aedefd285058b892d1d09d4ea8 Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Tue, 17 Dec 2019 00:20:32 -0500 Subject: [PATCH 391/789] Update Scala.js to 1.0.0-RC2 --- .circleci/config.yml | 8 ++++---- .travis.yml | 4 ++-- build.sbt | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index dbc0258ef..51219f645 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -107,10 +107,10 @@ workflows: scala_version: 2.13.1 scalajs_version: 0.6.31 - scalajs_job: - name: sjs1.0.0-RC1_2.12 + name: sjs1.0.0-RC2_2.12 scala_version: 2.12.10 - scalajs_version: 1.0.0-RC1 + scalajs_version: 1.0.0-RC2 - scalajs_job: - name: sjs1.0.0-RC1_2.13 + name: sjs1.0.0-RC2_2.13 scala_version: 2.13.1 - scalajs_version: 1.0.0-RC1 + scalajs_version: 1.0.0-RC2 diff --git a/.travis.yml b/.travis.yml index 7c3995bdd..8ee796989 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,7 +12,7 @@ scala: env: - SCALAJS_VERSION= ADOPTOPENJDK=8 - SCALAJS_VERSION=0.6.31 ADOPTOPENJDK=8 - - SCALAJS_VERSION=1.0.0-RC1 ADOPTOPENJDK=8 + - SCALAJS_VERSION=1.0.0-RC2 ADOPTOPENJDK=8 - SCALAJS_VERSION= ADOPTOPENJDK=11 matrix: @@ -20,7 +20,7 @@ matrix: - scala: 0.20.0-RC1 env: SCALAJS_VERSION=0.6.31 ADOPTOPENJDK=8 - scala: 0.20.0-RC1 - env: SCALAJS_VERSION=1.0.0-RC1 ADOPTOPENJDK=8 + env: SCALAJS_VERSION=1.0.0-RC2 ADOPTOPENJDK=8 install: - git fetch --tags # get all tags for sbt-dynver diff --git a/build.sbt b/build.sbt index 48bfacc12..340f3d3b5 100644 --- a/build.sbt +++ b/build.sbt @@ -43,7 +43,7 @@ lazy val xml = crossProject(JSPlatform, JVMPlatform) scalacOptions in Test += "-Xxml:coalescing", scalaModuleMimaPreviousVersion := { - if (System.getenv("SCALAJS_VERSION") == "1.0.0-RC1") None // No such release yet + if (System.getenv("SCALAJS_VERSION") == "1.0.0-RC2") None // No such release yet else Some("1.2.0") }, mimaBinaryIssueFilters ++= { From 34b0ba73299e2311ae9d64be021f510f87669372 Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Sun, 22 Dec 2019 16:37:14 -0500 Subject: [PATCH 392/789] Change test of error message for 2.13.2 --- .../scala-2.x/scala/xml/CompilerErrors.scala | 20 +++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/jvm/src/test/scala-2.x/scala/xml/CompilerErrors.scala b/jvm/src/test/scala-2.x/scala/xml/CompilerErrors.scala index 6096e5a60..577d28ae5 100644 --- a/jvm/src/test/scala-2.x/scala/xml/CompilerErrors.scala +++ b/jvm/src/test/scala-2.x/scala/xml/CompilerErrors.scala @@ -4,14 +4,30 @@ import org.junit.Test class CompilerErrors extends CompilerTesting { @Test - def t7185() = - expectXmlError("""|overloaded method value apply with alternatives: + def t7185() = { + // Error message 2.13.1 and earlier: + // expectXmlError("""|overloaded method value apply with alternatives: + // | (f: scala.xml.Node => Boolean)scala.xml.NodeSeq + // | (i: Int)scala.xml.Node + // | cannot be applied to ()""".stripMargin, + // """|object Test { + // | () + // |}""") + + // Error message changed in Scala 2.13.2 + // https://github.com/scala/scala/pull/8592 + expectXmlError("overloaded method", // " apply " + """|object Test { + | () + |}""") + expectXmlError("""|with alternatives: | (f: scala.xml.Node => Boolean)scala.xml.NodeSeq | (i: Int)scala.xml.Node | cannot be applied to ()""".stripMargin, """|object Test { | () |}""") + } @Test def t1878_typer() = From 089db97d679a68639ccc79e9c86077f1e5735dd4 Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Thu, 26 Dec 2019 10:06:59 +0100 Subject: [PATCH 393/789] Update sbt to 1.3.6 --- project/build.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/build.properties b/project/build.properties index 6624da70b..00b48d978 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version=1.3.5 +sbt.version=1.3.6 From 111f6b05fe86e46be96ec866e5f3b92ce0755f7e Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Thu, 26 Dec 2019 11:06:46 -0500 Subject: [PATCH 394/789] Add builds for JDK 13 --- .circleci/config.yml | 30 ++++++++++++++++++++++++++++++ .travis.yml | 1 + 2 files changed, 31 insertions(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index 51219f645..80faef9d9 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -7,6 +7,12 @@ executors: scala_jdk11_executor: docker: - image: circleci/openjdk:11-jdk + scala_jdk13_executor: + docker: + - image: circleci/openjdk:13.0.1-jdk-buster + scala_jdk14_executor: + docker: + - image: circleci/openjdk:14-ea-26-jdk-buster commands: sbt_cmd: @@ -98,6 +104,30 @@ workflows: name: jdk11_dotty java_version: jdk11 scala_version: 0.20.0-RC1 + - scala_job: + name: jdk13_2.12 + java_version: jdk13 + scala_version: 2.12.10 + - scala_job: + name: jdk13_2.13 + java_version: jdk13 + scala_version: 2.13.1 + - scala_job: + name: jdk13_dotty + java_version: jdk13 + scala_version: 0.20.0-RC1 + - scala_job: + name: jdk14_2.12 + java_version: jdk14 + scala_version: 2.12.10 + - scala_job: + name: jdk14_2.13 + java_version: jdk14 + scala_version: 2.13.1 + - scala_job: + name: jdk14_dotty + java_version: jdk14 + scala_version: 0.20.0-RC1 - scalajs_job: name: sjs0.6_2.12 scala_version: 2.12.10 diff --git a/.travis.yml b/.travis.yml index 8ee796989..3debe8338 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,6 +14,7 @@ env: - SCALAJS_VERSION=0.6.31 ADOPTOPENJDK=8 - SCALAJS_VERSION=1.0.0-RC2 ADOPTOPENJDK=8 - SCALAJS_VERSION= ADOPTOPENJDK=11 + - SCALAJS_VERSION= ADOPTOPENJDK=13 matrix: exclude: From 5501c9541d025e454e4ac6c597585c69a986e7d2 Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Thu, 26 Dec 2019 13:07:37 -0500 Subject: [PATCH 395/789] Fix deprecated ScalaInstance.libraryJar Change to using xsbti.compile.ScalaInstance.libraryJars in sbt build. --- build.sbt | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/build.sbt b/build.sbt index 340f3d3b5..a96bc4a5f 100644 --- a/build.sbt +++ b/build.sbt @@ -117,10 +117,12 @@ lazy val xml = crossProject(JSPlatform, JVMPlatform) apiURL := Some( url(s"""https://scala.github.io/scala-xml/api/${"-.*".r.replaceAllIn(version.value, "")}/""") ), - apiMappings ++= Map( - scalaInstance.value.libraryJar - -> url(s"http://www.scala-lang.org/api/${scalaVersion.value}/") - ) ++ { + apiMappings ++= scalaInstance.value.libraryJars.filter { file => + file.getName.startsWith("scala-library") && file.getName.endsWith(".jar") + }.map { libraryJar => + libraryJar -> + url(s"http://www.scala-lang.org/api/${scalaVersion.value}/") + }.toMap ++ { // http://stackoverflow.com/questions/16934488 Option(System.getProperty("sun.boot.class.path")).flatMap { classPath => classPath.split(java.io.File.pathSeparator).find(_.endsWith(java.io.File.separator + "rt.jar")) From a5a497bc6c755e3326f34f190b7db9c3ecb49370 Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Fri, 27 Dec 2019 22:00:39 -0500 Subject: [PATCH 396/789] Update dotty 0.21.0-RC1 --- .circleci/config.yml | 10 +++++----- .travis.yml | 6 +++--- jvm/src/test/scala/scala/xml/XMLTest.scala | 4 ++-- .../main/scala/scala/xml/dtd/ElementValidator.scala | 7 +++---- .../scala/scala/xml/include/sax/XIncludeFilter.scala | 4 ++-- .../scala/scala/xml/parsing/MarkupParserCommon.scala | 4 ++-- shared/src/test/scala/scala/xml/AttributeTest.scala | 4 ++-- shared/src/test/scala/scala/xml/UtilityTest.scala | 2 +- shared/src/test/scala/scala/xml/XMLSyntaxTest.scala | 6 +++--- shared/src/test/scala/scala/xml/XMLTest.scala | 2 +- 10 files changed, 24 insertions(+), 25 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 80faef9d9..3a3f065a0 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -89,9 +89,9 @@ workflows: java_version: jdk8 scala_version: 2.13.1 - scala_job: - name: dotty-0.18 + name: dotty-0.21 java_version: jdk8 - scala_version: 0.20.0-RC1 + scala_version: 0.21.0-RC1 - scala_job: name: jdk11_2.12 java_version: jdk11 @@ -103,7 +103,7 @@ workflows: - scala_job: name: jdk11_dotty java_version: jdk11 - scala_version: 0.20.0-RC1 + scala_version: 0.21.0-RC1 - scala_job: name: jdk13_2.12 java_version: jdk13 @@ -115,7 +115,7 @@ workflows: - scala_job: name: jdk13_dotty java_version: jdk13 - scala_version: 0.20.0-RC1 + scala_version: 0.21.0-RC1 - scala_job: name: jdk14_2.12 java_version: jdk14 @@ -127,7 +127,7 @@ workflows: - scala_job: name: jdk14_dotty java_version: jdk14 - scala_version: 0.20.0-RC1 + scala_version: 0.21.0-RC1 - scalajs_job: name: sjs0.6_2.12 scala_version: 2.12.10 diff --git a/.travis.yml b/.travis.yml index 3debe8338..8b499c29b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,7 +5,7 @@ import: scala/scala-dev:travis/default.yml language: scala scala: - - 0.20.0-RC1 + - 0.21.0-RC1 - 2.12.10 - 2.13.1 @@ -18,9 +18,9 @@ env: matrix: exclude: - - scala: 0.20.0-RC1 + - scala: 0.21.0-RC1 env: SCALAJS_VERSION=0.6.31 ADOPTOPENJDK=8 - - scala: 0.20.0-RC1 + - scala: 0.21.0-RC1 env: SCALAJS_VERSION=1.0.0-RC2 ADOPTOPENJDK=8 install: diff --git a/jvm/src/test/scala/scala/xml/XMLTest.scala b/jvm/src/test/scala/scala/xml/XMLTest.scala index 0ca1ff1ce..26336807f 100644 --- a/jvm/src/test/scala/scala/xml/XMLTest.scala +++ b/jvm/src/test/scala/scala/xml/XMLTest.scala @@ -116,7 +116,7 @@ class XMLTestJVM { Elem(null, "title", e, sc, Text("Foundations of Programming Languages")))) assertEquals("Peter BunemanDan SuciuData on ze web", - (parsedxml2 \\ "book") { n: Node => (n \ "title") xml_== "Data on ze web" } toString) + (parsedxml2 \\ "book") { (n: Node) => (n \ "title") xml_== "Data on ze web" } toString) assertTrue( ((NodeSeq.fromSeq(List(parsedxml2))) \\ "_") sameElements List( @@ -408,7 +408,7 @@ class XMLTestJVM { @UnitTest def t5115 = { - def assertHonorsIterableContract(i: Iterable[_]) = assertEquals(i.size, i.iterator.size) + def assertHonorsIterableContract(i: Iterable[_]) = assertEquals(i.size.toLong, i.iterator.size.toLong) assertHonorsIterableContract(.attributes) assertHonorsIterableContract(.attributes) diff --git a/shared/src/main/scala/scala/xml/dtd/ElementValidator.scala b/shared/src/main/scala/scala/xml/dtd/ElementValidator.scala index 45618f06c..31035989d 100644 --- a/shared/src/main/scala/scala/xml/dtd/ElementValidator.scala +++ b/shared/src/main/scala/scala/xml/dtd/ElementValidator.scala @@ -70,12 +70,11 @@ class ElementValidator() extends Function1[Node, Boolean] { for (attr <- md) { def attrStr = attr.value.toString def find(Key: String): Option[AttrDecl] = { - adecls.zipWithIndex find { + adecls.zipWithIndex collectFirst { case (a@AttrDecl(Key, _, _), j) => - ok += j; return Some(a) - case _ => false + ok += j + a } - None } find(attr.key) match { diff --git a/shared/src/main/scala/scala/xml/include/sax/XIncludeFilter.scala b/shared/src/main/scala/scala/xml/include/sax/XIncludeFilter.scala index 4923cb1da..2470d5f64 100644 --- a/shared/src/main/scala/scala/xml/include/sax/XIncludeFilter.scala +++ b/shared/src/main/scala/scala/xml/include/sax/XIncludeFilter.scala @@ -291,10 +291,10 @@ class XIncludeFilter extends XMLFilterImpl { val reader = new InputStreamReader(in, encoding) val c = new Array[Char](1024) var charsRead: Int = 0 // bogus init value - do { + while ({ { charsRead = reader.read(c, 0, 1024) if (charsRead > 0) this.characters(c, 0, charsRead) - } while (charsRead != -1) + } ; charsRead != -1}) () } catch { case e: UnsupportedEncodingException => throw new SAXException("Unsupported encoding: " diff --git a/shared/src/main/scala/scala/xml/parsing/MarkupParserCommon.scala b/shared/src/main/scala/scala/xml/parsing/MarkupParserCommon.scala index caf165dfd..804891442 100644 --- a/shared/src/main/scala/scala/xml/parsing/MarkupParserCommon.scala +++ b/shared/src/main/scala/scala/xml/parsing/MarkupParserCommon.scala @@ -115,8 +115,8 @@ private[scala] trait MarkupParserCommon extends TokenTests { val buf = new StringBuilder - do buf append ch_returning_nextch - while (isNameChar(ch)) + while ({ buf append ch_returning_nextch + ; isNameChar(ch)}) () if (buf.last == ':') { reportSyntaxError("name cannot end in ':'") diff --git a/shared/src/test/scala/scala/xml/AttributeTest.scala b/shared/src/test/scala/scala/xml/AttributeTest.scala index e1e7f911a..84cebbeb6 100644 --- a/shared/src/test/scala/scala/xml/AttributeTest.scala +++ b/shared/src/test/scala/scala/xml/AttributeTest.scala @@ -24,7 +24,7 @@ class AttributeTest { appended = appended.next len = len + 1 } - assertEquals("removal of duplicates for unprefixed attributes in append", 1, len) + assertEquals("removal of duplicates for unprefixed attributes in append", 1L, len.toLong) } @Test @@ -151,7 +151,7 @@ class AttributeTest { def attributePathTwoChildrenWithAttributes: Unit = { val xml = val b = xml \ "b" - assertEquals(2, b.length) + assertEquals(2, b.length.toLong) assertEquals(NodeSeq.fromSeq(Seq(, )), b) val barFail = b \ "@bar" val barList = b.map(_ \ "@bar") diff --git a/shared/src/test/scala/scala/xml/UtilityTest.scala b/shared/src/test/scala/scala/xml/UtilityTest.scala index 765b9bad8..de4a8c29e 100644 --- a/shared/src/test/scala/scala/xml/UtilityTest.scala +++ b/shared/src/test/scala/scala/xml/UtilityTest.scala @@ -194,7 +194,7 @@ class UtilityTest { '\u001F' -> "^_", // Unit separator '\u007F' -> "^?" // Delete ).toMap.withDefault { - key: Char => key.toString + (key: Char) => key.toString } def issue73StartsWithAndEndsWithWSInFirst: Unit = { diff --git a/shared/src/test/scala/scala/xml/XMLSyntaxTest.scala b/shared/src/test/scala/scala/xml/XMLSyntaxTest.scala index 913c027f0..26410a9af 100644 --- a/shared/src/test/scala/scala/xml/XMLSyntaxTest.scala +++ b/shared/src/test/scala/scala/xml/XMLSyntaxTest.scala @@ -29,16 +29,16 @@ class XMLSyntaxTest { assertEquals(1.5, handle[Double](xb), 0.0) val xc = { 5 } - assertEquals(5, handle[Int](xc)) + assertEquals(5, handle[Int](xc).toLong) val xd = { true } assertEquals(true, handle[Boolean](xd)) val xe = { 5:Short } - assertEquals((5:Short), handle[Short](xe)) + assertEquals((5:Short).toLong, handle[Short](xe).toLong) val xf = { val x = 27; x } - assertEquals(27, handle[Int](xf)) + assertEquals(27, handle[Int](xf).toLong) val xg = { List(1,2,3,4) } assertEquals("1 2 3 4", xg.toString) diff --git a/shared/src/test/scala/scala/xml/XMLTest.scala b/shared/src/test/scala/scala/xml/XMLTest.scala index 1e0a304c7..d88b6c80e 100644 --- a/shared/src/test/scala/scala/xml/XMLTest.scala +++ b/shared/src/test/scala/scala/xml/XMLTest.scala @@ -461,7 +461,7 @@ Ours is the portal of hope, come as you are." @UnitTest def t5115 = { - def assertHonorsIterableContract(i: Iterable[_]) = assertEquals(i.size, i.iterator.size) + def assertHonorsIterableContract(i: Iterable[_]) = assertEquals(i.size.toLong, i.iterator.size.toLong) assertHonorsIterableContract(.attributes) assertHonorsIterableContract(.attributes) From a0a0599f3f0a3a0761e7bba3c5aa75561c7b47a0 Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Wed, 1 Jan 2020 19:08:04 +0100 Subject: [PATCH 397/789] Update junit to 4.13 --- build.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index a96bc4a5f..3cfafab72 100644 --- a/build.sbt +++ b/build.sbt @@ -148,7 +148,7 @@ lazy val xml = crossProject(JSPlatform, JVMPlatform) .jvmSettings( OsgiKeys.exportPackage := Seq(s"scala.xml.*;version=${version.value}"), - libraryDependencies += "junit" % "junit" % "4.12" % Test, + libraryDependencies += "junit" % "junit" % "4.13" % Test, libraryDependencies += "com.novocode" % "junit-interface" % "0.11" % Test, libraryDependencies += "org.apache.commons" % "commons-lang3" % "3.9" % Test, libraryDependencies ++= { From b3bbb57e23fc1f7be142d1a703bd4025c453272e Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Mon, 6 Jan 2020 11:16:33 -0500 Subject: [PATCH 398/789] Enable dotty in build.sh --- build.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/build.sh b/build.sh index 4603378bc..e4376a00d 100755 --- a/build.sh +++ b/build.sh @@ -14,19 +14,23 @@ set -e # can be released using that new Scala version by creating a new tag containing the Scala version # after a hash, e.g., v1.2.3#2.13.0-M3. -# For normal tags that are cross-built, we release on JDK 8 for Scala 2.x +# For normal tags that are cross-built, we release on JDK 8 for Scala 2.x and Dotty 0.x isReleaseJob() { if [[ "$ADOPTOPENJDK" == "8" && "$TRAVIS_SCALA_VERSION" =~ ^2\.1[234]\..*$ ]]; then true + elif [[ "$ADOPTOPENJDK" == "8" && "$TRAVIS_SCALA_VERSION" =~ ^0\.[0-9]+\..*$ ]]; then + true else false fi } -# For tags that define a Scala version, we pick the jobs of one Scala version (2.13.x) to do the releases +# For tags that define a Scala version, we pick the jobs of a Scala version (2.13.x) or Dotty (0.x) to do the releases isTagScalaReleaseJob() { if [[ "$ADOPTOPENJDK" == "8" && "$TRAVIS_SCALA_VERSION" =~ ^2\.13\.[0-9]+$ ]]; then true + elif [[ "$ADOPTOPENJDK" == "8" && "$TRAVIS_SCALA_VERSION" =~ ^0\.[0-9]+\..*$ ]]; then + true else false fi From 3d0e77d7f0c488f3ded3be594fc4700895a44f15 Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Mon, 6 Jan 2020 12:27:48 -0500 Subject: [PATCH 399/789] Drop dtd.ElementValidator --- build.sbt | 2 + .../scala/xml/dtd/ElementValidator.scala | 135 ------------------ shared/src/test/scala/scala/xml/XMLTest.scala | 51 ------- 3 files changed, 2 insertions(+), 186 deletions(-) delete mode 100644 shared/src/main/scala/scala/xml/dtd/ElementValidator.scala diff --git a/build.sbt b/build.sbt index 3cfafab72..555155c57 100644 --- a/build.sbt +++ b/build.sbt @@ -92,6 +92,8 @@ lazy val xml = crossProject(JSPlatform, JVMPlatform) exclude[MissingClassProblem]("scala.xml.dtd.Scanner"), exclude[MissingClassProblem]("scala.xml.dtd.ContentModelParser$"), exclude[MissingClassProblem]("scala.xml.dtd.ContentModelParser"), + exclude[MissingClassProblem]("scala.xml.dtd.ElementValidator"), + exclude[MissingClassProblem]("scala.xml.dtd.ElementValidator"), exclude[MissingClassProblem]("scala.xml.factory.Binder"), exclude[MissingClassProblem]("scala.xml.parsing.ValidatingMarkupHandler"), exclude[MissingClassProblem]("scala.xml.persistent.CachedFileStorage"), diff --git a/shared/src/main/scala/scala/xml/dtd/ElementValidator.scala b/shared/src/main/scala/scala/xml/dtd/ElementValidator.scala deleted file mode 100644 index 31035989d..000000000 --- a/shared/src/main/scala/scala/xml/dtd/ElementValidator.scala +++ /dev/null @@ -1,135 +0,0 @@ -/* __ *\ -** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2002-2019, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | http://www.scala-lang.org/ ** -** /____/\___/_/ |_/____/_/ | | ** -** |/ ** -\* */ - -package scala -package xml -package dtd - -import PartialFunction._ -import scala.collection.mutable -import scala.collection.Seq - -import ContentModel.ElemName -import MakeValidationException._ // @todo other exceptions - -import impl._ - -/** - * validate children and/or attributes of an element - * exceptions are created but not thrown. - */ -class ElementValidator() extends Function1[Node, Boolean] { - - private var exc: List[ValidationException] = Nil - - protected var contentModel: ContentModel = _ - protected var dfa: DetWordAutom[ElemName] = _ - protected var adecls: List[AttrDecl] = _ - - /** set content model, enabling element validation */ - def setContentModel(cm: ContentModel) = { - contentModel = cm - cm match { - case ELEMENTS(r) => - val nfa = ContentModel.Translator.automatonFrom(r, 1) - dfa = new SubsetConstruction(nfa).determinize - case _ => - dfa = null - } - } - - def getContentModel = contentModel - - /** set meta data, enabling attribute validation */ - def setMetaData(adecls: List[AttrDecl]): Unit = { this.adecls = adecls } - - def getIterable(nodes: Seq[Node], skipPCDATA: Boolean): Iterable[ElemName] = { - def isAllWhitespace(a: Atom[_]) = cond(a.data) { case s: String if s.trim == "" => true } - - nodes.filter { - case y: SpecialNode => y match { - case a: Atom[_] if isAllWhitespace(a) => false // always skip all-whitespace nodes - case _ => !skipPCDATA - } - case x => x.namespace eq null - }.map (x => ElemName(x.label)) - } - - /** - * check attributes, return true if md corresponds to attribute declarations in adecls. - */ - def check(md: MetaData): Boolean = { - val len: Int = exc.length - val ok = new mutable.BitSet(adecls.length) - - for (attr <- md) { - def attrStr = attr.value.toString - def find(Key: String): Option[AttrDecl] = { - adecls.zipWithIndex collectFirst { - case (a@AttrDecl(Key, _, _), j) => - ok += j - a - } - } - - find(attr.key) match { - case None => - exc ::= fromUndefinedAttribute(attr.key) - - case Some(AttrDecl(_, tpe, DEFAULT(true, fixedValue))) if attrStr != fixedValue => - exc ::= fromFixedAttribute(attr.key, fixedValue, attrStr) - - case _ => - } - } - - adecls.zipWithIndex foreach { - case (AttrDecl(key, tpe, REQUIRED), j) if !ok(j) => exc ::= fromMissingAttribute(key, tpe) - case _ => - } - - exc.length == len //- true if no new exception - } - - /** - * check children, return true if conform to content model - * @note contentModel != null - */ - def check(nodes: Seq[Node]): Boolean = contentModel match { - case ANY => true - case EMPTY => getIterable(nodes, skipPCDATA = false).isEmpty - case PCDATA => getIterable(nodes, skipPCDATA = true).isEmpty - case MIXED(ContentModel.Alt(branches@_*)) => // @todo - val j = exc.length - def find(Key: String): Boolean = - branches exists { case ContentModel.Letter(ElemName(Key)) => true; case _ => false } - - getIterable(nodes, skipPCDATA = true) map (_.name) filterNot find foreach { - exc ::= MakeValidationException fromUndefinedElement _ - } - (exc.length == j) // - true if no new exception - - case _: ELEMENTS => - dfa isFinal { - getIterable(nodes, skipPCDATA = false).foldLeft(0) { (q, e) => - (dfa delta q).getOrElse(e, throw ValidationException("element %s not allowed here" format e)) - } - } - case _ => false - } - - /** - * applies various validations - accumulates error messages in exc - * @todo fail on first error, ignore other errors (rearranging conditions) - */ - def apply(n: Node): Boolean = - //- ? check children - ((contentModel == null) || check(n.child)) && - //- ? check attributes - ((adecls == null) || check(n.attributes)) -} diff --git a/shared/src/test/scala/scala/xml/XMLTest.scala b/shared/src/test/scala/scala/xml/XMLTest.scala index d88b6c80e..7644ac645 100644 --- a/shared/src/test/scala/scala/xml/XMLTest.scala +++ b/shared/src/test/scala/scala/xml/XMLTest.scala @@ -176,57 +176,6 @@ class XMLTest { assertEquals(expected, actual) } - @UnitTest - def validationOfElements: Unit = { - val vtor = new scala.xml.dtd.ElementValidator(); - { - import scala.xml.dtd.ELEMENTS - import scala.xml.dtd.ContentModel._ - vtor.setContentModel( - ELEMENTS( - Sequ( - Letter(ElemName("bar")), - Star(Letter(ElemName("baz")))))); - } - assertTrue(vtor()) - - { - import scala.xml.dtd.MIXED - import scala.xml.dtd.ContentModel._ - - vtor.setContentModel( - MIXED( - Alt(Letter(ElemName("bar")), - Letter(ElemName("baz")), - Letter(ElemName("bal"))))); - } - - assertTrue(vtor()) - assertTrue(vtor(abcdedgh)) - assertFalse(vtor( )) - } - - def validationfOfAttributes: Unit = { - val vtor = new scala.xml.dtd.ElementValidator(); - vtor.setContentModel(null) - vtor.setMetaData(List()) - assertFalse(vtor()) - - { - import scala.xml.dtd._ - vtor setMetaData List(AttrDecl("bar", "CDATA", IMPLIED)) - } - assertFalse(vtor()) - assertTrue(vtor()) - - { - import scala.xml.dtd._ - vtor.setMetaData(List(AttrDecl("bar", "CDATA", REQUIRED))) - } - assertFalse(vtor()) - assertTrue(vtor()) - } - def Elem(prefix: String, label: String, attributes: MetaData, scope: NamespaceBinding, child: Node*): Elem = scala.xml.Elem.apply(prefix, label, attributes, scope, minimizeEmpty = true, child: _*) From 492a87002ec9b3168a6ff15436e1cbbecf3dd346 Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Thu, 16 Jan 2020 17:53:29 +0100 Subject: [PATCH 400/789] Update sbt to 1.3.7 --- project/build.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/build.properties b/project/build.properties index 00b48d978..a82bb05e1 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version=1.3.6 +sbt.version=1.3.7 From bf4d7114756425403bbf1361d38dd2fb05d4f8b4 Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Sun, 19 Jan 2020 07:53:48 +0100 Subject: [PATCH 401/789] Update sbt-dotty to 0.4.0 --- project/plugins.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/plugins.sbt b/project/plugins.sbt index 410065be8..c2af5fe71 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -4,4 +4,4 @@ val scalaJSVersion = addSbtPlugin("org.scala-lang.modules" % "sbt-scala-module" % "2.1.3") addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "0.6.1") addSbtPlugin("org.scala-js" % "sbt-scalajs" % scalaJSVersion) -addSbtPlugin("ch.epfl.lamp" % "sbt-dotty" % "0.3.4") +addSbtPlugin("ch.epfl.lamp" % "sbt-dotty" % "0.4.0") From f4f32b4579001838e25f3762706a7190d52385ca Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Tue, 21 Jan 2020 16:27:29 -0500 Subject: [PATCH 402/789] Use openjdk8 on Travis for 1.x --- .sbtrepos | 8 -------- .travis.yml | 23 +---------------------- admin/build.sh | 10 ++-------- 3 files changed, 3 insertions(+), 38 deletions(-) delete mode 100644 .sbtrepos diff --git a/.sbtrepos b/.sbtrepos deleted file mode 100644 index b9e49c484..000000000 --- a/.sbtrepos +++ /dev/null @@ -1,8 +0,0 @@ -[repositories] - local - local-preloaded-ivy: file:///${sbt.preloaded-${sbt.global.base-${user.home}/.sbt}/preloaded/}, [organization]/[module]/[revision]/[type]s/[artifact](-[classifier]).[ext] - local-preloaded: file:///${sbt.preloaded-${sbt.global.base-${user.home}/.sbt}/preloaded/} - maven-central: http://repo1.maven.org/maven2/ - sonatype-public: http://oss.sonatype.org/content/repositories/public - typesafe-ivy-releases: http://repo.typesafe.com/typesafe/ivy-releases/, [organization]/[module]/(scala_[scalaVersion]/)(sbt_[sbtVersion]/)[revision]/[type]s/[artifact](-[classifier]).[ext], bootOnly - sbt-ivy-releases: http://repo.scala-sbt.org/scalasbt/sbt-plugin-releases/, [organization]/[module]/(scala_[scalaVersion]/)(sbt_[sbtVersion]/)[revision]/[type]s/[artifact](-[classifier]).[ext], bootOnly diff --git a/.travis.yml b/.travis.yml index 3dc48bdd6..51ec8c471 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,16 +1,7 @@ language: scala -# Needed for openjdk6 -dist: precise -sudo: required -addons: - hosts: - - localhost - hostname: localhost.local - jdk: - - openjdk6 - - oraclejdk8 + - openjdk8 - openjdk11 scala: @@ -40,22 +31,10 @@ matrix: env: SCALAJS_VERSION=1.0.0-M8 - scala: 2.11.12 env: SCALAJS_VERSION=1.0.0-M8 - - scala: 2.11.12 - jdk: oraclejdk8 - scala: 2.11.12 jdk: openjdk11 - - scala: 2.12.8 - jdk: openjdk6 - - scala: 2.13.0 - jdk: openjdk6 - -before_script: - - nvm install 8 - - nvm use 8 script: - # work around https://github.com/travis-ci/travis-ci/issues/9713 - - if [[ $JAVA_HOME = *java-6* ]]; then jdk_switcher use openjdk6; fi - java -version - node -v - admin/build.sh diff --git a/admin/build.sh b/admin/build.sh index 2ebd80311..d46687cd6 100755 --- a/admin/build.sh +++ b/admin/build.sh @@ -16,8 +16,7 @@ set -e # of the existing tag. Then a new tag can be created for that commit, e.g., `v1.2.3#2.13.0-M5`. # Everything after the `#` in the tag name is ignored. -if [[ "$TRAVIS_JDK_VERSION" == "openjdk6" && "$TRAVIS_SCALA_VERSION" =~ 2\.11\..* \ - || "$TRAVIS_JDK_VERSION" == "oraclejdk8" && "$TRAVIS_SCALA_VERSION" =~ 2\.1[23]\..* ]]; then +if [[ "$TRAVIS_JDK_VERSION" == "openjdk8" && "$TRAVIS_SCALA_VERSION" =~ 2\.1[123]\..* ]]; then RELEASE_COMBO=true; fi @@ -52,9 +51,4 @@ if [[ "$TRAVIS_TAG" =~ $tagPat ]]; then fi fi -# Maven Central and Bintray are unreachable over HTTPS -if [[ "$TRAVIS_JDK_VERSION" == "openjdk6" ]]; then - SBTOPTS="-Dsbt.override.build.repos=true -Dsbt.repository.config=./.sbtrepos" -fi - -sbt $SBTOPTS "++$TRAVIS_SCALA_VERSION" "$publishVersion" "$projectPrefix/clean" "$projectPrefix/test" "$projectPrefix/publishLocal" "$publishTask" +sbt "++$TRAVIS_SCALA_VERSION" "$publishVersion" "$projectPrefix/clean" "$projectPrefix/test" "$projectPrefix/publishLocal" "$publishTask" From b345ad1f901dbf2493958cd72f2a585d6b2705aa Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Tue, 21 Jan 2020 16:44:14 -0500 Subject: [PATCH 403/789] Deprecate various classes --- shared/src/main/scala/scala/xml/dtd/ContentModelParser.scala | 1 + shared/src/main/scala/scala/xml/dtd/ElementValidator.scala | 1 + shared/src/main/scala/scala/xml/dtd/Scanner.scala | 1 + shared/src/main/scala/scala/xml/factory/Binder.scala | 1 + .../main/scala/scala/xml/parsing/ValidatingMarkupHandler.scala | 1 + 5 files changed, 5 insertions(+) diff --git a/shared/src/main/scala/scala/xml/dtd/ContentModelParser.scala b/shared/src/main/scala/scala/xml/dtd/ContentModelParser.scala index c69dca9f2..a5676052f 100644 --- a/shared/src/main/scala/scala/xml/dtd/ContentModelParser.scala +++ b/shared/src/main/scala/scala/xml/dtd/ContentModelParser.scala @@ -12,6 +12,7 @@ package dtd /** Parser for regexps (content models in DTD element declarations) */ +@deprecated("This object will be removed", "1.3.0") object ContentModelParser extends Scanner { // a bit too permissive concerning #PCDATA import ContentModel._ diff --git a/shared/src/main/scala/scala/xml/dtd/ElementValidator.scala b/shared/src/main/scala/scala/xml/dtd/ElementValidator.scala index 45618f06c..4f5d0097f 100644 --- a/shared/src/main/scala/scala/xml/dtd/ElementValidator.scala +++ b/shared/src/main/scala/scala/xml/dtd/ElementValidator.scala @@ -23,6 +23,7 @@ import impl._ * validate children and/or attributes of an element * exceptions are created but not thrown. */ +@deprecated("This class will be removed", "1.3.0") class ElementValidator() extends Function1[Node, Boolean] { private var exc: List[ValidationException] = Nil diff --git a/shared/src/main/scala/scala/xml/dtd/Scanner.scala b/shared/src/main/scala/scala/xml/dtd/Scanner.scala index cb042d5a9..4612e4ce8 100644 --- a/shared/src/main/scala/scala/xml/dtd/Scanner.scala +++ b/shared/src/main/scala/scala/xml/dtd/Scanner.scala @@ -16,6 +16,7 @@ import scala.collection.Seq * Scanner for regexps (content models in DTD element declarations) * todo: cleanup */ +@deprecated("This class will be removed", "1.3.0") class Scanner extends Tokens with parsing.TokenTests { final val ENDCH = '\u0000' diff --git a/shared/src/main/scala/scala/xml/factory/Binder.scala b/shared/src/main/scala/scala/xml/factory/Binder.scala index 3c1b595ac..24e81257f 100755 --- a/shared/src/main/scala/scala/xml/factory/Binder.scala +++ b/shared/src/main/scala/scala/xml/factory/Binder.scala @@ -15,6 +15,7 @@ import parsing.ValidatingMarkupHandler /** * @author Burak Emir */ +@deprecated("This class will be removed", "1.3.0") abstract class Binder(val preserveWS: Boolean) extends ValidatingMarkupHandler { var result: NodeBuffer = new NodeBuffer() diff --git a/shared/src/main/scala/scala/xml/parsing/ValidatingMarkupHandler.scala b/shared/src/main/scala/scala/xml/parsing/ValidatingMarkupHandler.scala index a1821bd95..8bbcbefca 100644 --- a/shared/src/main/scala/scala/xml/parsing/ValidatingMarkupHandler.scala +++ b/shared/src/main/scala/scala/xml/parsing/ValidatingMarkupHandler.scala @@ -12,6 +12,7 @@ package parsing import scala.xml.dtd._ +@deprecated("This class will be removed", "1.3.0") abstract class ValidatingMarkupHandler extends MarkupHandler { var rootLabel: String = _ From 0723a87029a1a6f6a91abd39d27f652d8e1e8ea6 Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Tue, 21 Jan 2020 17:03:42 -0500 Subject: [PATCH 404/789] Add empty Circle config --- .circleci/config.yml | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 .circleci/config.yml diff --git a/.circleci/config.yml b/.circleci/config.yml new file mode 100644 index 000000000..15aef0bf2 --- /dev/null +++ b/.circleci/config.yml @@ -0,0 +1,8 @@ +version: 2.1 + +jobs: + build: + docker: + - image: bash + steps: + - checkout From bcb83f308a7cf6c635aaf93442517ef5f5765b5a Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Tue, 21 Jan 2020 23:08:49 -0500 Subject: [PATCH 405/789] Fix 2.13 collections methods for NodeSeq --- .../scala/xml/ScalaVersionSpecific.scala | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/shared/src/main/scala-2.13/scala/xml/ScalaVersionSpecific.scala b/shared/src/main/scala-2.13/scala/xml/ScalaVersionSpecific.scala index bd2eb820d..4258c100f 100644 --- a/shared/src/main/scala-2.13/scala/xml/ScalaVersionSpecific.scala +++ b/shared/src/main/scala-2.13/scala/xml/ScalaVersionSpecific.scala @@ -1,7 +1,7 @@ package scala.xml import scala.collection.immutable.StrictOptimizedSeqOps -import scala.collection.{SeqOps, IterableOnce, immutable, mutable} +import scala.collection.{View, SeqOps, IterableOnce, immutable, mutable} import scala.collection.BuildFrom import scala.collection.mutable.Builder @@ -20,6 +20,21 @@ private[xml] trait ScalaVersionSpecificNodeSeq override def fromSpecific(coll: IterableOnce[Node]): NodeSeq = (NodeSeq.newBuilder ++= coll).result() override def newSpecificBuilder: mutable.Builder[Node, NodeSeq] = NodeSeq.newBuilder override def empty: NodeSeq = NodeSeq.Empty + def concat(suffix: IterableOnce[Node]): NodeSeq = + fromSpecific(iterator ++ suffix.iterator) + @inline final def ++ (suffix: Seq[Node]): NodeSeq = concat(suffix) + def appended(base: Node): NodeSeq = + fromSpecific(new View.Appended(this, base)) + def appendedAll(suffix: IterableOnce[Node]): NodeSeq = + concat(suffix) + def prepended(base: Node): NodeSeq = + fromSpecific(new View.Prepended(base, this)) + def prependedAll(prefix: IterableOnce[Node]): NodeSeq = + fromSpecific(prefix.iterator ++ iterator) + def map(f: Node => Node): NodeSeq = + fromSpecific(new View.Map(this, f)) + def flatMap(f: Node => IterableOnce[Node]): NodeSeq = + fromSpecific(new View.FlatMap(this, f)) } private[xml] trait ScalaVersionSpecificNodeBuffer { self: NodeBuffer => From e7239358da50da6c7fe34de071ed772fc62be698 Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Tue, 21 Jan 2020 23:31:43 -0500 Subject: [PATCH 406/789] Add test of issue 392 --- .../test/scala/scala/xml/NodeSeqTest.scala | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 shared/src/test/scala/scala/xml/NodeSeqTest.scala diff --git a/shared/src/test/scala/scala/xml/NodeSeqTest.scala b/shared/src/test/scala/scala/xml/NodeSeqTest.scala new file mode 100644 index 000000000..08b7c0d79 --- /dev/null +++ b/shared/src/test/scala/scala/xml/NodeSeqTest.scala @@ -0,0 +1,23 @@ +package scala.xml + +import scala.xml.NodeSeq.seqToNodeSeq + +import org.junit.Test +import org.junit.Assert.assertEquals +import org.junit.Assert.fail + +class NodeSeqTest { + + @Test + def testAppend: Unit = { // Bug #392. + val a: NodeSeq = Hello + val b = Hi + a ++ Hi match { + case res: NodeSeq => assertEquals(2, res.size) + case res: Seq[Node] => fail("Should be NodeSeq") // Unreachable code? + } + val res: NodeSeq = a ++ b + val exp = NodeSeq.fromSeq(Seq(Hello, Hi)) + assertEquals(exp, res) + } +} From ff615acb88403163e8d08af3a43d299f558b164c Mon Sep 17 00:00:00 2001 From: Seth Tisue Date: Wed, 22 Jan 2020 11:56:17 -0800 Subject: [PATCH 407/789] copyright 2020 --- NOTICE | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/NOTICE b/NOTICE index 8d1b2d704..55798713d 100644 --- a/NOTICE +++ b/NOTICE @@ -1,6 +1,6 @@ scala-xml -Copyright (c) 2002-2019 EPFL -Copyright (c) 2011-2019 Lightbend, Inc. +Copyright (c) 2002-2020 EPFL +Copyright (c) 2011-2020 Lightbend, Inc. scala-xml includes software developed at LAMP/EPFL (https://lamp.epfl.ch/) and From 052695f28ed3bacb9413c2fd0857c8c7322e30e8 Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Thu, 23 Jan 2020 21:14:30 +0100 Subject: [PATCH 408/789] Update sbt-scalajs to 0.6.32 --- .travis.yml | 4 ++-- project/plugins.sbt | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 8b499c29b..1e6bfec48 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,7 +11,7 @@ scala: env: - SCALAJS_VERSION= ADOPTOPENJDK=8 - - SCALAJS_VERSION=0.6.31 ADOPTOPENJDK=8 + - SCALAJS_VERSION=0.6.32 ADOPTOPENJDK=8 - SCALAJS_VERSION=1.0.0-RC2 ADOPTOPENJDK=8 - SCALAJS_VERSION= ADOPTOPENJDK=11 - SCALAJS_VERSION= ADOPTOPENJDK=13 @@ -19,7 +19,7 @@ env: matrix: exclude: - scala: 0.21.0-RC1 - env: SCALAJS_VERSION=0.6.31 ADOPTOPENJDK=8 + env: SCALAJS_VERSION=0.6.32 ADOPTOPENJDK=8 - scala: 0.21.0-RC1 env: SCALAJS_VERSION=1.0.0-RC2 ADOPTOPENJDK=8 diff --git a/project/plugins.sbt b/project/plugins.sbt index c2af5fe71..32a04af08 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,5 +1,5 @@ val scalaJSVersion = - Option(System.getenv("SCALAJS_VERSION")).filter(_.nonEmpty).getOrElse("0.6.31") + Option(System.getenv("SCALAJS_VERSION")).filter(_.nonEmpty).getOrElse("0.6.32") addSbtPlugin("org.scala-lang.modules" % "sbt-scala-module" % "2.1.3") addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "0.6.1") From bef647bcd8a2c8b5d5bb699d30002639e0b8d363 Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Fri, 24 Jan 2020 06:10:31 -0500 Subject: [PATCH 409/789] Update Scala.js 0.6.32 in Circle --- .circleci/config.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 3a3f065a0..6522d0cb6 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -65,7 +65,7 @@ jobs: type: string scalajs_version: description: "ScalaJS version" - default: 0.6.31 + default: 0.6.32 type: string environment: SCALAJS_VERSION: << parameters.scalajs_version >> @@ -131,11 +131,11 @@ workflows: - scalajs_job: name: sjs0.6_2.12 scala_version: 2.12.10 - scalajs_version: 0.6.31 + scalajs_version: 0.6.32 - scalajs_job: name: sjs0.6_2.13 scala_version: 2.13.1 - scalajs_version: 0.6.31 + scalajs_version: 0.6.32 - scalajs_job: name: sjs1.0.0-RC2_2.12 scala_version: 2.12.10 From df7d18eb85aa7c3880b60de1c88a803f0412372b Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Fri, 31 Jan 2020 06:32:54 -0500 Subject: [PATCH 410/789] Add further tests of NodeSeq --- .../test/scala/scala/xml/NodeSeqTest.scala | 80 +++++++++++++++++++ 1 file changed, 80 insertions(+) diff --git a/shared/src/test/scala/scala/xml/NodeSeqTest.scala b/shared/src/test/scala/scala/xml/NodeSeqTest.scala index 08b7c0d79..d8ba4cc70 100644 --- a/shared/src/test/scala/scala/xml/NodeSeqTest.scala +++ b/shared/src/test/scala/scala/xml/NodeSeqTest.scala @@ -20,4 +20,84 @@ class NodeSeqTest { val exp = NodeSeq.fromSeq(Seq(Hello, Hi)) assertEquals(exp, res) } + + @Test + def testAppendedAll: Unit = { // Bug #392. + val a: NodeSeq = Hello + val b = Hi + a :+ Hi match { + case res: Seq[Node] => assertEquals(2, res.size) + case res: NodeSeq => fail("Should be Seq[Node]") // Unreachable code? + } + val res: NodeSeq = a :+ b + val exp = NodeSeq.fromSeq(Seq(Hello, Hi)) + assertEquals(exp, res) + } + + @Test + def testPrepended: Unit = { + val a: NodeSeq = Hello + val b = Hi + a +: Hi match { + case res: Seq[NodeSeq] => assertEquals(2, res.size) + case res: NodeSeq => fail("Should be NodeSeq was Seq[Node]") // Unreachable code? + } + val res: Seq[NodeSeq] = a +: b + val exp = HelloHi + assertEquals(exp, res) + } + + @Test + def testPrependedAll: Unit = { + val a: NodeSeq = Hello + val b = Hi + val c = Hey + a ++: Hi ++: Hey match { + case res: Seq[Node] => assertEquals(3, res.size) + case res: NodeSeq => fail("Should be Seq[Node]") // Unreachable code? + } + val res: NodeSeq = a ++: b ++: c + val exp = NodeSeq.fromSeq(Seq(Hello, Hi, Hey)) + assertEquals(exp, res) + } + + @Test + def testMap: Unit = { + val a: NodeSeq = Hello + val exp: NodeSeq = Seq(Hi) + assertEquals(exp, a.map(_ => Hi)) + assertEquals(exp, for { _ <- a } yield { Hi }) + } + + @Test + def testFlatMap: Unit = { + val a: NodeSeq = Hello + val exp: NodeSeq = Seq(Hi) + assertEquals(exp, a.flatMap(_ => Seq(Hi))) + assertEquals(exp, for { b <- a; _ <- b } yield { Hi }) + assertEquals(exp, for { b <- a; c <- b; _ <- c } yield { Hi }) + } + + @Test + def testStringProjection: Unit = { + val a = + + b + + + e + e + + c + + + val res = for { + b <- a \ "b" + c <- b.child + e <- (c \ "e").headOption + } yield { + e.text.trim + } + assertEquals(Seq("e"), res) + } } From 74c81a98a2ed263a8e945aafcb65a0bd89bc9e09 Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Fri, 31 Jan 2020 06:35:06 -0500 Subject: [PATCH 411/789] Update copyright 2020 --- shared/src/main/scala/scala/xml/Atom.scala | 6 +++--- shared/src/main/scala/scala/xml/Attribute.scala | 6 +++--- shared/src/main/scala/scala/xml/Comment.scala | 6 +++--- shared/src/main/scala/scala/xml/Document.scala | 6 +++--- shared/src/main/scala/scala/xml/Elem.scala | 6 +++--- shared/src/main/scala/scala/xml/EntityRef.scala | 6 +++--- shared/src/main/scala/scala/xml/Equality.scala | 6 +++--- shared/src/main/scala/scala/xml/Group.scala | 6 +++--- .../main/scala/scala/xml/MalformedAttributeException.scala | 6 +++--- shared/src/main/scala/scala/xml/MetaData.scala | 6 +++--- shared/src/main/scala/scala/xml/NamespaceBinding.scala | 6 +++--- shared/src/main/scala/scala/xml/Node.scala | 6 +++--- shared/src/main/scala/scala/xml/NodeBuffer.scala | 6 +++--- shared/src/main/scala/scala/xml/NodeSeq.scala | 6 +++--- shared/src/main/scala/scala/xml/Null.scala | 6 +++--- shared/src/main/scala/scala/xml/PCData.scala | 6 +++--- shared/src/main/scala/scala/xml/PrefixedAttribute.scala | 6 +++--- shared/src/main/scala/scala/xml/PrettyPrinter.scala | 6 +++--- shared/src/main/scala/scala/xml/ProcInstr.scala | 6 +++--- shared/src/main/scala/scala/xml/QNode.scala | 6 +++--- shared/src/main/scala/scala/xml/SpecialNode.scala | 6 +++--- shared/src/main/scala/scala/xml/Text.scala | 6 +++--- shared/src/main/scala/scala/xml/TextBuffer.scala | 6 +++--- shared/src/main/scala/scala/xml/TopScope.scala | 6 +++--- shared/src/main/scala/scala/xml/TypeSymbol.scala | 6 +++--- shared/src/main/scala/scala/xml/Unparsed.scala | 6 +++--- shared/src/main/scala/scala/xml/UnprefixedAttribute.scala | 6 +++--- shared/src/main/scala/scala/xml/Utility.scala | 6 +++--- shared/src/main/scala/scala/xml/XML.scala | 6 +++--- shared/src/main/scala/scala/xml/Xhtml.scala | 6 +++--- shared/src/main/scala/scala/xml/dtd/ContentModel.scala | 6 +++--- shared/src/main/scala/scala/xml/dtd/DTD.scala | 6 +++--- shared/src/main/scala/scala/xml/dtd/Decl.scala | 6 +++--- shared/src/main/scala/scala/xml/dtd/DocType.scala | 6 +++--- shared/src/main/scala/scala/xml/dtd/ExternalID.scala | 6 +++--- shared/src/main/scala/scala/xml/dtd/Tokens.scala | 6 +++--- .../src/main/scala/scala/xml/dtd/ValidationException.scala | 6 +++--- shared/src/main/scala/scala/xml/dtd/impl/Base.scala | 6 +++--- .../src/main/scala/scala/xml/dtd/impl/BaseBerrySethi.scala | 6 +++--- shared/src/main/scala/scala/xml/dtd/impl/DetWordAutom.scala | 6 +++--- shared/src/main/scala/scala/xml/dtd/impl/Inclusion.scala | 6 +++--- .../src/main/scala/scala/xml/dtd/impl/NondetWordAutom.scala | 6 +++--- .../main/scala/scala/xml/dtd/impl/SubsetConstruction.scala | 6 +++--- shared/src/main/scala/scala/xml/dtd/impl/SyntaxError.scala | 6 +++--- .../src/main/scala/scala/xml/dtd/impl/WordBerrySethi.scala | 6 +++--- shared/src/main/scala/scala/xml/dtd/impl/WordExp.scala | 6 +++--- .../main/scala/scala/xml/factory/LoggedNodeFactory.scala | 6 +++--- shared/src/main/scala/scala/xml/factory/NodeFactory.scala | 6 +++--- shared/src/main/scala/scala/xml/factory/XMLLoader.scala | 6 +++--- .../scala/scala/xml/include/CircularIncludeException.scala | 6 +++--- .../scala/xml/include/UnavailableResourceException.scala | 6 +++--- .../main/scala/scala/xml/include/XIncludeException.scala | 6 +++--- .../scala/scala/xml/include/sax/EncodingHeuristics.scala | 6 +++--- .../main/scala/scala/xml/include/sax/XIncludeFilter.scala | 6 +++--- shared/src/main/scala/scala/xml/include/sax/XIncluder.scala | 6 +++--- shared/src/main/scala/scala/xml/package.scala | 6 +++--- .../main/scala/scala/xml/parsing/ConstructingHandler.scala | 6 +++--- .../main/scala/scala/xml/parsing/ConstructingParser.scala | 6 +++--- .../main/scala/scala/xml/parsing/DefaultMarkupHandler.scala | 6 +++--- .../src/main/scala/scala/xml/parsing/ExternalSources.scala | 6 +++--- .../src/main/scala/scala/xml/parsing/FactoryAdapter.scala | 6 +++--- shared/src/main/scala/scala/xml/parsing/FatalError.scala | 6 +++--- shared/src/main/scala/scala/xml/parsing/MarkupHandler.scala | 6 +++--- shared/src/main/scala/scala/xml/parsing/MarkupParser.scala | 6 +++--- .../main/scala/scala/xml/parsing/MarkupParserCommon.scala | 6 +++--- .../scala/scala/xml/parsing/NoBindingFactoryAdapter.scala | 6 +++--- shared/src/main/scala/scala/xml/parsing/TokenTests.scala | 6 +++--- shared/src/main/scala/scala/xml/parsing/XhtmlEntities.scala | 6 +++--- shared/src/main/scala/scala/xml/parsing/XhtmlParser.scala | 6 +++--- .../main/scala/scala/xml/transform/BasicTransformer.scala | 6 +++--- shared/src/main/scala/scala/xml/transform/RewriteRule.scala | 6 +++--- .../main/scala/scala/xml/transform/RuleTransformer.scala | 6 +++--- 72 files changed, 216 insertions(+), 216 deletions(-) diff --git a/shared/src/main/scala/scala/xml/Atom.scala b/shared/src/main/scala/scala/xml/Atom.scala index bc82e5343..c6ae51eac 100644 --- a/shared/src/main/scala/scala/xml/Atom.scala +++ b/shared/src/main/scala/scala/xml/Atom.scala @@ -1,8 +1,8 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2019, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** -** /____/\___/_/ |_/____/_/ | | ** +** / __/ __// _ | / / / _ | (c) 2003-2020, LAMP/EPFL ** +** __\ \/ /__/ __ |/ /__/ __ | (c) 2011-2020, Lightbend, Inc. ** +** /____/\___/_/ |_/____/_/ | | http://scala-lang.org/ ** ** |/ ** \* */ diff --git a/shared/src/main/scala/scala/xml/Attribute.scala b/shared/src/main/scala/scala/xml/Attribute.scala index 968b2c5f9..5ee69b138 100644 --- a/shared/src/main/scala/scala/xml/Attribute.scala +++ b/shared/src/main/scala/scala/xml/Attribute.scala @@ -1,8 +1,8 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2019, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** -** /____/\___/_/ |_/____/_/ | | ** +** / __/ __// _ | / / / _ | (c) 2003-2020, LAMP/EPFL ** +** __\ \/ /__/ __ |/ /__/ __ | (c) 2011-2020, Lightbend, Inc. ** +** /____/\___/_/ |_/____/_/ | | http://scala-lang.org/ ** ** |/ ** \* */ diff --git a/shared/src/main/scala/scala/xml/Comment.scala b/shared/src/main/scala/scala/xml/Comment.scala index 9fbd5a679..011cd3565 100644 --- a/shared/src/main/scala/scala/xml/Comment.scala +++ b/shared/src/main/scala/scala/xml/Comment.scala @@ -1,8 +1,8 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2019, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** -** /____/\___/_/ |_/____/_/ | | ** +** / __/ __// _ | / / / _ | (c) 2003-2020, LAMP/EPFL ** +** __\ \/ /__/ __ |/ /__/ __ | (c) 2011-2020, Lightbend, Inc. ** +** /____/\___/_/ |_/____/_/ | | http://scala-lang.org/ ** ** |/ ** \* */ diff --git a/shared/src/main/scala/scala/xml/Document.scala b/shared/src/main/scala/scala/xml/Document.scala index ccce9519b..3c20db529 100644 --- a/shared/src/main/scala/scala/xml/Document.scala +++ b/shared/src/main/scala/scala/xml/Document.scala @@ -1,8 +1,8 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2019, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** -** /____/\___/_/ |_/____/_/ | | ** +** / __/ __// _ | / / / _ | (c) 2003-2020, LAMP/EPFL ** +** __\ \/ /__/ __ |/ /__/ __ | (c) 2011-2020, Lightbend, Inc. ** +** /____/\___/_/ |_/____/_/ | | http://scala-lang.org/ ** ** |/ ** \* */ diff --git a/shared/src/main/scala/scala/xml/Elem.scala b/shared/src/main/scala/scala/xml/Elem.scala index 2b1f895c2..ae1ee7bf0 100755 --- a/shared/src/main/scala/scala/xml/Elem.scala +++ b/shared/src/main/scala/scala/xml/Elem.scala @@ -1,8 +1,8 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2002-2019, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** -** /____/\___/_/ |_/____/_/ | | ** +** / __/ __// _ | / / / _ | (c) 2002-2020, LAMP/EPFL ** +** __\ \/ /__/ __ |/ /__/ __ | (c) 2011-2020, Lightbend, Inc. ** +** /____/\___/_/ |_/____/_/ | | http://scala-lang.org/ ** ** |/ ** ** Copyright 2008 Google Inc. ** ** All Rights Reserved. ** diff --git a/shared/src/main/scala/scala/xml/EntityRef.scala b/shared/src/main/scala/scala/xml/EntityRef.scala index a3208c320..8b5df563f 100644 --- a/shared/src/main/scala/scala/xml/EntityRef.scala +++ b/shared/src/main/scala/scala/xml/EntityRef.scala @@ -1,8 +1,8 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2019, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** -** /____/\___/_/ |_/____/_/ | | ** +** / __/ __// _ | / / / _ | (c) 2003-2020, LAMP/EPFL ** +** __\ \/ /__/ __ |/ /__/ __ | (c) 2011-2020, Lightbend, Inc. ** +** /____/\___/_/ |_/____/_/ | | http://scala-lang.org/ ** ** |/ ** \* */ diff --git a/shared/src/main/scala/scala/xml/Equality.scala b/shared/src/main/scala/scala/xml/Equality.scala index f148df2e9..fdfd2e9bf 100644 --- a/shared/src/main/scala/scala/xml/Equality.scala +++ b/shared/src/main/scala/scala/xml/Equality.scala @@ -1,8 +1,8 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2019, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** -** /____/\___/_/ |_/____/_/ | | ** +** / __/ __// _ | / / / _ | (c) 2003-2020, LAMP/EPFL ** +** __\ \/ /__/ __ |/ /__/ __ | (c) 2011-2020, Lightbend, Inc. ** +** /____/\___/_/ |_/____/_/ | | http://scala-lang.org/ ** ** |/ ** \* */ diff --git a/shared/src/main/scala/scala/xml/Group.scala b/shared/src/main/scala/scala/xml/Group.scala index 34921a3d4..d9fdf4427 100644 --- a/shared/src/main/scala/scala/xml/Group.scala +++ b/shared/src/main/scala/scala/xml/Group.scala @@ -1,8 +1,8 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2019, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** -** /____/\___/_/ |_/____/_/ | | ** +** / __/ __// _ | / / / _ | (c) 2003-2020, LAMP/EPFL ** +** __\ \/ /__/ __ |/ /__/ __ | (c) 2011-2020, Lightbend, Inc. ** +** /____/\___/_/ |_/____/_/ | | http://scala-lang.org/ ** ** |/ ** \* */ diff --git a/shared/src/main/scala/scala/xml/MalformedAttributeException.scala b/shared/src/main/scala/scala/xml/MalformedAttributeException.scala index d0332a3d9..9798b1151 100644 --- a/shared/src/main/scala/scala/xml/MalformedAttributeException.scala +++ b/shared/src/main/scala/scala/xml/MalformedAttributeException.scala @@ -1,8 +1,8 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2019, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** -** /____/\___/_/ |_/____/_/ | | ** +** / __/ __// _ | / / / _ | (c) 2003-2020, LAMP/EPFL ** +** __\ \/ /__/ __ |/ /__/ __ | (c) 2011-2020, Lightbend, Inc. ** +** /____/\___/_/ |_/____/_/ | | http://scala-lang.org/ ** ** |/ ** \* */ diff --git a/shared/src/main/scala/scala/xml/MetaData.scala b/shared/src/main/scala/scala/xml/MetaData.scala index a856c5c39..32ec2cdca 100644 --- a/shared/src/main/scala/scala/xml/MetaData.scala +++ b/shared/src/main/scala/scala/xml/MetaData.scala @@ -1,8 +1,8 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2019, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** -** /____/\___/_/ |_/____/_/ | | ** +** / __/ __// _ | / / / _ | (c) 2003-2020, LAMP/EPFL ** +** __\ \/ /__/ __ |/ /__/ __ | (c) 2011-2020, Lightbend, Inc. ** +** /____/\___/_/ |_/____/_/ | | http://scala-lang.org/ ** ** |/ ** ** Copyright 2008 Google Inc. ** ** All Rights Reserved. ** diff --git a/shared/src/main/scala/scala/xml/NamespaceBinding.scala b/shared/src/main/scala/scala/xml/NamespaceBinding.scala index c67c35bf9..9cdcd8dd6 100644 --- a/shared/src/main/scala/scala/xml/NamespaceBinding.scala +++ b/shared/src/main/scala/scala/xml/NamespaceBinding.scala @@ -1,8 +1,8 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2002-2019, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** -** /____/\___/_/ |_/____/_/ | | ** +** / __/ __// _ | / / / _ | (c) 2002-2020, LAMP/EPFL ** +** __\ \/ /__/ __ |/ /__/ __ | (c) 2011-2020, Lightbend, Inc. ** +** /____/\___/_/ |_/____/_/ | | http://scala-lang.org/ ** ** |/ ** \* */ diff --git a/shared/src/main/scala/scala/xml/Node.scala b/shared/src/main/scala/scala/xml/Node.scala index b4b038bac..34d7f2011 100755 --- a/shared/src/main/scala/scala/xml/Node.scala +++ b/shared/src/main/scala/scala/xml/Node.scala @@ -1,8 +1,8 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2019, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** -** /____/\___/_/ |_/____/_/ | | ** +** / __/ __// _ | / / / _ | (c) 2003-2020, LAMP/EPFL ** +** __\ \/ /__/ __ |/ /__/ __ | (c) 2011-2020, Lightbend, Inc. ** +** /____/\___/_/ |_/____/_/ | | http://scala-lang.org/ ** ** |/ ** \* */ diff --git a/shared/src/main/scala/scala/xml/NodeBuffer.scala b/shared/src/main/scala/scala/xml/NodeBuffer.scala index 7c82eef11..275211fda 100644 --- a/shared/src/main/scala/scala/xml/NodeBuffer.scala +++ b/shared/src/main/scala/scala/xml/NodeBuffer.scala @@ -1,8 +1,8 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2019, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** -** /____/\___/_/ |_/____/_/ | | ** +** / __/ __// _ | / / / _ | (c) 2003-2020, LAMP/EPFL ** +** __\ \/ /__/ __ |/ /__/ __ | (c) 2011-2020, Lightbend, Inc. ** +** /____/\___/_/ |_/____/_/ | | http://scala-lang.org/ ** ** |/ ** \* */ diff --git a/shared/src/main/scala/scala/xml/NodeSeq.scala b/shared/src/main/scala/scala/xml/NodeSeq.scala index 56f7507e5..5c77279b8 100644 --- a/shared/src/main/scala/scala/xml/NodeSeq.scala +++ b/shared/src/main/scala/scala/xml/NodeSeq.scala @@ -1,8 +1,8 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2019, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** -** /____/\___/_/ |_/____/_/ | | ** +** / __/ __// _ | / / / _ | (c) 2003-2020, LAMP/EPFL ** +** __\ \/ /__/ __ |/ /__/ __ | (c) 2011-2020, Lightbend, Inc. ** +** /____/\___/_/ |_/____/_/ | | http://scala-lang.org/ ** ** |/ ** \* */ diff --git a/shared/src/main/scala/scala/xml/Null.scala b/shared/src/main/scala/scala/xml/Null.scala index 4f06b1a4f..4ca30aba0 100644 --- a/shared/src/main/scala/scala/xml/Null.scala +++ b/shared/src/main/scala/scala/xml/Null.scala @@ -1,8 +1,8 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2019, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** -** /____/\___/_/ |_/____/_/ | | ** +** / __/ __// _ | / / / _ | (c) 2003-2020, LAMP/EPFL ** +** __\ \/ /__/ __ |/ /__/ __ | (c) 2011-2020, Lightbend, Inc. ** +** /____/\___/_/ |_/____/_/ | | http://scala-lang.org/ ** ** |/ ** \* */ diff --git a/shared/src/main/scala/scala/xml/PCData.scala b/shared/src/main/scala/scala/xml/PCData.scala index 0b1c985e7..eeaeff1eb 100644 --- a/shared/src/main/scala/scala/xml/PCData.scala +++ b/shared/src/main/scala/scala/xml/PCData.scala @@ -1,8 +1,8 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2019, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** -** /____/\___/_/ |_/____/_/ | | ** +** / __/ __// _ | / / / _ | (c) 2003-2020, LAMP/EPFL ** +** __\ \/ /__/ __ |/ /__/ __ | (c) 2011-2020, Lightbend, Inc. ** +** /____/\___/_/ |_/____/_/ | | http://scala-lang.org/ ** ** |/ ** \* */ diff --git a/shared/src/main/scala/scala/xml/PrefixedAttribute.scala b/shared/src/main/scala/scala/xml/PrefixedAttribute.scala index 0e7240c04..10c6ef608 100644 --- a/shared/src/main/scala/scala/xml/PrefixedAttribute.scala +++ b/shared/src/main/scala/scala/xml/PrefixedAttribute.scala @@ -1,8 +1,8 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2019, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** -** /____/\___/_/ |_/____/_/ | | ** +** / __/ __// _ | / / / _ | (c) 2003-2020, LAMP/EPFL ** +** __\ \/ /__/ __ |/ /__/ __ | (c) 2011-2020, Lightbend, Inc. ** +** /____/\___/_/ |_/____/_/ | | http://scala-lang.org/ ** ** |/ ** \* */ diff --git a/shared/src/main/scala/scala/xml/PrettyPrinter.scala b/shared/src/main/scala/scala/xml/PrettyPrinter.scala index 3831bd3bb..57c8c0b9a 100755 --- a/shared/src/main/scala/scala/xml/PrettyPrinter.scala +++ b/shared/src/main/scala/scala/xml/PrettyPrinter.scala @@ -1,8 +1,8 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2019, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** -** /____/\___/_/ |_/____/_/ | | ** +** / __/ __// _ | / / / _ | (c) 2003-2020, LAMP/EPFL ** +** __\ \/ /__/ __ |/ /__/ __ | (c) 2011-2020, Lightbend, Inc. ** +** /____/\___/_/ |_/____/_/ | | http://scala-lang.org/ ** ** |/ ** \* */ diff --git a/shared/src/main/scala/scala/xml/ProcInstr.scala b/shared/src/main/scala/scala/xml/ProcInstr.scala index 48f247120..39eb538ad 100644 --- a/shared/src/main/scala/scala/xml/ProcInstr.scala +++ b/shared/src/main/scala/scala/xml/ProcInstr.scala @@ -1,8 +1,8 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2019, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** -** /____/\___/_/ |_/____/_/ | | ** +** / __/ __// _ | / / / _ | (c) 2003-2020, LAMP/EPFL ** +** __\ \/ /__/ __ |/ /__/ __ | (c) 2011-2020, Lightbend, Inc. ** +** /____/\___/_/ |_/____/_/ | | http://scala-lang.org/ ** ** |/ ** \* */ diff --git a/shared/src/main/scala/scala/xml/QNode.scala b/shared/src/main/scala/scala/xml/QNode.scala index 24c093b2d..92ed109f9 100644 --- a/shared/src/main/scala/scala/xml/QNode.scala +++ b/shared/src/main/scala/scala/xml/QNode.scala @@ -1,8 +1,8 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2019, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** -** /____/\___/_/ |_/____/_/ | | ** +** / __/ __// _ | / / / _ | (c) 2003-2020, LAMP/EPFL ** +** __\ \/ /__/ __ |/ /__/ __ | (c) 2011-2020, Lightbend, Inc. ** +** /____/\___/_/ |_/____/_/ | | http://scala-lang.org/ ** ** |/ ** \* */ diff --git a/shared/src/main/scala/scala/xml/SpecialNode.scala b/shared/src/main/scala/scala/xml/SpecialNode.scala index 773aff9dc..99b1d6807 100644 --- a/shared/src/main/scala/scala/xml/SpecialNode.scala +++ b/shared/src/main/scala/scala/xml/SpecialNode.scala @@ -1,8 +1,8 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2019, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** -** /____/\___/_/ |_/____/_/ | | ** +** / __/ __// _ | / / / _ | (c) 2003-2020, LAMP/EPFL ** +** __\ \/ /__/ __ |/ /__/ __ | (c) 2011-2020, Lightbend, Inc. ** +** /____/\___/_/ |_/____/_/ | | http://scala-lang.org/ ** ** |/ ** \* */ diff --git a/shared/src/main/scala/scala/xml/Text.scala b/shared/src/main/scala/scala/xml/Text.scala index caa7fa294..b1b8ef2e4 100644 --- a/shared/src/main/scala/scala/xml/Text.scala +++ b/shared/src/main/scala/scala/xml/Text.scala @@ -1,8 +1,8 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2019, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** -** /____/\___/_/ |_/____/_/ | | ** +** / __/ __// _ | / / / _ | (c) 2003-2020, LAMP/EPFL ** +** __\ \/ /__/ __ |/ /__/ __ | (c) 2011-2020, Lightbend, Inc. ** +** /____/\___/_/ |_/____/_/ | | http://scala-lang.org/ ** ** |/ ** \* */ diff --git a/shared/src/main/scala/scala/xml/TextBuffer.scala b/shared/src/main/scala/scala/xml/TextBuffer.scala index 6f10b8c13..49835a0ad 100644 --- a/shared/src/main/scala/scala/xml/TextBuffer.scala +++ b/shared/src/main/scala/scala/xml/TextBuffer.scala @@ -1,8 +1,8 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2019, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** -** /____/\___/_/ |_/____/_/ | | ** +** / __/ __// _ | / / / _ | (c) 2003-2020, LAMP/EPFL ** +** __\ \/ /__/ __ |/ /__/ __ | (c) 2011-2020, Lightbend, Inc. ** +** /____/\___/_/ |_/____/_/ | | http://scala-lang.org/ ** ** |/ ** \* */ diff --git a/shared/src/main/scala/scala/xml/TopScope.scala b/shared/src/main/scala/scala/xml/TopScope.scala index 605ec87cd..dde97b423 100644 --- a/shared/src/main/scala/scala/xml/TopScope.scala +++ b/shared/src/main/scala/scala/xml/TopScope.scala @@ -1,8 +1,8 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2002-2019, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** -** /____/\___/_/ |_/____/_/ | | ** +** / __/ __// _ | / / / _ | (c) 2002-2020, LAMP/EPFL ** +** __\ \/ /__/ __ |/ /__/ __ | (c) 2011-2020, Lightbend, Inc. ** +** /____/\___/_/ |_/____/_/ | | http://scala-lang.org/ ** ** |/ ** \* */ diff --git a/shared/src/main/scala/scala/xml/TypeSymbol.scala b/shared/src/main/scala/scala/xml/TypeSymbol.scala index 8d6989716..17521ebd6 100644 --- a/shared/src/main/scala/scala/xml/TypeSymbol.scala +++ b/shared/src/main/scala/scala/xml/TypeSymbol.scala @@ -1,8 +1,8 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2002-2019, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** -** /____/\___/_/ |_/____/_/ | | ** +** / __/ __// _ | / / / _ | (c) 2002-2020, LAMP/EPFL ** +** __\ \/ /__/ __ |/ /__/ __ | (c) 2011-2020, Lightbend, Inc. ** +** /____/\___/_/ |_/____/_/ | | http://scala-lang.org/ ** ** |/ ** \* */ diff --git a/shared/src/main/scala/scala/xml/Unparsed.scala b/shared/src/main/scala/scala/xml/Unparsed.scala index da8e2dada..ee59e2635 100644 --- a/shared/src/main/scala/scala/xml/Unparsed.scala +++ b/shared/src/main/scala/scala/xml/Unparsed.scala @@ -1,8 +1,8 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2019, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** -** /____/\___/_/ |_/____/_/ | | ** +** / __/ __// _ | / / / _ | (c) 2003-2020, LAMP/EPFL ** +** __\ \/ /__/ __ |/ /__/ __ | (c) 2011-2020, Lightbend, Inc. ** +** /____/\___/_/ |_/____/_/ | | http://scala-lang.org/ ** ** |/ ** \* */ diff --git a/shared/src/main/scala/scala/xml/UnprefixedAttribute.scala b/shared/src/main/scala/scala/xml/UnprefixedAttribute.scala index dcdaf374e..9ff1b5a04 100644 --- a/shared/src/main/scala/scala/xml/UnprefixedAttribute.scala +++ b/shared/src/main/scala/scala/xml/UnprefixedAttribute.scala @@ -1,8 +1,8 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2002-2019, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** -** /____/\___/_/ |_/____/_/ | | ** +** / __/ __// _ | / / / _ | (c) 2002-2020, LAMP/EPFL ** +** __\ \/ /__/ __ |/ /__/ __ | (c) 2011-2020, Lightbend, Inc. ** +** /____/\___/_/ |_/____/_/ | | http://scala-lang.org/ ** ** |/ ** \* */ diff --git a/shared/src/main/scala/scala/xml/Utility.scala b/shared/src/main/scala/scala/xml/Utility.scala index 43776af94..d53dab8a8 100755 --- a/shared/src/main/scala/scala/xml/Utility.scala +++ b/shared/src/main/scala/scala/xml/Utility.scala @@ -1,8 +1,8 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2019, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** -** /____/\___/_/ |_/____/_/ | | ** +** / __/ __// _ | / / / _ | (c) 2003-2020, LAMP/EPFL ** +** __\ \/ /__/ __ |/ /__/ __ | (c) 2011-2020, Lightbend, Inc. ** +** /____/\___/_/ |_/____/_/ | | http://scala-lang.org/ ** ** |/ ** \* */ diff --git a/shared/src/main/scala/scala/xml/XML.scala b/shared/src/main/scala/scala/xml/XML.scala index 0e87530d9..587681700 100755 --- a/shared/src/main/scala/scala/xml/XML.scala +++ b/shared/src/main/scala/scala/xml/XML.scala @@ -1,8 +1,8 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2019, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** -** /____/\___/_/ |_/____/_/ | | ** +** / __/ __// _ | / / / _ | (c) 2003-2020, LAMP/EPFL ** +** __\ \/ /__/ __ |/ /__/ __ | (c) 2011-2020, Lightbend, Inc. ** +** /____/\___/_/ |_/____/_/ | | http://scala-lang.org/ ** ** |/ ** \* */ diff --git a/shared/src/main/scala/scala/xml/Xhtml.scala b/shared/src/main/scala/scala/xml/Xhtml.scala index 5828212df..ce7fab773 100644 --- a/shared/src/main/scala/scala/xml/Xhtml.scala +++ b/shared/src/main/scala/scala/xml/Xhtml.scala @@ -1,8 +1,8 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2019, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** -** /____/\___/_/ |_/____/_/ | | ** +** / __/ __// _ | / / / _ | (c) 2003-2020, LAMP/EPFL ** +** __\ \/ /__/ __ |/ /__/ __ | (c) 2011-2020, Lightbend, Inc. ** +** /____/\___/_/ |_/____/_/ | | http://scala-lang.org/ ** ** |/ ** \* */ diff --git a/shared/src/main/scala/scala/xml/dtd/ContentModel.scala b/shared/src/main/scala/scala/xml/dtd/ContentModel.scala index 444e93e8a..043e0bf41 100644 --- a/shared/src/main/scala/scala/xml/dtd/ContentModel.scala +++ b/shared/src/main/scala/scala/xml/dtd/ContentModel.scala @@ -1,8 +1,8 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2002-2019, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** -** /____/\___/_/ |_/____/_/ | | ** +** / __/ __// _ | / / / _ | (c) 2002-2020, LAMP/EPFL ** +** __\ \/ /__/ __ |/ /__/ __ | (c) 2011-2020, Lightbend, Inc. ** +** /____/\___/_/ |_/____/_/ | | http://scala-lang.org/ ** ** |/ ** \* */ diff --git a/shared/src/main/scala/scala/xml/dtd/DTD.scala b/shared/src/main/scala/scala/xml/dtd/DTD.scala index 94a772228..dd51edf0c 100644 --- a/shared/src/main/scala/scala/xml/dtd/DTD.scala +++ b/shared/src/main/scala/scala/xml/dtd/DTD.scala @@ -1,8 +1,8 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2002-2019, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** -** /____/\___/_/ |_/____/_/ | | ** +** / __/ __// _ | / / / _ | (c) 2002-2020, LAMP/EPFL ** +** __\ \/ /__/ __ |/ /__/ __ | (c) 2011-2020, Lightbend, Inc. ** +** /____/\___/_/ |_/____/_/ | | http://scala-lang.org/ ** ** |/ ** \* */ diff --git a/shared/src/main/scala/scala/xml/dtd/Decl.scala b/shared/src/main/scala/scala/xml/dtd/Decl.scala index 5bf37403a..7191e5289 100644 --- a/shared/src/main/scala/scala/xml/dtd/Decl.scala +++ b/shared/src/main/scala/scala/xml/dtd/Decl.scala @@ -1,8 +1,8 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2019, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | http://www.scala-lang.org/ ** -** /____/\___/_/ |_/____/_/ | | ** +** / __/ __// _ | / / / _ | (c) 2003-2020, LAMP/EPFL ** +** __\ \/ /__/ __ |/ /__/ __ | (c) 2011-2020, Lightbend, Inc. ** +** /____/\___/_/ |_/____/_/ | | http://www.scala-lang.org/ ** ** |/ ** \* */ diff --git a/shared/src/main/scala/scala/xml/dtd/DocType.scala b/shared/src/main/scala/scala/xml/dtd/DocType.scala index b22ef3258..deaf3ec56 100644 --- a/shared/src/main/scala/scala/xml/dtd/DocType.scala +++ b/shared/src/main/scala/scala/xml/dtd/DocType.scala @@ -1,8 +1,8 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2019, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** -** /____/\___/_/ |_/____/_/ | | ** +** / __/ __// _ | / / / _ | (c) 2003-2020, LAMP/EPFL ** +** __\ \/ /__/ __ |/ /__/ __ | (c) 2011-2020, Lightbend, Inc. ** +** /____/\___/_/ |_/____/_/ | | http://scala-lang.org/ ** ** |/ ** \* */ diff --git a/shared/src/main/scala/scala/xml/dtd/ExternalID.scala b/shared/src/main/scala/scala/xml/dtd/ExternalID.scala index 87356a1b1..dd7c18be5 100644 --- a/shared/src/main/scala/scala/xml/dtd/ExternalID.scala +++ b/shared/src/main/scala/scala/xml/dtd/ExternalID.scala @@ -1,8 +1,8 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2019, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | http://www.scala-lang.org/ ** -** /____/\___/_/ |_/____/_/ | | ** +** / __/ __// _ | / / / _ | (c) 2003-2020, LAMP/EPFL ** +** __\ \/ /__/ __ |/ /__/ __ | (c) 2011-2020, Lightbend, Inc. ** +** /____/\___/_/ |_/____/_/ | | http://www.scala-lang.org/ ** ** |/ ** \* */ diff --git a/shared/src/main/scala/scala/xml/dtd/Tokens.scala b/shared/src/main/scala/scala/xml/dtd/Tokens.scala index c5f112dd6..0a93b4a83 100644 --- a/shared/src/main/scala/scala/xml/dtd/Tokens.scala +++ b/shared/src/main/scala/scala/xml/dtd/Tokens.scala @@ -1,8 +1,8 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2002-2019, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | http://www.scala-lang.org/ ** -** /____/\___/_/ |_/____/_/ | | ** +** / __/ __// _ | / / / _ | (c) 2002-2020, LAMP/EPFL ** +** __\ \/ /__/ __ |/ /__/ __ | (c) 2011-2020, Lightbend, Inc. ** +** /____/\___/_/ |_/____/_/ | | http://www.scala-lang.org/ ** ** |/ ** \* */ diff --git a/shared/src/main/scala/scala/xml/dtd/ValidationException.scala b/shared/src/main/scala/scala/xml/dtd/ValidationException.scala index 9731099d0..f135f2aea 100644 --- a/shared/src/main/scala/scala/xml/dtd/ValidationException.scala +++ b/shared/src/main/scala/scala/xml/dtd/ValidationException.scala @@ -1,8 +1,8 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2002-2019, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | http://www.scala-lang.org/ ** -** /____/\___/_/ |_/____/_/ | | ** +** / __/ __// _ | / / / _ | (c) 2002-2020, LAMP/EPFL ** +** __\ \/ /__/ __ |/ /__/ __ | (c) 2011-2020, Lightbend, Inc. ** +** /____/\___/_/ |_/____/_/ | | http://www.scala-lang.org/ ** ** |/ ** \* */ diff --git a/shared/src/main/scala/scala/xml/dtd/impl/Base.scala b/shared/src/main/scala/scala/xml/dtd/impl/Base.scala index 7bfb995d6..7b567aecf 100644 --- a/shared/src/main/scala/scala/xml/dtd/impl/Base.scala +++ b/shared/src/main/scala/scala/xml/dtd/impl/Base.scala @@ -1,8 +1,8 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2019, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** -** /____/\___/_/ |_/____/_/ | | ** +** / __/ __// _ | / / / _ | (c) 2003-2020, LAMP/EPFL ** +** __\ \/ /__/ __ |/ /__/ __ | (c) 2011-2020, Lightbend, Inc. ** +** /____/\___/_/ |_/____/_/ | | http://scala-lang.org/ ** ** |/ ** \* */ diff --git a/shared/src/main/scala/scala/xml/dtd/impl/BaseBerrySethi.scala b/shared/src/main/scala/scala/xml/dtd/impl/BaseBerrySethi.scala index 3f04e6d1e..d02490240 100644 --- a/shared/src/main/scala/scala/xml/dtd/impl/BaseBerrySethi.scala +++ b/shared/src/main/scala/scala/xml/dtd/impl/BaseBerrySethi.scala @@ -1,8 +1,8 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2019, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** -** /____/\___/_/ |_/____/_/ | | ** +** / __/ __// _ | / / / _ | (c) 2003-2020, LAMP/EPFL ** +** __\ \/ /__/ __ |/ /__/ __ | (c) 2011-2020, Lightbend, Inc. ** +** /____/\___/_/ |_/____/_/ | | http://scala-lang.org/ ** ** |/ ** \* */ diff --git a/shared/src/main/scala/scala/xml/dtd/impl/DetWordAutom.scala b/shared/src/main/scala/scala/xml/dtd/impl/DetWordAutom.scala index fe0b66c0e..a336fb02e 100644 --- a/shared/src/main/scala/scala/xml/dtd/impl/DetWordAutom.scala +++ b/shared/src/main/scala/scala/xml/dtd/impl/DetWordAutom.scala @@ -1,8 +1,8 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2019, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** -** /____/\___/_/ |_/____/_/ | | ** +** / __/ __// _ | / / / _ | (c) 2003-2020, LAMP/EPFL ** +** __\ \/ /__/ __ |/ /__/ __ | (c) 2011-2020, Lightbend, Inc. ** +** /____/\___/_/ |_/____/_/ | | http://scala-lang.org/ ** ** |/ ** \* */ diff --git a/shared/src/main/scala/scala/xml/dtd/impl/Inclusion.scala b/shared/src/main/scala/scala/xml/dtd/impl/Inclusion.scala index 278d966e4..1b1d7c09d 100644 --- a/shared/src/main/scala/scala/xml/dtd/impl/Inclusion.scala +++ b/shared/src/main/scala/scala/xml/dtd/impl/Inclusion.scala @@ -1,8 +1,8 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2019, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** -** /____/\___/_/ |_/____/_/ | | ** +** / __/ __// _ | / / / _ | (c) 2003-2020, LAMP/EPFL ** +** __\ \/ /__/ __ |/ /__/ __ | (c) 2011-2020, Lightbend, Inc. ** +** /____/\___/_/ |_/____/_/ | | http://scala-lang.org/ ** ** |/ ** \* */ diff --git a/shared/src/main/scala/scala/xml/dtd/impl/NondetWordAutom.scala b/shared/src/main/scala/scala/xml/dtd/impl/NondetWordAutom.scala index 5519fd7ef..5f6f2d156 100644 --- a/shared/src/main/scala/scala/xml/dtd/impl/NondetWordAutom.scala +++ b/shared/src/main/scala/scala/xml/dtd/impl/NondetWordAutom.scala @@ -1,8 +1,8 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2019, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** -** /____/\___/_/ |_/____/_/ | | ** +** / __/ __// _ | / / / _ | (c) 2003-2020, LAMP/EPFL ** +** __\ \/ /__/ __ |/ /__/ __ | (c) 2011-2020, Lightbend, Inc. ** +** /____/\___/_/ |_/____/_/ | | http://scala-lang.org/ ** ** |/ ** \* */ diff --git a/shared/src/main/scala/scala/xml/dtd/impl/SubsetConstruction.scala b/shared/src/main/scala/scala/xml/dtd/impl/SubsetConstruction.scala index e3d2ba194..d793d4b08 100644 --- a/shared/src/main/scala/scala/xml/dtd/impl/SubsetConstruction.scala +++ b/shared/src/main/scala/scala/xml/dtd/impl/SubsetConstruction.scala @@ -1,8 +1,8 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2019, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** -** /____/\___/_/ |_/____/_/ | | ** +** / __/ __// _ | / / / _ | (c) 2003-2020, LAMP/EPFL ** +** __\ \/ /__/ __ |/ /__/ __ | (c) 2011-2020, Lightbend, Inc. ** +** /____/\___/_/ |_/____/_/ | | http://scala-lang.org/ ** ** |/ ** \* */ diff --git a/shared/src/main/scala/scala/xml/dtd/impl/SyntaxError.scala b/shared/src/main/scala/scala/xml/dtd/impl/SyntaxError.scala index f0c992854..20b396b64 100644 --- a/shared/src/main/scala/scala/xml/dtd/impl/SyntaxError.scala +++ b/shared/src/main/scala/scala/xml/dtd/impl/SyntaxError.scala @@ -1,8 +1,8 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2019, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** -** /____/\___/_/ |_/____/_/ | | ** +** / __/ __// _ | / / / _ | (c) 2003-2020, LAMP/EPFL ** +** __\ \/ /__/ __ |/ /__/ __ | (c) 2011-2020, Lightbend, Inc. ** +** /____/\___/_/ |_/____/_/ | | http://scala-lang.org/ ** ** |/ ** \* */ diff --git a/shared/src/main/scala/scala/xml/dtd/impl/WordBerrySethi.scala b/shared/src/main/scala/scala/xml/dtd/impl/WordBerrySethi.scala index 7ec77ad56..ee2ee2be0 100644 --- a/shared/src/main/scala/scala/xml/dtd/impl/WordBerrySethi.scala +++ b/shared/src/main/scala/scala/xml/dtd/impl/WordBerrySethi.scala @@ -1,8 +1,8 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2019, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** -** /____/\___/_/ |_/____/_/ | | ** +** / __/ __// _ | / / / _ | (c) 2003-2020, LAMP/EPFL ** +** __\ \/ /__/ __ |/ /__/ __ | (c) 2011-2020, Lightbend, Inc. ** +** /____/\___/_/ |_/____/_/ | | http://scala-lang.org/ ** ** |/ ** \* */ diff --git a/shared/src/main/scala/scala/xml/dtd/impl/WordExp.scala b/shared/src/main/scala/scala/xml/dtd/impl/WordExp.scala index 6d132a04a..709dc6fa2 100644 --- a/shared/src/main/scala/scala/xml/dtd/impl/WordExp.scala +++ b/shared/src/main/scala/scala/xml/dtd/impl/WordExp.scala @@ -1,8 +1,8 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2019, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** -** /____/\___/_/ |_/____/_/ | | ** +** / __/ __// _ | / / / _ | (c) 2003-2020, LAMP/EPFL ** +** __\ \/ /__/ __ |/ /__/ __ | (c) 2011-2020, Lightbend, Inc. ** +** /____/\___/_/ |_/____/_/ | | http://scala-lang.org/ ** ** |/ ** \* */ diff --git a/shared/src/main/scala/scala/xml/factory/LoggedNodeFactory.scala b/shared/src/main/scala/scala/xml/factory/LoggedNodeFactory.scala index 5b18dda50..4acbe86dc 100644 --- a/shared/src/main/scala/scala/xml/factory/LoggedNodeFactory.scala +++ b/shared/src/main/scala/scala/xml/factory/LoggedNodeFactory.scala @@ -1,8 +1,8 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2002-2019, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** -** /____/\___/_/ |_/____/_/ | | ** +** / __/ __// _ | / / / _ | (c) 2002-2020, LAMP/EPFL ** +** __\ \/ /__/ __ |/ /__/ __ | (c) 2011-2020, Lightbend, Inc. ** +** /____/\___/_/ |_/____/_/ | | http://scala-lang.org/ ** ** |/ ** \* */ diff --git a/shared/src/main/scala/scala/xml/factory/NodeFactory.scala b/shared/src/main/scala/scala/xml/factory/NodeFactory.scala index 9dc78af5c..15a63b396 100644 --- a/shared/src/main/scala/scala/xml/factory/NodeFactory.scala +++ b/shared/src/main/scala/scala/xml/factory/NodeFactory.scala @@ -1,8 +1,8 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2019, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** -** /____/\___/_/ |_/____/_/ | | ** +** / __/ __// _ | / / / _ | (c) 2003-2020, LAMP/EPFL ** +** __\ \/ /__/ __ |/ /__/ __ | (c) 2011-2020, Lightbend, Inc. ** +** /____/\___/_/ |_/____/_/ | | http://scala-lang.org/ ** ** |/ ** \* */ diff --git a/shared/src/main/scala/scala/xml/factory/XMLLoader.scala b/shared/src/main/scala/scala/xml/factory/XMLLoader.scala index e9a534fbd..dd4b6339c 100644 --- a/shared/src/main/scala/scala/xml/factory/XMLLoader.scala +++ b/shared/src/main/scala/scala/xml/factory/XMLLoader.scala @@ -1,8 +1,8 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2019, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** -** /____/\___/_/ |_/____/_/ | | ** +** / __/ __// _ | / / / _ | (c) 2003-2020, LAMP/EPFL ** +** __\ \/ /__/ __ |/ /__/ __ | (c) 2011-2020, Lightbend, Inc. ** +** /____/\___/_/ |_/____/_/ | | http://scala-lang.org/ ** ** |/ ** \* */ diff --git a/shared/src/main/scala/scala/xml/include/CircularIncludeException.scala b/shared/src/main/scala/scala/xml/include/CircularIncludeException.scala index 15688658e..3977bebae 100644 --- a/shared/src/main/scala/scala/xml/include/CircularIncludeException.scala +++ b/shared/src/main/scala/scala/xml/include/CircularIncludeException.scala @@ -1,8 +1,8 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2002-2019, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** -** /____/\___/_/ |_/____/_/ | | ** +** / __/ __// _ | / / / _ | (c) 2002-2020, LAMP/EPFL ** +** __\ \/ /__/ __ |/ /__/ __ | (c) 2011-2020, Lightbend, Inc. ** +** /____/\___/_/ |_/____/_/ | | http://scala-lang.org/ ** ** |/ ** \* */ diff --git a/shared/src/main/scala/scala/xml/include/UnavailableResourceException.scala b/shared/src/main/scala/scala/xml/include/UnavailableResourceException.scala index 5dcf68191..3f07eccea 100644 --- a/shared/src/main/scala/scala/xml/include/UnavailableResourceException.scala +++ b/shared/src/main/scala/scala/xml/include/UnavailableResourceException.scala @@ -1,8 +1,8 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2002-2019, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** -** /____/\___/_/ |_/____/_/ | | ** +** / __/ __// _ | / / / _ | (c) 2002-2020, LAMP/EPFL ** +** __\ \/ /__/ __ |/ /__/ __ | (c) 2011-2020, Lightbend, Inc. ** +** /____/\___/_/ |_/____/_/ | | http://scala-lang.org/ ** ** |/ ** \* */ diff --git a/shared/src/main/scala/scala/xml/include/XIncludeException.scala b/shared/src/main/scala/scala/xml/include/XIncludeException.scala index f3bc67794..07d20fe16 100644 --- a/shared/src/main/scala/scala/xml/include/XIncludeException.scala +++ b/shared/src/main/scala/scala/xml/include/XIncludeException.scala @@ -1,8 +1,8 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2002-2019, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** -** /____/\___/_/ |_/____/_/ | | ** +** / __/ __// _ | / / / _ | (c) 2002-2020, LAMP/EPFL ** +** __\ \/ /__/ __ |/ /__/ __ | (c) 2011-2020, Lightbend, Inc. ** +** /____/\___/_/ |_/____/_/ | | http://scala-lang.org/ ** ** |/ ** \* */ diff --git a/shared/src/main/scala/scala/xml/include/sax/EncodingHeuristics.scala b/shared/src/main/scala/scala/xml/include/sax/EncodingHeuristics.scala index 3246ff52b..b9937649e 100644 --- a/shared/src/main/scala/scala/xml/include/sax/EncodingHeuristics.scala +++ b/shared/src/main/scala/scala/xml/include/sax/EncodingHeuristics.scala @@ -1,8 +1,8 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2002-2019, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** -** /____/\___/_/ |_/____/_/ | | ** +** / __/ __// _ | / / / _ | (c) 2002-2020, LAMP/EPFL ** +** __\ \/ /__/ __ |/ /__/ __ | (c) 2011-2020, Lightbend, Inc. ** +** /____/\___/_/ |_/____/_/ | | http://scala-lang.org/ ** ** |/ ** \* */ diff --git a/shared/src/main/scala/scala/xml/include/sax/XIncludeFilter.scala b/shared/src/main/scala/scala/xml/include/sax/XIncludeFilter.scala index 2470d5f64..4af846259 100644 --- a/shared/src/main/scala/scala/xml/include/sax/XIncludeFilter.scala +++ b/shared/src/main/scala/scala/xml/include/sax/XIncludeFilter.scala @@ -1,8 +1,8 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2002-2019, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** -** /____/\___/_/ |_/____/_/ | | ** +** / __/ __// _ | / / / _ | (c) 2002-2020, LAMP/EPFL ** +** __\ \/ /__/ __ |/ /__/ __ | (c) 2011-2020, Lightbend, Inc. ** +** /____/\___/_/ |_/____/_/ | | http://scala-lang.org/ ** ** |/ ** \* */ diff --git a/shared/src/main/scala/scala/xml/include/sax/XIncluder.scala b/shared/src/main/scala/scala/xml/include/sax/XIncluder.scala index bf65cfafc..473df23b9 100644 --- a/shared/src/main/scala/scala/xml/include/sax/XIncluder.scala +++ b/shared/src/main/scala/scala/xml/include/sax/XIncluder.scala @@ -1,8 +1,8 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2002-2019, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** -** /____/\___/_/ |_/____/_/ | | ** +** / __/ __// _ | / / / _ | (c) 2002-2020, LAMP/EPFL ** +** __\ \/ /__/ __ |/ /__/ __ | (c) 2011-2020, Lightbend, Inc. ** +** /____/\___/_/ |_/____/_/ | | http://scala-lang.org/ ** ** |/ ** \* */ diff --git a/shared/src/main/scala/scala/xml/package.scala b/shared/src/main/scala/scala/xml/package.scala index 4bd95cfef..66e2577c9 100644 --- a/shared/src/main/scala/scala/xml/package.scala +++ b/shared/src/main/scala/scala/xml/package.scala @@ -1,8 +1,8 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2019, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** -** /____/\___/_/ |_/____/_/ | | ** +** / __/ __// _ | / / / _ | (c) 2003-2020, LAMP/EPFL ** +** __\ \/ /__/ __ |/ /__/ __ | (c) 2011-2020, Lightbend, Inc. ** +** /____/\___/_/ |_/____/_/ | | http://scala-lang.org/ ** ** |/ ** \* */ diff --git a/shared/src/main/scala/scala/xml/parsing/ConstructingHandler.scala b/shared/src/main/scala/scala/xml/parsing/ConstructingHandler.scala index e1d858f46..05cda5658 100755 --- a/shared/src/main/scala/scala/xml/parsing/ConstructingHandler.scala +++ b/shared/src/main/scala/scala/xml/parsing/ConstructingHandler.scala @@ -1,8 +1,8 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2002-2019, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** -** /____/\___/_/ |_/____/_/ | | ** +** / __/ __// _ | / / / _ | (c) 2002-2020, LAMP/EPFL ** +** __\ \/ /__/ __ |/ /__/ __ | (c) 2011-2020, Lightbend, Inc. ** +** /____/\___/_/ |_/____/_/ | | http://scala-lang.org/ ** ** |/ ** \* */ diff --git a/shared/src/main/scala/scala/xml/parsing/ConstructingParser.scala b/shared/src/main/scala/scala/xml/parsing/ConstructingParser.scala index b6c4aa258..cacd7802f 100644 --- a/shared/src/main/scala/scala/xml/parsing/ConstructingParser.scala +++ b/shared/src/main/scala/scala/xml/parsing/ConstructingParser.scala @@ -1,8 +1,8 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2019, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** -** /____/\___/_/ |_/____/_/ | | ** +** / __/ __// _ | / / / _ | (c) 2003-2020, LAMP/EPFL ** +** __\ \/ /__/ __ |/ /__/ __ | (c) 2011-2020, Lightbend, Inc. ** +** /____/\___/_/ |_/____/_/ | | http://scala-lang.org/ ** ** |/ ** \* */ diff --git a/shared/src/main/scala/scala/xml/parsing/DefaultMarkupHandler.scala b/shared/src/main/scala/scala/xml/parsing/DefaultMarkupHandler.scala index b8deb75ab..46b9e612b 100755 --- a/shared/src/main/scala/scala/xml/parsing/DefaultMarkupHandler.scala +++ b/shared/src/main/scala/scala/xml/parsing/DefaultMarkupHandler.scala @@ -1,8 +1,8 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2002-2019, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** -** /____/\___/_/ |_/____/_/ | | ** +** / __/ __// _ | / / / _ | (c) 2002-2020, LAMP/EPFL ** +** __\ \/ /__/ __ |/ /__/ __ | (c) 2011-2020, Lightbend, Inc. ** +** /____/\___/_/ |_/____/_/ | | http://scala-lang.org/ ** ** |/ ** \* */ diff --git a/shared/src/main/scala/scala/xml/parsing/ExternalSources.scala b/shared/src/main/scala/scala/xml/parsing/ExternalSources.scala index da6e9f1d0..731a7b19a 100644 --- a/shared/src/main/scala/scala/xml/parsing/ExternalSources.scala +++ b/shared/src/main/scala/scala/xml/parsing/ExternalSources.scala @@ -1,8 +1,8 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2019, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** -** /____/\___/_/ |_/____/_/ | | ** +** / __/ __// _ | / / / _ | (c) 2003-2020, LAMP/EPFL ** +** __\ \/ /__/ __ |/ /__/ __ | (c) 2011-2020, Lightbend, Inc. ** +** /____/\___/_/ |_/____/_/ | | http://scala-lang.org/ ** ** |/ ** \* */ diff --git a/shared/src/main/scala/scala/xml/parsing/FactoryAdapter.scala b/shared/src/main/scala/scala/xml/parsing/FactoryAdapter.scala index 1c46d7283..aa05fe564 100644 --- a/shared/src/main/scala/scala/xml/parsing/FactoryAdapter.scala +++ b/shared/src/main/scala/scala/xml/parsing/FactoryAdapter.scala @@ -1,8 +1,8 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2019, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** -** /____/\___/_/ |_/____/_/ | | ** +** / __/ __// _ | / / / _ | (c) 2003-2020, LAMP/EPFL ** +** __\ \/ /__/ __ |/ /__/ __ | (c) 2011-2020, Lightbend, Inc. ** +** /____/\___/_/ |_/____/_/ | | http://scala-lang.org/ ** ** |/ ** \* */ diff --git a/shared/src/main/scala/scala/xml/parsing/FatalError.scala b/shared/src/main/scala/scala/xml/parsing/FatalError.scala index dbce6f686..88f17ff4c 100644 --- a/shared/src/main/scala/scala/xml/parsing/FatalError.scala +++ b/shared/src/main/scala/scala/xml/parsing/FatalError.scala @@ -1,8 +1,8 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2002-2019, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** -** /____/\___/_/ |_/____/_/ | | ** +** / __/ __// _ | / / / _ | (c) 2002-2020, LAMP/EPFL ** +** __\ \/ /__/ __ |/ /__/ __ | (c) 2011-2020, Lightbend, Inc. ** +** /____/\___/_/ |_/____/_/ | | http://scala-lang.org/ ** ** |/ ** \* */ diff --git a/shared/src/main/scala/scala/xml/parsing/MarkupHandler.scala b/shared/src/main/scala/scala/xml/parsing/MarkupHandler.scala index 685e36451..a411515c8 100755 --- a/shared/src/main/scala/scala/xml/parsing/MarkupHandler.scala +++ b/shared/src/main/scala/scala/xml/parsing/MarkupHandler.scala @@ -1,8 +1,8 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2019, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** -** /____/\___/_/ |_/____/_/ | | ** +** / __/ __// _ | / / / _ | (c) 2003-2020, LAMP/EPFL ** +** __\ \/ /__/ __ |/ /__/ __ | (c) 2011-2020, Lightbend, Inc. ** +** /____/\___/_/ |_/____/_/ | | http://scala-lang.org/ ** ** |/ ** \* */ diff --git a/shared/src/main/scala/scala/xml/parsing/MarkupParser.scala b/shared/src/main/scala/scala/xml/parsing/MarkupParser.scala index 33717ce71..66ceb4c78 100755 --- a/shared/src/main/scala/scala/xml/parsing/MarkupParser.scala +++ b/shared/src/main/scala/scala/xml/parsing/MarkupParser.scala @@ -1,8 +1,8 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2019, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** -** /____/\___/_/ |_/____/_/ | | ** +** / __/ __// _ | / / / _ | (c) 2003-2020, LAMP/EPFL ** +** __\ \/ /__/ __ |/ /__/ __ | (c) 2011-2020, Lightbend, Inc. ** +** /____/\___/_/ |_/____/_/ | | http://scala-lang.org/ ** ** |/ ** \* */ diff --git a/shared/src/main/scala/scala/xml/parsing/MarkupParserCommon.scala b/shared/src/main/scala/scala/xml/parsing/MarkupParserCommon.scala index 804891442..8b4692836 100644 --- a/shared/src/main/scala/scala/xml/parsing/MarkupParserCommon.scala +++ b/shared/src/main/scala/scala/xml/parsing/MarkupParserCommon.scala @@ -1,8 +1,8 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2019, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** -** /____/\___/_/ |_/____/_/ | | ** +** / __/ __// _ | / / / _ | (c) 2003-2020, LAMP/EPFL ** +** __\ \/ /__/ __ |/ /__/ __ | (c) 2011-2020, Lightbend, Inc. ** +** /____/\___/_/ |_/____/_/ | | http://scala-lang.org/ ** ** |/ ** \* */ diff --git a/shared/src/main/scala/scala/xml/parsing/NoBindingFactoryAdapter.scala b/shared/src/main/scala/scala/xml/parsing/NoBindingFactoryAdapter.scala index a0ac87fda..f0b74fa30 100644 --- a/shared/src/main/scala/scala/xml/parsing/NoBindingFactoryAdapter.scala +++ b/shared/src/main/scala/scala/xml/parsing/NoBindingFactoryAdapter.scala @@ -1,8 +1,8 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2019, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** -** /____/\___/_/ |_/____/_/ | | ** +** / __/ __// _ | / / / _ | (c) 2003-2020, LAMP/EPFL ** +** __\ \/ /__/ __ |/ /__/ __ | (c) 2011-2020, Lightbend, Inc. ** +** /____/\___/_/ |_/____/_/ | | http://scala-lang.org/ ** ** |/ ** \* */ diff --git a/shared/src/main/scala/scala/xml/parsing/TokenTests.scala b/shared/src/main/scala/scala/xml/parsing/TokenTests.scala index e842cf48f..6e9fdc31d 100644 --- a/shared/src/main/scala/scala/xml/parsing/TokenTests.scala +++ b/shared/src/main/scala/scala/xml/parsing/TokenTests.scala @@ -1,8 +1,8 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2019, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** -** /____/\___/_/ |_/____/_/ | | ** +** / __/ __// _ | / / / _ | (c) 2003-2020, LAMP/EPFL ** +** __\ \/ /__/ __ |/ /__/ __ | (c) 2011-2020, Lightbend, Inc. ** +** /____/\___/_/ |_/____/_/ | | http://scala-lang.org/ ** ** |/ ** \* */ diff --git a/shared/src/main/scala/scala/xml/parsing/XhtmlEntities.scala b/shared/src/main/scala/scala/xml/parsing/XhtmlEntities.scala index e5e381afe..b43c62cd2 100644 --- a/shared/src/main/scala/scala/xml/parsing/XhtmlEntities.scala +++ b/shared/src/main/scala/scala/xml/parsing/XhtmlEntities.scala @@ -1,8 +1,8 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2019, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** -** /____/\___/_/ |_/____/_/ | | ** +** / __/ __// _ | / / / _ | (c) 2003-2020, LAMP/EPFL ** +** __\ \/ /__/ __ |/ /__/ __ | (c) 2011-2020, Lightbend, Inc. ** +** /____/\___/_/ |_/____/_/ | | http://scala-lang.org/ ** ** |/ ** \* */ diff --git a/shared/src/main/scala/scala/xml/parsing/XhtmlParser.scala b/shared/src/main/scala/scala/xml/parsing/XhtmlParser.scala index 4bd44b9c8..3aabc71cc 100644 --- a/shared/src/main/scala/scala/xml/parsing/XhtmlParser.scala +++ b/shared/src/main/scala/scala/xml/parsing/XhtmlParser.scala @@ -1,8 +1,8 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2019, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** -** /____/\___/_/ |_/____/_/ | | ** +** / __/ __// _ | / / / _ | (c) 2003-2020, LAMP/EPFL ** +** __\ \/ /__/ __ |/ /__/ __ | (c) 2011-2020, Lightbend, Inc. ** +** /____/\___/_/ |_/____/_/ | | http://scala-lang.org/ ** ** |/ ** \* */ diff --git a/shared/src/main/scala/scala/xml/transform/BasicTransformer.scala b/shared/src/main/scala/scala/xml/transform/BasicTransformer.scala index 707468ab9..c74a9e37a 100644 --- a/shared/src/main/scala/scala/xml/transform/BasicTransformer.scala +++ b/shared/src/main/scala/scala/xml/transform/BasicTransformer.scala @@ -1,8 +1,8 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2002-2019, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** -** /____/\___/_/ |_/____/_/ | | ** +** / __/ __// _ | / / / _ | (c) 2002-2020, LAMP/EPFL ** +** __\ \/ /__/ __ |/ /__/ __ | (c) 2011-2020, Lightbend, Inc. ** +** /____/\___/_/ |_/____/_/ | | http://scala-lang.org/ ** ** |/ ** \* */ diff --git a/shared/src/main/scala/scala/xml/transform/RewriteRule.scala b/shared/src/main/scala/scala/xml/transform/RewriteRule.scala index 315be859d..0a9d01aa6 100644 --- a/shared/src/main/scala/scala/xml/transform/RewriteRule.scala +++ b/shared/src/main/scala/scala/xml/transform/RewriteRule.scala @@ -1,8 +1,8 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2002-2019, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** -** /____/\___/_/ |_/____/_/ | | ** +** / __/ __// _ | / / / _ | (c) 2002-2020, LAMP/EPFL ** +** __\ \/ /__/ __ |/ /__/ __ | (c) 2011-2020, Lightbend, Inc. ** +** /____/\___/_/ |_/____/_/ | | http://scala-lang.org/ ** ** |/ ** \* */ diff --git a/shared/src/main/scala/scala/xml/transform/RuleTransformer.scala b/shared/src/main/scala/scala/xml/transform/RuleTransformer.scala index fa8a1a08e..d8c1a56d0 100644 --- a/shared/src/main/scala/scala/xml/transform/RuleTransformer.scala +++ b/shared/src/main/scala/scala/xml/transform/RuleTransformer.scala @@ -1,8 +1,8 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2002-2019, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** -** /____/\___/_/ |_/____/_/ | | ** +** / __/ __// _ | / / / _ | (c) 2002-2020, LAMP/EPFL ** +** __\ \/ /__/ __ |/ /__/ __ | (c) 2011-2020, Lightbend, Inc. ** +** /____/\___/_/ |_/____/_/ | | http://scala-lang.org/ ** ** |/ ** \* */ From f53b0343221b13f361fd2732d93aeb617b789429 Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Tue, 21 Jan 2020 23:08:49 -0500 Subject: [PATCH 412/789] Fix 2.13 collections methods for NodeSeq --- .../scala/xml/ScalaVersionSpecific.scala | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/shared/src/main/scala-2.13+/scala/xml/ScalaVersionSpecific.scala b/shared/src/main/scala-2.13+/scala/xml/ScalaVersionSpecific.scala index bd2eb820d..4258c100f 100644 --- a/shared/src/main/scala-2.13+/scala/xml/ScalaVersionSpecific.scala +++ b/shared/src/main/scala-2.13+/scala/xml/ScalaVersionSpecific.scala @@ -1,7 +1,7 @@ package scala.xml import scala.collection.immutable.StrictOptimizedSeqOps -import scala.collection.{SeqOps, IterableOnce, immutable, mutable} +import scala.collection.{View, SeqOps, IterableOnce, immutable, mutable} import scala.collection.BuildFrom import scala.collection.mutable.Builder @@ -20,6 +20,21 @@ private[xml] trait ScalaVersionSpecificNodeSeq override def fromSpecific(coll: IterableOnce[Node]): NodeSeq = (NodeSeq.newBuilder ++= coll).result() override def newSpecificBuilder: mutable.Builder[Node, NodeSeq] = NodeSeq.newBuilder override def empty: NodeSeq = NodeSeq.Empty + def concat(suffix: IterableOnce[Node]): NodeSeq = + fromSpecific(iterator ++ suffix.iterator) + @inline final def ++ (suffix: Seq[Node]): NodeSeq = concat(suffix) + def appended(base: Node): NodeSeq = + fromSpecific(new View.Appended(this, base)) + def appendedAll(suffix: IterableOnce[Node]): NodeSeq = + concat(suffix) + def prepended(base: Node): NodeSeq = + fromSpecific(new View.Prepended(base, this)) + def prependedAll(prefix: IterableOnce[Node]): NodeSeq = + fromSpecific(prefix.iterator ++ iterator) + def map(f: Node => Node): NodeSeq = + fromSpecific(new View.Map(this, f)) + def flatMap(f: Node => IterableOnce[Node]): NodeSeq = + fromSpecific(new View.FlatMap(this, f)) } private[xml] trait ScalaVersionSpecificNodeBuffer { self: NodeBuffer => From ef25dc3850b2526f132fea178ad803b374dd1a02 Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Tue, 21 Jan 2020 23:31:43 -0500 Subject: [PATCH 413/789] Add test of issue 392 --- .../test/scala/scala/xml/NodeSeqTest.scala | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 shared/src/test/scala/scala/xml/NodeSeqTest.scala diff --git a/shared/src/test/scala/scala/xml/NodeSeqTest.scala b/shared/src/test/scala/scala/xml/NodeSeqTest.scala new file mode 100644 index 000000000..08b7c0d79 --- /dev/null +++ b/shared/src/test/scala/scala/xml/NodeSeqTest.scala @@ -0,0 +1,23 @@ +package scala.xml + +import scala.xml.NodeSeq.seqToNodeSeq + +import org.junit.Test +import org.junit.Assert.assertEquals +import org.junit.Assert.fail + +class NodeSeqTest { + + @Test + def testAppend: Unit = { // Bug #392. + val a: NodeSeq = Hello + val b = Hi + a ++ Hi match { + case res: NodeSeq => assertEquals(2, res.size) + case res: Seq[Node] => fail("Should be NodeSeq") // Unreachable code? + } + val res: NodeSeq = a ++ b + val exp = NodeSeq.fromSeq(Seq(Hello, Hi)) + assertEquals(exp, res) + } +} From edfd90c796e27571254320da8c2eb13e11b0a634 Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Fri, 31 Jan 2020 06:32:54 -0500 Subject: [PATCH 414/789] Add further tests of NodeSeq --- .../test/scala/scala/xml/NodeSeqTest.scala | 80 +++++++++++++++++++ 1 file changed, 80 insertions(+) diff --git a/shared/src/test/scala/scala/xml/NodeSeqTest.scala b/shared/src/test/scala/scala/xml/NodeSeqTest.scala index 08b7c0d79..d8ba4cc70 100644 --- a/shared/src/test/scala/scala/xml/NodeSeqTest.scala +++ b/shared/src/test/scala/scala/xml/NodeSeqTest.scala @@ -20,4 +20,84 @@ class NodeSeqTest { val exp = NodeSeq.fromSeq(Seq(Hello, Hi)) assertEquals(exp, res) } + + @Test + def testAppendedAll: Unit = { // Bug #392. + val a: NodeSeq = Hello + val b = Hi + a :+ Hi match { + case res: Seq[Node] => assertEquals(2, res.size) + case res: NodeSeq => fail("Should be Seq[Node]") // Unreachable code? + } + val res: NodeSeq = a :+ b + val exp = NodeSeq.fromSeq(Seq(Hello, Hi)) + assertEquals(exp, res) + } + + @Test + def testPrepended: Unit = { + val a: NodeSeq = Hello + val b = Hi + a +: Hi match { + case res: Seq[NodeSeq] => assertEquals(2, res.size) + case res: NodeSeq => fail("Should be NodeSeq was Seq[Node]") // Unreachable code? + } + val res: Seq[NodeSeq] = a +: b + val exp = HelloHi + assertEquals(exp, res) + } + + @Test + def testPrependedAll: Unit = { + val a: NodeSeq = Hello + val b = Hi + val c = Hey + a ++: Hi ++: Hey match { + case res: Seq[Node] => assertEquals(3, res.size) + case res: NodeSeq => fail("Should be Seq[Node]") // Unreachable code? + } + val res: NodeSeq = a ++: b ++: c + val exp = NodeSeq.fromSeq(Seq(Hello, Hi, Hey)) + assertEquals(exp, res) + } + + @Test + def testMap: Unit = { + val a: NodeSeq = Hello + val exp: NodeSeq = Seq(Hi) + assertEquals(exp, a.map(_ => Hi)) + assertEquals(exp, for { _ <- a } yield { Hi }) + } + + @Test + def testFlatMap: Unit = { + val a: NodeSeq = Hello + val exp: NodeSeq = Seq(Hi) + assertEquals(exp, a.flatMap(_ => Seq(Hi))) + assertEquals(exp, for { b <- a; _ <- b } yield { Hi }) + assertEquals(exp, for { b <- a; c <- b; _ <- c } yield { Hi }) + } + + @Test + def testStringProjection: Unit = { + val a = + + b + + + e + e + + c + + + val res = for { + b <- a \ "b" + c <- b.child + e <- (c \ "e").headOption + } yield { + e.text.trim + } + assertEquals(Seq("e"), res) + } } From 0a1578d0d80b492a419ed2355528d1bf843f24db Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Fri, 31 Jan 2020 15:37:40 -0500 Subject: [PATCH 415/789] Fix NodeSeqTest for dotty 0.21.0-RC1 -- [E008] Member Not Found Error: shared/src/test/scala/scala/xml/NodeSeqTest.scala:47:4 46 | val exp = HelloHi 47 | assertEquals(exp, res) | ^ | value assertEquals is not a member of scala.xml.NodeBuffer -- [E045] Cyclic Error: shared/src/test/scala/scala/xml/NodeSeqTest.scala:47:17 47 | assertEquals(exp, res) | ^ | Recursive value exp needs type --- .../test/scala/scala/xml/NodeSeqTest.scala | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/shared/src/test/scala/scala/xml/NodeSeqTest.scala b/shared/src/test/scala/scala/xml/NodeSeqTest.scala index d8ba4cc70..7f80b3366 100644 --- a/shared/src/test/scala/scala/xml/NodeSeqTest.scala +++ b/shared/src/test/scala/scala/xml/NodeSeqTest.scala @@ -13,8 +13,8 @@ class NodeSeqTest { val a: NodeSeq = Hello val b = Hi a ++ Hi match { - case res: NodeSeq => assertEquals(2, res.size) - case res: Seq[Node] => fail("Should be NodeSeq") // Unreachable code? + case res: NodeSeq => assertEquals(2, res.size.toLong) + case res: Seq[Node] => fail("Should be NodeSeq was Seq[Node]") // Unreachable code? } val res: NodeSeq = a ++ b val exp = NodeSeq.fromSeq(Seq(Hello, Hi)) @@ -26,8 +26,8 @@ class NodeSeqTest { val a: NodeSeq = Hello val b = Hi a :+ Hi match { - case res: Seq[Node] => assertEquals(2, res.size) - case res: NodeSeq => fail("Should be Seq[Node]") // Unreachable code? + case res: Seq[Node] => assertEquals(2, res.size.toLong) + case res: NodeSeq => fail("Should be Seq[Node] was NodeSeq") // Unreachable code? } val res: NodeSeq = a :+ b val exp = NodeSeq.fromSeq(Seq(Hello, Hi)) @@ -39,11 +39,13 @@ class NodeSeqTest { val a: NodeSeq = Hello val b = Hi a +: Hi match { - case res: Seq[NodeSeq] => assertEquals(2, res.size) - case res: NodeSeq => fail("Should be NodeSeq was Seq[Node]") // Unreachable code? + case res: Seq[Node] => assertEquals(2, res.size.toLong) + case res: NodeSeq => fail("Should be Seq[Node] was NodeSeq") // Unreachable code? } val res: Seq[NodeSeq] = a +: b - val exp = HelloHi + val exp: NodeBuffer = { + HelloHi + } assertEquals(exp, res) } @@ -53,8 +55,8 @@ class NodeSeqTest { val b = Hi val c = Hey a ++: Hi ++: Hey match { - case res: Seq[Node] => assertEquals(3, res.size) - case res: NodeSeq => fail("Should be Seq[Node]") // Unreachable code? + case res: Seq[Node] => assertEquals(3, res.size.toLong) + case res: NodeSeq => fail("Should be Seq[Node] was NodeSeq") // Unreachable code? } val res: NodeSeq = a ++: b ++: c val exp = NodeSeq.fromSeq(Seq(Hello, Hi, Hey)) From 16daaae7b36a5a207e6a34ab2e41f9300c67e8bc Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Tue, 4 Feb 2020 00:03:16 +0100 Subject: [PATCH 416/789] Update sbt to 1.3.8 --- project/build.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/build.properties b/project/build.properties index a82bb05e1..a919a9b5f 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version=1.3.7 +sbt.version=1.3.8 From a78dc66267e59b95d5f386bf6341ae64cbcb5e4f Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Wed, 5 Feb 2020 09:14:23 -0500 Subject: [PATCH 417/789] Update dotty 0.22.0-RC1 --- .circleci/config.yml | 8 ++++---- .travis.yml | 6 +++--- build.sbt | 2 ++ 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 6522d0cb6..4b60b0d3a 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -91,7 +91,7 @@ workflows: - scala_job: name: dotty-0.21 java_version: jdk8 - scala_version: 0.21.0-RC1 + scala_version: 0.22.0-RC1 - scala_job: name: jdk11_2.12 java_version: jdk11 @@ -103,7 +103,7 @@ workflows: - scala_job: name: jdk11_dotty java_version: jdk11 - scala_version: 0.21.0-RC1 + scala_version: 0.22.0-RC1 - scala_job: name: jdk13_2.12 java_version: jdk13 @@ -115,7 +115,7 @@ workflows: - scala_job: name: jdk13_dotty java_version: jdk13 - scala_version: 0.21.0-RC1 + scala_version: 0.22.0-RC1 - scala_job: name: jdk14_2.12 java_version: jdk14 @@ -127,7 +127,7 @@ workflows: - scala_job: name: jdk14_dotty java_version: jdk14 - scala_version: 0.21.0-RC1 + scala_version: 0.22.0-RC1 - scalajs_job: name: sjs0.6_2.12 scala_version: 2.12.10 diff --git a/.travis.yml b/.travis.yml index 1e6bfec48..12c66e18d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,7 +5,7 @@ import: scala/scala-dev:travis/default.yml language: scala scala: - - 0.21.0-RC1 + - 0.22.0-RC1 - 2.12.10 - 2.13.1 @@ -18,9 +18,9 @@ env: matrix: exclude: - - scala: 0.21.0-RC1 + - scala: 0.22.0-RC1 env: SCALAJS_VERSION=0.6.32 ADOPTOPENJDK=8 - - scala: 0.21.0-RC1 + - scala: 0.22.0-RC1 env: SCALAJS_VERSION=1.0.0-RC2 ADOPTOPENJDK=8 install: diff --git a/build.sbt b/build.sbt index 555155c57..12c7078bb 100644 --- a/build.sbt +++ b/build.sbt @@ -161,6 +161,8 @@ lazy val xml = crossProject(JSPlatform, JVMPlatform) } ) .jsSettings( + // The config for Travis has an exclude, but sbt-travisci doesn't catch it. + crossScalaVersions -= "0.22.0-RC1", // Scala.js cannot run forked tests fork in Test := false ) From 08e4b96926a9a1933ad60a31f0c0e7218773c69b Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Wed, 5 Feb 2020 16:10:35 -0500 Subject: [PATCH 418/789] Update to Scala.js 1.0.0 --- .circleci/config.yml | 8 ++++---- .travis.yml | 4 ++-- build.sbt | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 4b60b0d3a..a8f93adfc 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -137,10 +137,10 @@ workflows: scala_version: 2.13.1 scalajs_version: 0.6.32 - scalajs_job: - name: sjs1.0.0-RC2_2.12 + name: sjs1.0_2.12 scala_version: 2.12.10 - scalajs_version: 1.0.0-RC2 + scalajs_version: 1.0.0 - scalajs_job: - name: sjs1.0.0-RC2_2.13 + name: sjs1.0_2.13 scala_version: 2.13.1 - scalajs_version: 1.0.0-RC2 + scalajs_version: 1.0.0 diff --git a/.travis.yml b/.travis.yml index 12c66e18d..527bb01d1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,7 +12,7 @@ scala: env: - SCALAJS_VERSION= ADOPTOPENJDK=8 - SCALAJS_VERSION=0.6.32 ADOPTOPENJDK=8 - - SCALAJS_VERSION=1.0.0-RC2 ADOPTOPENJDK=8 + - SCALAJS_VERSION=1.0.0 ADOPTOPENJDK=8 - SCALAJS_VERSION= ADOPTOPENJDK=11 - SCALAJS_VERSION= ADOPTOPENJDK=13 @@ -21,7 +21,7 @@ matrix: - scala: 0.22.0-RC1 env: SCALAJS_VERSION=0.6.32 ADOPTOPENJDK=8 - scala: 0.22.0-RC1 - env: SCALAJS_VERSION=1.0.0-RC2 ADOPTOPENJDK=8 + env: SCALAJS_VERSION=1.0.0 ADOPTOPENJDK=8 install: - git fetch --tags # get all tags for sbt-dynver diff --git a/build.sbt b/build.sbt index 12c7078bb..9eee0e939 100644 --- a/build.sbt +++ b/build.sbt @@ -43,7 +43,7 @@ lazy val xml = crossProject(JSPlatform, JVMPlatform) scalacOptions in Test += "-Xxml:coalescing", scalaModuleMimaPreviousVersion := { - if (System.getenv("SCALAJS_VERSION") == "1.0.0-RC2") None // No such release yet + if (System.getenv("SCALAJS_VERSION") == "1.0.0") None // No such release yet else Some("1.2.0") }, mimaBinaryIssueFilters ++= { From a311d74fecf4a824c71fce97f2ca1b30859d48be Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Wed, 5 Feb 2020 22:54:50 -0500 Subject: [PATCH 419/789] Various updates for 1.3.0 --- .travis.yml | 14 +++++++------- admin/build.sh | 2 +- build.sbt | 10 +++++----- project/build.properties | 2 +- project/plugins.sbt | 13 ++++--------- 5 files changed, 18 insertions(+), 23 deletions(-) diff --git a/.travis.yml b/.travis.yml index 51ec8c471..ff66ab86a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,8 +6,8 @@ jdk: scala: - 2.11.12 - - 2.12.8 - - 2.13.0 + - 2.12.10 + - 2.13.1 env: global: @@ -20,17 +20,17 @@ env: matrix: # The empty SCALAJS_VERSION will only compile for the JVM - SCALAJS_VERSION= - - SCALAJS_VERSION=0.6.28 - - SCALAJS_VERSION=1.0.0-M8 + - SCALAJS_VERSION=0.6.32 + - SCALAJS_VERSION=1.0.0 matrix: exclude: - jdk: openjdk11 - env: SCALAJS_VERSION=0.6.28 + env: SCALAJS_VERSION=0.6.32 - jdk: openjdk11 - env: SCALAJS_VERSION=1.0.0-M8 + env: SCALAJS_VERSION=1.0.0 - scala: 2.11.12 - env: SCALAJS_VERSION=1.0.0-M8 + env: SCALAJS_VERSION=1.0.0 - scala: 2.11.12 jdk: openjdk11 diff --git a/admin/build.sh b/admin/build.sh index d46687cd6..87cccb83c 100755 --- a/admin/build.sh +++ b/admin/build.sh @@ -39,7 +39,7 @@ if [[ "$TRAVIS_TAG" =~ $tagPat ]]; then currentJvmVer=$(java -version 2>&1 | awk -F '"' '/version/ {print $2}' | sed 's/^1\.//' | sed 's/[^0-9].*//') echo "Releasing $tagVer with Scala $TRAVIS_SCALA_VERSION on Java version $currentJvmVer." - publishTask="$projectPrefix/publish-signed" + publishTask="$projectPrefix/publishSigned" cat admin/gpg.sbt >> project/plugins.sbt cp admin/publish-settings.sbt . diff --git a/build.sbt b/build.sbt index 238704630..3b2381f2d 100644 --- a/build.sbt +++ b/build.sbt @@ -1,7 +1,7 @@ import sbtcrossproject.{crossProject, CrossType} import ScalaModulePlugin._ -crossScalaVersions in ThisBuild := List("2.12.8", "2.11.12", "2.13.0") +crossScalaVersions in ThisBuild := List("2.12.10", "2.11.12", "2.13.1") lazy val xml = crossProject(JSPlatform, JVMPlatform) .withoutSuffixFor(JVMPlatform) @@ -11,7 +11,7 @@ lazy val xml = crossProject(JSPlatform, JVMPlatform) .jvmSettings(scalaModuleSettingsJVM) .settings( name := "scala-xml", - version := "1.2.1-SNAPSHOT", + version := "1.3.0-SNAPSHOT", // this line could be removed after https://github.com/scala/sbt-scala-module/issues/48 is fixed licenses := Seq(("Apache-2.0", url("https://www.apache.org/licenses/LICENSE-2.0"))), @@ -22,7 +22,7 @@ lazy val xml = crossProject(JSPlatform, JVMPlatform) scalacOptions in Test += "-Xxml:coalescing", mimaPreviousVersion := { - if (System.getenv("SCALAJS_VERSION") == "1.0.0-M8") None // No such release yet + if (System.getenv("SCALAJS_VERSION") == "1.0.0") None else Some("1.2.0") }, @@ -62,9 +62,9 @@ lazy val xml = crossProject(JSPlatform, JVMPlatform) .jvmSettings( OsgiKeys.exportPackage := Seq(s"scala.xml.*;version=${version.value}"), - libraryDependencies += "junit" % "junit" % "4.12" % "test", + libraryDependencies += "junit" % "junit" % "4.13" % "test", libraryDependencies += "com.novocode" % "junit-interface" % "0.11" % "test", - libraryDependencies += "org.apache.commons" % "commons-lang3" % "3.5" % "test", + libraryDependencies += "org.apache.commons" % "commons-lang3" % "3.9" % "test", libraryDependencies += ("org.scala-lang" % "scala-compiler" % scalaVersion.value % "test").exclude("org.scala-lang.modules", s"scala-xml_${scalaBinaryVersion.value}") ) .jsSettings( diff --git a/project/build.properties b/project/build.properties index 8e682c526..c0bab0494 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version=0.13.18 +sbt.version=1.2.8 diff --git a/project/plugins.sbt b/project/plugins.sbt index 8fd973271..191a88fe8 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,13 +1,8 @@ -if (System.getProperty("java.version").startsWith("1.")) - Seq() -else - // override to version that works on Java 9, - // see https://github.com/scala/sbt-scala-module/issues/35 - Seq(addSbtPlugin("com.typesafe.sbt" % "sbt-osgi" % "0.9.3")) +addSbtPlugin("com.typesafe.sbt" % "sbt-osgi" % "0.9.5") val scalaJSVersion = - Option(System.getenv("SCALAJS_VERSION")).filter(_.nonEmpty).getOrElse("0.6.28") + Option(System.getenv("SCALAJS_VERSION")).filter(_.nonEmpty).getOrElse("0.6.32") addSbtPlugin("org.scala-js" % "sbt-scalajs" % scalaJSVersion) -addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "0.6.0") -addSbtPlugin("org.scala-lang.modules" % "sbt-scala-module" % "1.0.14") +addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "0.6.1") +addSbtPlugin("org.scala-lang.modules" % "sbt-scala-module" % "2.0.0") From 0a0074f9489214fe82bd42a0f4fa1911d5b7fcbd Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Mon, 10 Feb 2020 23:06:55 +0100 Subject: [PATCH 420/789] Update sbt-scalajs-crossproject to 1.0.0 --- project/plugins.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/plugins.sbt b/project/plugins.sbt index 32a04af08..cf01f136d 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -2,6 +2,6 @@ val scalaJSVersion = Option(System.getenv("SCALAJS_VERSION")).filter(_.nonEmpty).getOrElse("0.6.32") addSbtPlugin("org.scala-lang.modules" % "sbt-scala-module" % "2.1.3") -addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "0.6.1") +addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.0.0") addSbtPlugin("org.scala-js" % "sbt-scalajs" % scalaJSVersion) addSbtPlugin("ch.epfl.lamp" % "sbt-dotty" % "0.4.0") From 44c393f76b4beaf4a908350a3d7d79e73fd33d7e Mon Sep 17 00:00:00 2001 From: JulienSt Date: Wed, 19 Feb 2020 14:53:56 +0000 Subject: [PATCH 421/789] Create "Related projects"-section in readme Based on the suggestion from @SethTisue here: https://users.scala-lang.org/t/i-created-a-xml-library-to-make-the-use-of-the-standard-library-easier/5627 Please include other libraries, that fit this section. --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index 84bcfe1ef..974bdb4dc 100644 --- a/README.md +++ b/README.md @@ -34,3 +34,9 @@ page](https://github.com/scala/scala-xml/issues/62) for details. ## Security best practices The XML spec has some features that are best turned off, to avoid unsavory things like file system access, DoS attacks,... Issue [#17](https://github.com/scala/scala-xml/issues/17) tracks the recommended way of configuring the XML parser used by scala-xml to avoid these. This is by no means an exhaustive list. We'll be happy to incorporate your suggestions -- just comment on the ticket! + +## Related projects + +These Projects build upon this library and increase the functionality in different ways. + - [Advxml](https://github.com/geirolz/advxml) - A lightweight, functional library combining scala-xml with cats-core + - [ezXML](https://github.com/JulienSt/ezXML) - This project aims to make working with scala-xml less cumbersome From 5966334e1480733f7b86cd0d7581ddb041b1410e Mon Sep 17 00:00:00 2001 From: Lukas Rytz Date: Mon, 24 Feb 2020 21:45:26 +0100 Subject: [PATCH 422/789] backport new publishing scripts based on sbt-ci-release --- .travis.yml | 47 +++++++----------------- admin/README.md | 69 ----------------------------------- admin/api-docs.sh | 71 ------------------------------------- admin/build.sh | 54 ---------------------------- admin/encryptEnvVars.sh | 11 ------ admin/genKeyPair.sh | 41 --------------------- admin/gpg.sbt | 2 -- admin/publish-settings.sbt | 8 ----- admin/pubring.asc | 18 ---------- admin/secring.asc.enc | Bin 1872 -> 0 bytes build.sbt | 40 ++++++++++----------- build.sh | 54 ++++++++++++++++++++++++++++ project/build.properties | 2 +- project/plugins.sbt | 6 ++-- 14 files changed, 88 insertions(+), 335 deletions(-) delete mode 100644 admin/README.md delete mode 100755 admin/api-docs.sh delete mode 100755 admin/build.sh delete mode 100755 admin/encryptEnvVars.sh delete mode 100755 admin/genKeyPair.sh delete mode 100644 admin/gpg.sbt delete mode 100644 admin/publish-settings.sbt delete mode 100644 admin/pubring.asc delete mode 100644 admin/secring.asc.enc create mode 100755 build.sh diff --git a/.travis.yml b/.travis.yml index ff66ab86a..746c7cac9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,8 +1,8 @@ -language: scala +version: ~> 1.0 # needed for imports + +import: scala/scala-dev:travis/default.yml -jdk: - - openjdk8 - - openjdk11 +language: scala scala: - 2.11.12 @@ -10,40 +10,19 @@ scala: - 2.13.1 env: - global: - # PGP_PASSPHRASE - - secure: "BYC1kEnHjNrINrHYWPGEuTTJ2V340/0ByzqeihLecjoZ75yrjWdsh6MI1JEUWgv5kb+58vLzib21JfnjsPK6Yb2bSXuCFCsEtJNh6RJKgxkWlCOzfTSh5I2wl7PCjRClRL6gseX2uTSvFjL4Z//pmxwxeXlLp7voQe4QAUq1+sE=" - # SONA_USER - - secure: "OpBwPc1GNvauageYOH3RscAa7wpZxgpmqDz15aigIKLNWzAhAtVUx0MleZ8rQeoqml6nrAvlnzuVHjKL2lVcjMPpjUis7bcQ5UAGK7tZK8x+qZNQxXmpXu8+pENwQA2yFaqt/xy7K5jFOrHJHTRxcPnyVG1yKakPWz53PPYUwbc=" - # SONA_PASS - - secure: "Xw7rI/qlML1nD2e2XwlakkhKAWNGZKqqE+Q3ntTvFpfHryl7KLCvVzJ4LIavnL6kGJaWOgy9vlSoEWn5g9nqHSfE31C/k5pY5nTMAKiwiJzfAS+r0asKXW2gmKhwtcTBkqyLVOZLCJSPVlFRQyfBJHY+Fs0L3KWcnMQgtBlyDhU=" - matrix: - # The empty SCALAJS_VERSION will only compile for the JVM - - SCALAJS_VERSION= - - SCALAJS_VERSION=0.6.32 - - SCALAJS_VERSION=1.0.0 + - SCALAJS_VERSION= ADOPTOPENJDK=8 + - SCALAJS_VERSION=0.6.32 ADOPTOPENJDK=8 + - SCALAJS_VERSION=1.0.0 ADOPTOPENJDK=8 + - SCALAJS_VERSION= ADOPTOPENJDK=11 matrix: exclude: - - jdk: openjdk11 - env: SCALAJS_VERSION=0.6.32 - - jdk: openjdk11 - env: SCALAJS_VERSION=1.0.0 - scala: 2.11.12 - env: SCALAJS_VERSION=1.0.0 + env: SCALAJS_VERSION=0.6.32 ADOPTOPENJDK=8 - scala: 2.11.12 - jdk: openjdk11 + env: SCALAJS_VERSION=1.0.0 ADOPTOPENJDK=8 -script: - - java -version - - node -v - - admin/build.sh +install: + - git fetch --tags # get all tags for sbt-dynver -before_cache: - - find $HOME/.sbt -name "*.lock" | xargs rm - - find $HOME/.ivy2/cache -name "ivydata-*.properties" | xargs rm -cache: - directories: - - $HOME/.ivy2/cache - - $HOME/.sbt/boot - - $HOME/.sbt/launchers +script: ./build.sh diff --git a/admin/README.md b/admin/README.md deleted file mode 100644 index 3e9d1bfa2..000000000 --- a/admin/README.md +++ /dev/null @@ -1,69 +0,0 @@ -## Tag Driven Releasing - -### Initial setup for the repository - -To configure tag driven releases from Travis CI. - - 1. Generate a key pair for this repository with `./admin/genKeyPair.sh`. - Edit `.travis.yml` and `admin/build.sh` as prompted. - 1. Publish the public key to https://pgp.mit.edu - 1. Store other secrets as encrypted environment variables with `./admin/encryptEnvVars.sh`. - Edit `.travis.yml` as prompted. - 1. Edit `.travis.yml` to use `./admin/build.sh` as the build script, - and edit that script to use the tasks required for this project. - Ensure that `RELEASE_COMBO` is `true` for build matrix combinations - that should be released to sonatype (when building a tag). - -It is important to add comments in `.travis.yml` to identify the name -of each environment variable encoded in a `secure` section. - -After these steps, your `.travis.yml` should contain config of the form: - -``` -language: scala - -jdk: - - openjdk6 - - oraclejdk8 - -scala: - - 2.11.12 - - 2.12.6 - -env: - global: - # PGP_PASSPHRASE - - secure: "XXXXXX" - # SONA_USER - - secure: "XXXXXX" - # SONA_PASS - - secure: "XXXXXX" - -script: admin/build.sh - -notifications: - email: - - a@b.com -``` - -If Sonatype credentials change in the future, step 3 can be repeated -without generating a new key. - -### Testing - - 1. Follow the release process below to create a dummy release (e.g., `v0.1.0-TEST1`). - Confirm that the release was staged to Sonatype but do not release it to Maven - central. Instead, drop the staging repository. - -### Performing a release - - 1. Create a GitHub "Release" with a corresponding tag (e.g., `v0.1.1`) via the GitHub - web interface. - 1. The release will be published using the Scala and JVM version combinations specified - in the travis build matrix where `[ "$RELEASE_COMBO" = "true" ]`. - - If you need to release against a different Scala version, create a new commit that modifies - `.travis.yml` and push a new tag, e.g., `v1.2.3#2.13.0-M5`. The suffix after `#` is ignored. - 1. Travis CI will schedule a build for this release. Review the build logs. - 1. Log into https://oss.sonatype.org/ and identify the staging repository. - 1. Sanity check its contents. - 1. Release staging repository to Maven and send out release announcement. diff --git a/admin/api-docs.sh b/admin/api-docs.sh deleted file mode 100755 index ece2b11e1..000000000 --- a/admin/api-docs.sh +++ /dev/null @@ -1,71 +0,0 @@ -#!/bin/bash - -### - # Copyright (C) 2019 LAMP/EPFL and Lightbend, Inc. - # - # Build API docs for scala-xml. - # - # Runs Scaladoc, then commits to the gh-pages branch, so they are - # published to https://docs.scala-lang.org/scala-xml/api/1.0.0/ - # - # Usage: - # ./admin/api-docs.sh SCALA-XML-VERSION SCALA-VERSION - # - # SCALA-XML-VERSION is the scala-xml version, e.g. v1.0.5 - # SCALA-VERSION is the Scala version, e.g. 2.11.12 - # - # Example: - # ./admin/api-docs.sh v1.0.6 2.12.0 - # - # Required dependencies: - # - sbt 1.x - # - git - # - rsync - ## - -set -e - -if [ -z "$1" ]; then - echo "Error: Missing scala-xml version" >&2 - exit 1 -elif [ -z "$2" ]; then - echo "Error: Missing Scala version" >&2 - exit 1 -fi - -SCALA_XML_VERSION=${1%%#*} # Cleanup tags, e.g. v1.1.1#2.13.0-M5#8 -SCALA_VERSION=$2 - -TARGET_DIR=${TARGET_DIR-./jvm/target} -API_DIR=$TARGET_DIR/scala-${SCALA_VERSION%.*}/api -GIT_DIR=${GIT_DIR-./jvm/target} -DOC_DIR=$GIT_DIR/api/${SCALA_XML_VERSION#v} - -git checkout $SCALA_XML_VERSION -sbt "++$SCALA_VERSION" doc -mkdir $GIT_DIR/api -rsync -a $API_DIR/ $DOC_DIR/ -echo "Initializing git directory in $GIT_DIR" -cd $GIT_DIR -git init -git remote add upstream git@github.com:scala/scala-xml.git -git fetch upstream gh-pages -git checkout gh-pages -git add -A ./api -git commit -m"Scaladoc for $SCALA_XML_VERSION with Scala $SCALA_VERSION" -echo "Please review the commit in $GIT_DIR and push upstream" - -exit 0 -## End of script - -## Rebuild the universe with: - -env JAVA_HOME=$(/usr/libexec/java_home -v 1.6) TARGET_DIR=./target ./admin/api-docs.sh v1.0.1 2.11.12 -env JAVA_HOME=$(/usr/libexec/java_home -v 1.6) TARGET_DIR=./target ./admin/api-docs.sh v1.0.2 2.11.12 -env JAVA_HOME=$(/usr/libexec/java_home -v 1.6) TARGET_DIR=./target ./admin/api-docs.sh v1.0.3 2.11.12 -env JAVA_HOME=$(/usr/libexec/java_home -v 1.6) TARGET_DIR=./target ./admin/api-docs.sh v1.0.4 2.11.12 -env JAVA_HOME=$(/usr/libexec/java_home -v 1.6) TARGET_DIR=./target ./admin/api-docs.sh v1.0.5 2.11.12 -env JAVA_HOME=$(/usr/libexec/java_home -v 1.8) TARGET_DIR=./target ./admin/api-docs.sh v1.0.6 2.12.0 -env JAVA_HOME=$(/usr/libexec/java_home -v 1.8) ./admin/api-docs.sh v1.1.0 2.12.4 -env JAVA_HOME=$(/usr/libexec/java_home -v 1.8) ./admin/api-docs.sh v1.1.1 2.12.6 -env JAVA_HOME=$(/usr/libexec/java_home -v 1.8) ./admin/api-docs.sh v1.2.0 2.12.8 diff --git a/admin/build.sh b/admin/build.sh deleted file mode 100755 index 87cccb83c..000000000 --- a/admin/build.sh +++ /dev/null @@ -1,54 +0,0 @@ -#!/bin/bash - -set -e - -# Builds of tagged revisions are published to sonatype staging. - -# Travis runs a build on revisions, including on new tags. -# Builds for a tag have TRAVIS_TAG defined, which we use for identifying tagged builds. -# Checking the local git clone would not work because git on travis does not fetch tags. - -# The version number to be published is extracted from the tag, e.g., v1.2.3 publishes -# version 1.2.3 on all combinations of the travis matrix where `[ "$RELEASE_COMBO" = "true" ]`. - -# In order to build a previously released version against a new (binary incompatible) Scala release, -# a new commit that modifies (and prunes) the Scala versions in .travis.yml needs to be added on top -# of the existing tag. Then a new tag can be created for that commit, e.g., `v1.2.3#2.13.0-M5`. -# Everything after the `#` in the tag name is ignored. - -if [[ "$TRAVIS_JDK_VERSION" == "openjdk8" && "$TRAVIS_SCALA_VERSION" =~ 2\.1[123]\..* ]]; then - RELEASE_COMBO=true; -fi - -if [ "$SCALAJS_VERSION" = "" ]; then - projectPrefix="xml" -else - projectPrefix="xmlJS" -fi - -verPat="[0-9]+\.[0-9]+\.[0-9]+(-[A-Za-z0-9-]+)?" -tagPat="^v$verPat(#.*)?$" - -if [[ "$TRAVIS_TAG" =~ $tagPat ]]; then - tagVer=${TRAVIS_TAG} - tagVer=${tagVer#v} # Remove `v` at beginning. - tagVer=${tagVer%%#*} # Remove anything after `#`. - publishVersion='set every version := "'$tagVer'"' - - if [ "$RELEASE_COMBO" = "true" ]; then - currentJvmVer=$(java -version 2>&1 | awk -F '"' '/version/ {print $2}' | sed 's/^1\.//' | sed 's/[^0-9].*//') - echo "Releasing $tagVer with Scala $TRAVIS_SCALA_VERSION on Java version $currentJvmVer." - - publishTask="$projectPrefix/publishSigned" - - cat admin/gpg.sbt >> project/plugins.sbt - cp admin/publish-settings.sbt . - - # Copied from the output of genKeyPair.sh - K=$encrypted_6b8d67feaab7_key - IV=$encrypted_6b8d67feaab7_iv - openssl aes-256-cbc -K $K -iv $IV -in admin/secring.asc.enc -out admin/secring.asc -d - fi -fi - -sbt "++$TRAVIS_SCALA_VERSION" "$publishVersion" "$projectPrefix/clean" "$projectPrefix/test" "$projectPrefix/publishLocal" "$publishTask" diff --git a/admin/encryptEnvVars.sh b/admin/encryptEnvVars.sh deleted file mode 100755 index b62566798..000000000 --- a/admin/encryptEnvVars.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/bash -# -# Encrypt sonatype credentials so that they can be -# decrypted in trusted builds on Travis CI. -# -set -e - -read -s -p 'SONA_USER: ' SONA_USER -travis encrypt SONA_USER="$SONA_USER" -read -s -p 'SONA_PASS: ' SONA_PASS -travis encrypt SONA_PASS="$SONA_PASS" diff --git a/admin/genKeyPair.sh b/admin/genKeyPair.sh deleted file mode 100755 index 17db3f39b..000000000 --- a/admin/genKeyPair.sh +++ /dev/null @@ -1,41 +0,0 @@ -#!/bin/bash -# -# Generates a key pair for this repository to sign artifacts. -# Encrypt the private key and its passphrase in trusted builds -# on Travis CI. -# -set -e - -# Based on https://gist.github.com/kzap/5819745: -function promptDelete() { - if [[ -f "$1" ]]; then - echo About to delete $1, Enter for okay / CTRL-C to cancel - read - rm "$1" - fi -} -for f in admin/secring.asc.enc admin/secring.asc admin/pubring.asc; do promptDelete "$f"; done - -echo Generating key pair. Please enter 1. repo name 2. scala-internals@googlegroups.com, 3. a new passphrase -echo Be careful when using special characters in the passphrase, see http://docs.travis-ci.com/user/encryption-keys/#Note-on-escaping-certain-symbols -cp admin/gpg.sbt project -sbt 'set pgpReadOnly := false' \ - 'set pgpPublicRing := file("admin/pubring.asc")' \ - 'set pgpSecretRing := file("admin/secring.asc")' \ - 'pgp-cmd gen-key' -rm project/gpg.sbt - -echo ============================================================================================ -echo Encrypting admin/secring.asc. Update K and IV variables in admin/build.sh accordingly. -echo ============================================================================================ -travis encrypt-file admin/secring.asc -rm admin/secring.asc -mv secring.asc.enc admin - -echo ============================================================================================ -echo Encrypting environment variables. Add each to a line in .travis.yml. Include a comment -echo with the name of the corresponding variable -echo ============================================================================================ -read -s -p 'PGP_PASSPHRASE: ' PGP_PASSPHRASE -travis encrypt PGP_PASSPHRASE="$PGP_PASSPHRASE" - diff --git a/admin/gpg.sbt b/admin/gpg.sbt deleted file mode 100644 index 68ae46411..000000000 --- a/admin/gpg.sbt +++ /dev/null @@ -1,2 +0,0 @@ - -addSbtPlugin("com.typesafe.sbt" % "sbt-pgp" % "0.8.3") // only added when publishing, see build.sh diff --git a/admin/publish-settings.sbt b/admin/publish-settings.sbt deleted file mode 100644 index 026c6ee3e..000000000 --- a/admin/publish-settings.sbt +++ /dev/null @@ -1,8 +0,0 @@ -def env(key: String) = Option(System.getenv(key)).getOrElse("") - -inThisBuild(Seq( - pgpPassphrase := Some(env("PGP_PASSPHRASE").toArray), - pgpPublicRing := file("admin/pubring.asc"), - pgpSecretRing := file("admin/secring.asc"), - credentials += Credentials("Sonatype Nexus Repository Manager", "oss.sonatype.org", env("SONA_USER"), env("SONA_PASS")) -)) diff --git a/admin/pubring.asc b/admin/pubring.asc deleted file mode 100644 index df4501ad6..000000000 --- a/admin/pubring.asc +++ /dev/null @@ -1,18 +0,0 @@ ------BEGIN PGP PUBLIC KEY BLOCK----- -Version: BCPG v1.49 - -mQENBFVQohwBCACi9Hupi/27JFgcRypkruHZNKXa4+QO380B5hp0UFUzJHBqEvUd -p9niOq30yCgfByLiPv2qr7g1lAg2DltH9WyN5zhp3MzOt/m1w66IwZqgCS364gtD -56udK2R6YCFMfiJxGXFsSbStfIoD8N5S++NJGv0GuFc2m3sSuTunRFoRWN4Dce0g -a16nyVR2dPfqOkL7LLzMR4Tl8VQFb36WPrFBmJKzZWxt0r2pQhEDMwItuZeKrBhm -K/RZWtNqiBO61JCBHfWZdpduUcTjlr5cW+jkRtw8La0qgglJcSN/sErQamAtU6vo -sdTZ2aQQZnYyVBt00yrLV+9Dq/dBS6cfV9NHABEBAAG0LHNjYWxhLXhtbCA8c2Nh -bGEtaW50ZXJuYWxzQGdvb2dsZWdyb3Vwcy5jb20+iQEcBBMBAgAGBQJVUKIcAAoJ -EO/sfqhmzEOuHtkH/25VVvDzMo85E8KlCtsnkD5Alb83zV1XF6+mZaRHikzKkQRz -phZEGaU6ee3V6CH5qXsmKTU2B1WaOYIdPkuBjwdpRPJbaX0zzrWUCCv1vLKDb+z2 -nlcg0AehMUM3UinbGR6QCh06p3O/tBokJvZM+Ng3pkXtLOS4HphRfindpy7+u1Y/ -szcIQS88AH1g5xPt8nwrh9VQbrYD04K20mLckGIWnjSzgFB9hntMF5arAP9Q1RkS -52xiOZB8RTZZCkFeHIdMKjjmoM9Vn/3JZzsy8Om4FWYa/l2fEExxKWFupvQetjFk -VTTOG+T7/WwVPQQ0xQLROgWL7z5UgxHly64WClA= -=/6/b ------END PGP PUBLIC KEY BLOCK----- diff --git a/admin/secring.asc.enc b/admin/secring.asc.enc deleted file mode 100644 index 626ff5d10725214624e7c797a9eb74864127bd10..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1872 zcmV-W2e0@fqpgw+LsRd7u2o)%di3Y_9iX0wgGZTvHLMnHOVRsifjxLtWxXi~jtiA- z#bq1(7NwM*VTQi!XlB8CsKd6Vb?RVs+LcSU9mzPJDW))Y09x4*M_jRHK)t!Hd4Q#^ zO`Scgult5G8x2H&A-0j`lh54Vrp6$rFgVxY6$uvk(})PKqp0haRYw=fux{Ig7Qu6A-9wVubfVV=|G z{{Z;GKKc2I{ka&)nadAV;*EN7&jC)0u}wYPd-5ljH#csr$>A#+8jUmzjBLne>Avff z3?1)>MJ>&-io7mY8FL`pIy-Tn{kTvT#`k}16tuGOF17oD2ZHATYgY;uhAK@rXf}kl zp607sR*Jd2LOK)9pPiB$@4#{4Og(yRHtXuAgTfzmJfJ>*A*eiD8lDSvP8#G$4s3iU zEJ0eveZ&S;+l1zzAc|x=O;DYO_d%VY>1R#%xUm11l13?Pr)58ok6V{A3B{AcPLeOz zHN1P;pm_lsgMQ@gBZ?|Nj&C5`;se!}aM{k)@St|b6>!b>j_Gap>MY?wgi>JVOeq>3y7QnnjZl0{hi zXWt-ZUv$bfpY_hP(%^1SH&F@i{xP{l@P$l5w5ahNHyHWmdMPdNoOEQ-D6Ot~G%!jH z8C=WK?{W(e-#}y}pQxUqRjM6MGWqRnZ2U$a%q|N-F#aCrUA)O#e=F22p06Mx=91=! zp0ee_ zinPL)?)@Q>7zfvkXg+(zjt39zCpg3QfsKSX_EYNI!k`N%2xL~a2oBK(_|TU4E> z-?=Wv{0)yf&29)J#J>mMwR$UB%fxSFDsgPQrN8H@+G7z3$ESL+$b{3%4*?8Sm6E)y zikukNt?wZvD^SgpDH7IMkb|92-dGZ`k3j7$;76!SM{(W!CWcno+}w z2oehz#zkCAYaip?YJds7E}L5Y2C@b~5fW76^s`B>=D4pZ$2-435i0wq0NNeBNvctx zmDF@(NO0g8drhqd5;C4vd5666m(VH0j-$jyZaptkAYq zZUMD=c9deNngez7wj9wG2}4S zY~0z1gifa^iboBmjK8RC0+btk0<64If91L05m61O{WXtiQfE|0n?YUqCHI!b=~S?m zoA_vx?*xLiq$|1`5QNMP6Ex^a&Ys#DiTk>Ch5T@$ekg90Q{+n$?8(el+Ez#ZKV??yD^UK>7g^QMT!iq_w8~%Ft z;e=?o3MaHmjV%^%U8ghL_1v%U4YBdm^hZF}5P-W=XC%;{FCh+tl#$+Kmx?H{USO`4 z3~G!xl?T?kK$Mp8t;mj7)FJgZw`IHv*~N!`3QR`FG-?t^pb>w8+^j9Jk2VKk3k2`x z^Z>-mIhY*18?LHpvCkIoxfJI>8{3KWu_U~3J;jq_{)~myM;Oh zrVpt^YOu3jtsmU`FY>-1AkO4qi4B>Rlp-9&NiC_Cma+CWnu~X?FgLGa(n>9Hnwd)M z7o9CM_iWSfdrm%(X%^6z&p8t$RhU-8a^v0HVA0ZJ@3VcmJy@UZvr4b*@)4%7(C*e# KL)moSr4dnNG@(HN diff --git a/build.sbt b/build.sbt index 3b2381f2d..79c8fd10c 100644 --- a/build.sbt +++ b/build.sbt @@ -1,27 +1,20 @@ -import sbtcrossproject.{crossProject, CrossType} -import ScalaModulePlugin._ - -crossScalaVersions in ThisBuild := List("2.12.10", "2.11.12", "2.13.1") +import sbtcrossproject.CrossPlugin.autoImport.{crossProject, CrossType} lazy val xml = crossProject(JSPlatform, JVMPlatform) .withoutSuffixFor(JVMPlatform) .crossType(CrossType.Full) .in(file(".")) - .settings(scalaModuleSettings) - .jvmSettings(scalaModuleSettingsJVM) + .settings(ScalaModulePlugin.scalaModuleSettings) + .jvmSettings(ScalaModulePlugin.scalaModuleSettingsJVM) .settings( name := "scala-xml", - version := "1.3.0-SNAPSHOT", - - // this line could be removed after https://github.com/scala/sbt-scala-module/issues/48 is fixed - licenses := Seq(("Apache-2.0", url("https://www.apache.org/licenses/LICENSE-2.0"))), // Compiler team advised avoiding the -Xfuture option for releases. // The output with -Xfuture should be periodically checked, though. scalacOptions ++= "-deprecation:false -feature -Xlint:-stars-align,-nullary-unit,_".split("\\s+").to[Seq], scalacOptions in Test += "-Xxml:coalescing", - mimaPreviousVersion := { + scalaModuleMimaPreviousVersion := { if (System.getenv("SCALAJS_VERSION") == "1.0.0") None else Some("1.2.0") }, @@ -36,25 +29,31 @@ lazy val xml = crossProject(JSPlatform, JVMPlatform) } }, - apiMappings ++= Map( - scalaInstance.value.libraryJar - -> url(s"http://www.scala-lang.org/api/${scalaVersion.value}/") - ) ++ { + apiURL := Some( + url(s"""https://scala.github.io/scala-xml/api/${"-.*".r.replaceAllIn(version.value, "")}/""") + ), + + apiMappings ++= scalaInstance.value.libraryJars.filter { file => + file.getName.startsWith("scala-library") && file.getName.endsWith(".jar") + }.map { libraryJar => + libraryJar -> + url(s"http://www.scala-lang.org/api/${scalaVersion.value}/") + }.toMap ++ { // http://stackoverflow.com/questions/16934488 Option(System.getProperty("sun.boot.class.path")).flatMap { classPath => - classPath.split(java.io.File.pathSeparator).filter(_.endsWith(java.io.File.separator + "rt.jar")).headOption + classPath.split(java.io.File.pathSeparator).find(_.endsWith(java.io.File.separator + "rt.jar")) }.map { jarPath => Map( file(jarPath) -> url("http://docs.oracle.com/javase/8/docs/api") ) } getOrElse { - // If everything fails, jam in the Java 9 base module. + // If everything fails, jam in Java 11 modules. Map( file("/modules/java.base") - -> url("http://docs.oracle.com/javase/9/docs/api"), + -> url("https://docs.oracle.com/en/java/javase/11/docs/api/java.base"), file("/modules/java.xml") - -> url("http://docs.oracle.com/javase/9/docs/api") + -> url("https://docs.oracle.com/en/java/javase/11/docs/api/java.xml") ) } } @@ -72,6 +71,3 @@ lazy val xml = crossProject(JSPlatform, JVMPlatform) fork in Test := false ) .jsConfigure(_.enablePlugins(ScalaJSJUnitPlugin)) - -lazy val xmlJVM = xml.jvm -lazy val xmlJS = xml.js diff --git a/build.sh b/build.sh new file mode 100755 index 000000000..11ca2bb0a --- /dev/null +++ b/build.sh @@ -0,0 +1,54 @@ +#!/bin/bash + +set -e + +# Builds of tagged revisions are published to sonatype staging. + +# Travis runs a build on new revisions and on new tags, so a tagged revision is built twice. +# Builds for a tag have TRAVIS_TAG defined, which we use for identifying tagged builds. + +# sbt-dynver sets the version number from the tag +# sbt-travisci sets the Scala version from the travis job matrix + +# To back-publish an existing release for a new Scala / Scala.js / Scala Native version: +# - check out the tag for the version that needs to be published +# - change `.travis.yml` to adjust the version numbers and trim down the build matrix as necessary +# - commit the changes and tag this new revision with an arbitrary suffix after a hash, e.g., +# `v1.2.3#dotty-0.27` (the suffix is ignored, the version will be `1.2.3`) + +# We release on JDK 8 (for Scala 2.x and Dotty 0.x) +isReleaseJob() { + if [[ "$ADOPTOPENJDK" == "8" ]]; then + true + else + false + fi +} + +if [[ "$SCALAJS_VERSION" == "" ]]; then + projectPrefix="xml" +else + projectPrefix="xmlJS" +fi + +verPat="[0-9]+\.[0-9]+\.[0-9]+(-[A-Za-z0-9-]+)?" +tagPat="^v$verPat(#.*)?$" + +if [[ "$TRAVIS_TAG" =~ $tagPat ]]; then + releaseTask="ci-release" + if ! isReleaseJob; then + echo "Not releasing on Java $ADOPTOPENJDK with Scala $TRAVIS_SCALA_VERSION" + exit 0 + fi +fi + +# default is +publishSigned; we cross-build with travis jobs, not sbt's crossScalaVersions +export CI_RELEASE="$projectPrefix/publishSigned" +export CI_SNAPSHOT_RELEASE="$projectPrefix/publish" + +# default is sonatypeBundleRelease, which closes and releases the staging repo +# see https://github.com/xerial/sbt-sonatype#commands +# for now, until we're confident in the new release scripts, just close the staging repo. +export CI_SONATYPE_RELEASE="; sonatypePrepare; sonatypeBundleUpload; sonatypeClose" + +sbt clean $projectPrefix/test $projectPrefix/publishLocal $releaseTask diff --git a/project/build.properties b/project/build.properties index c0bab0494..a919a9b5f 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version=1.2.8 +sbt.version=1.3.8 diff --git a/project/plugins.sbt b/project/plugins.sbt index 191a88fe8..c7107fa52 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,8 +1,6 @@ -addSbtPlugin("com.typesafe.sbt" % "sbt-osgi" % "0.9.5") - val scalaJSVersion = Option(System.getenv("SCALAJS_VERSION")).filter(_.nonEmpty).getOrElse("0.6.32") +addSbtPlugin("org.scala-lang.modules" % "sbt-scala-module" % "2.1.3") +addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.0.0") addSbtPlugin("org.scala-js" % "sbt-scalajs" % scalaJSVersion) -addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "0.6.1") -addSbtPlugin("org.scala-lang.modules" % "sbt-scala-module" % "2.0.0") From 85e17c18265202443912d1a4ea2bc1eaedd850cd Mon Sep 17 00:00:00 2001 From: Lukas Rytz Date: Mon, 24 Feb 2020 15:58:06 +0100 Subject: [PATCH 423/789] do backpublishing manually --- .travis.yml | 4 ++-- build.sbt | 2 -- build.sh | 59 +++++++++++------------------------------------------ 3 files changed, 14 insertions(+), 51 deletions(-) diff --git a/.travis.yml b/.travis.yml index 527bb01d1..005996ea0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -19,9 +19,9 @@ env: matrix: exclude: - scala: 0.22.0-RC1 - env: SCALAJS_VERSION=0.6.32 ADOPTOPENJDK=8 + env: SCALAJS_VERSION=0.6.32 ADOPTOPENJDK=8 - scala: 0.22.0-RC1 - env: SCALAJS_VERSION=1.0.0 ADOPTOPENJDK=8 + env: SCALAJS_VERSION=1.0.0 ADOPTOPENJDK=8 install: - git fetch --tags # get all tags for sbt-dynver diff --git a/build.sbt b/build.sbt index 9eee0e939..99452683a 100644 --- a/build.sbt +++ b/build.sbt @@ -161,8 +161,6 @@ lazy val xml = crossProject(JSPlatform, JVMPlatform) } ) .jsSettings( - // The config for Travis has an exclude, but sbt-travisci doesn't catch it. - crossScalaVersions -= "0.22.0-RC1", // Scala.js cannot run forked tests fork in Test := false ) diff --git a/build.sh b/build.sh index e4376a00d..11ca2bb0a 100755 --- a/build.sh +++ b/build.sh @@ -10,35 +10,15 @@ set -e # sbt-dynver sets the version number from the tag # sbt-travisci sets the Scala version from the travis job matrix -# When a new binary incompatible Scala version becomes available, a previously released version -# can be released using that new Scala version by creating a new tag containing the Scala version -# after a hash, e.g., v1.2.3#2.13.0-M3. +# To back-publish an existing release for a new Scala / Scala.js / Scala Native version: +# - check out the tag for the version that needs to be published +# - change `.travis.yml` to adjust the version numbers and trim down the build matrix as necessary +# - commit the changes and tag this new revision with an arbitrary suffix after a hash, e.g., +# `v1.2.3#dotty-0.27` (the suffix is ignored, the version will be `1.2.3`) -# For normal tags that are cross-built, we release on JDK 8 for Scala 2.x and Dotty 0.x +# We release on JDK 8 (for Scala 2.x and Dotty 0.x) isReleaseJob() { - if [[ "$ADOPTOPENJDK" == "8" && "$TRAVIS_SCALA_VERSION" =~ ^2\.1[234]\..*$ ]]; then - true - elif [[ "$ADOPTOPENJDK" == "8" && "$TRAVIS_SCALA_VERSION" =~ ^0\.[0-9]+\..*$ ]]; then - true - else - false - fi -} - -# For tags that define a Scala version, we pick the jobs of a Scala version (2.13.x) or Dotty (0.x) to do the releases -isTagScalaReleaseJob() { - if [[ "$ADOPTOPENJDK" == "8" && "$TRAVIS_SCALA_VERSION" =~ ^2\.13\.[0-9]+$ ]]; then - true - elif [[ "$ADOPTOPENJDK" == "8" && "$TRAVIS_SCALA_VERSION" =~ ^0\.[0-9]+\..*$ ]]; then - true - else - false - fi -} - -# For tags that define a Scala.js version, we pick the jobs of one Scala.js version (1.0.0) to do the releases -isTagScalaJsReleaseJob() { - if [[ "$ADOPTOPENJDK" == "8" && "$SCALAJS_VERSION" =~ ^1\.0\.0(-[A-Za-z0-9-]+)?$ ]]; then + if [[ "$ADOPTOPENJDK" == "8" ]]; then true else false @@ -52,28 +32,13 @@ else fi verPat="[0-9]+\.[0-9]+\.[0-9]+(-[A-Za-z0-9-]+)?" -tagPat="^v$verPat(#(sjs_)?$verPat)?$" +tagPat="^v$verPat(#.*)?$" if [[ "$TRAVIS_TAG" =~ $tagPat ]]; then releaseTask="ci-release" - tagScalaVer=$(echo $TRAVIS_TAG | sed s/[^#]*// | sed s/^#//) - if [[ "$tagScalaVer" == "" ]]; then - if ! isReleaseJob; then - echo "Not releasing on Java $ADOPTOPENJDK with Scala $TRAVIS_SCALA_VERSION" - exit 0 - fi - elif [[ "$tagScalaVer" == "sjs_$SCALAJS_VERSION" ]]; then - if ! isTagScalaJsReleaseJob; then - echo "The releases for Scala.js $tagScalaVer are built by other jobs in the travis job matrix" - exit 0 - fi - else - if isTagScalaReleaseJob; then - setTagScalaVersion='set every scalaVersion := "'$tagScalaVer'"' - else - echo "The releases for Scala $tagScalaVer are built by other jobs in the travis job matrix" - exit 0 - fi + if ! isReleaseJob; then + echo "Not releasing on Java $ADOPTOPENJDK with Scala $TRAVIS_SCALA_VERSION" + exit 0 fi fi @@ -86,4 +51,4 @@ export CI_SNAPSHOT_RELEASE="$projectPrefix/publish" # for now, until we're confident in the new release scripts, just close the staging repo. export CI_SONATYPE_RELEASE="; sonatypePrepare; sonatypeBundleUpload; sonatypeClose" -sbt "$setTagScalaVersion" clean $projectPrefix/test $projectPrefix/publishLocal $releaseTask +sbt clean $projectPrefix/test $projectPrefix/publishLocal $releaseTask From 5927db339b944b9317bda2226f132daa5f276947 Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Fri, 6 Mar 2020 20:32:56 +0100 Subject: [PATCH 424/789] Update sbt-scalajs to 1.0.1 --- .circleci/config.yml | 4 ++-- .travis.yml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index a8f93adfc..50d46720b 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -139,8 +139,8 @@ workflows: - scalajs_job: name: sjs1.0_2.12 scala_version: 2.12.10 - scalajs_version: 1.0.0 + scalajs_version: 1.0.1 - scalajs_job: name: sjs1.0_2.13 scala_version: 2.13.1 - scalajs_version: 1.0.0 + scalajs_version: 1.0.1 diff --git a/.travis.yml b/.travis.yml index 005996ea0..0aefdf0bd 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,7 +12,7 @@ scala: env: - SCALAJS_VERSION= ADOPTOPENJDK=8 - SCALAJS_VERSION=0.6.32 ADOPTOPENJDK=8 - - SCALAJS_VERSION=1.0.0 ADOPTOPENJDK=8 + - SCALAJS_VERSION=1.0.1 ADOPTOPENJDK=8 - SCALAJS_VERSION= ADOPTOPENJDK=11 - SCALAJS_VERSION= ADOPTOPENJDK=13 @@ -21,7 +21,7 @@ matrix: - scala: 0.22.0-RC1 env: SCALAJS_VERSION=0.6.32 ADOPTOPENJDK=8 - scala: 0.22.0-RC1 - env: SCALAJS_VERSION=1.0.0 ADOPTOPENJDK=8 + env: SCALAJS_VERSION=1.0.1 ADOPTOPENJDK=8 install: - git fetch --tags # get all tags for sbt-dynver From 07d067d02dfb65aa552b7e09fc852805c76769e6 Mon Sep 17 00:00:00 2001 From: Philippus Date: Sun, 8 Mar 2020 11:26:53 +0100 Subject: [PATCH 425/789] Exclude version 1.0.1 for mima --- build.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index 99452683a..69e61898a 100644 --- a/build.sbt +++ b/build.sbt @@ -43,7 +43,7 @@ lazy val xml = crossProject(JSPlatform, JVMPlatform) scalacOptions in Test += "-Xxml:coalescing", scalaModuleMimaPreviousVersion := { - if (System.getenv("SCALAJS_VERSION") == "1.0.0") None // No such release yet + if (List("1.0.0", "1.0.1").contains(System.getenv("SCALAJS_VERSION"))) None // No such release yet else Some("1.2.0") }, mimaBinaryIssueFilters ++= { From c60de43c42bac9119d0868566e1e9b26425fa3e4 Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Mon, 16 Mar 2020 13:44:01 -0400 Subject: [PATCH 426/789] Update to Scala.js 1.0.1 --- .travis.yml | 4 ++-- build.sbt | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 746c7cac9..9c90c4644 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,7 +12,7 @@ scala: env: - SCALAJS_VERSION= ADOPTOPENJDK=8 - SCALAJS_VERSION=0.6.32 ADOPTOPENJDK=8 - - SCALAJS_VERSION=1.0.0 ADOPTOPENJDK=8 + - SCALAJS_VERSION=1.0.1 ADOPTOPENJDK=8 - SCALAJS_VERSION= ADOPTOPENJDK=11 matrix: @@ -20,7 +20,7 @@ matrix: - scala: 2.11.12 env: SCALAJS_VERSION=0.6.32 ADOPTOPENJDK=8 - scala: 2.11.12 - env: SCALAJS_VERSION=1.0.0 ADOPTOPENJDK=8 + env: SCALAJS_VERSION=1.0.1 ADOPTOPENJDK=8 install: - git fetch --tags # get all tags for sbt-dynver diff --git a/build.sbt b/build.sbt index 79c8fd10c..a35583347 100644 --- a/build.sbt +++ b/build.sbt @@ -15,7 +15,7 @@ lazy val xml = crossProject(JSPlatform, JVMPlatform) scalacOptions in Test += "-Xxml:coalescing", scalaModuleMimaPreviousVersion := { - if (System.getenv("SCALAJS_VERSION") == "1.0.0") None + if (System.getenv("SCALAJS_VERSION") == "1.0.1") None else Some("1.2.0") }, From a412cfcf4c077a33834170d42713eb6e885c5d44 Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Mon, 16 Mar 2020 21:18:57 -0400 Subject: [PATCH 427/789] Add artifact to Mima for Scala.js --- build.sbt | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/build.sbt b/build.sbt index 69e61898a..684714ad9 100644 --- a/build.sbt +++ b/build.sbt @@ -43,8 +43,9 @@ lazy val xml = crossProject(JSPlatform, JVMPlatform) scalacOptions in Test += "-Xxml:coalescing", scalaModuleMimaPreviousVersion := { - if (List("1.0.0", "1.0.1").contains(System.getenv("SCALAJS_VERSION"))) None // No such release yet - else Some("1.2.0") + if (isDotty.value) None // No such release yet + // else if (System.getenv("SCALAJS_VERSION") == "1.0.0") None + else Some("1.3.0") }, mimaBinaryIssueFilters ++= { import com.typesafe.tools.mima.core._ @@ -161,6 +162,8 @@ lazy val xml = crossProject(JSPlatform, JVMPlatform) } ) .jsSettings( + // The config for Travis has an exclude, but sbt-travisci doesn't catch it. + crossScalaVersions -= "0.22.0-RC1", // Scala.js cannot run forked tests fork in Test := false ) From 689b6e9ceda41534194be803cdcf51b871fcbe68 Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Mon, 16 Mar 2020 21:58:43 -0400 Subject: [PATCH 428/789] Fix name of Dotty build in Circle --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 50d46720b..de642011b 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -89,7 +89,7 @@ workflows: java_version: jdk8 scala_version: 2.13.1 - scala_job: - name: dotty-0.21 + name: dotty-0.22 java_version: jdk8 scala_version: 0.22.0-RC1 - scala_job: From b771a4583884d8038b804c7b4613e003be235d04 Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Mon, 16 Mar 2020 23:20:34 -0400 Subject: [PATCH 429/789] Add more related projects to README --- README.md | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 974bdb4dc..117192b8f 100644 --- a/README.md +++ b/README.md @@ -37,6 +37,15 @@ The XML spec has some features that are best turned off, to avoid unsavory thing ## Related projects -These Projects build upon this library and increase the functionality in different ways. - - [Advxml](https://github.com/geirolz/advxml) - A lightweight, functional library combining scala-xml with cats-core - - [ezXML](https://github.com/JulienSt/ezXML) - This project aims to make working with scala-xml less cumbersome +- [Advxml](https://github.com/geirolz/advxml) - Functional library combining scala-xml with cats-core +- [Binding.scala](https://github.com/ThoughtWorksInc/Binding.scala) - Reactive programming library +- [ezXML](https://github.com/JulienSt/ezXML) - Extensions for traverse, encoding, decoding and mapping XML +- [http4s-scala-xml](https://http4s.org/v0.21/entity/) - XML literal support in http4s +- [Json4s XML](https://github.com/json4s/json4s) - Conversion to and from JSON +- [monadic-html](https://github.com/OlivierBlanvillain/monadic-html) - DOM-like event-based programming with XHTML +- [scalaxb](http://scalaxb.org/) - XML data binding, serialization, SOAP and WSDL support +- [ScalaTags](https://github.com/lihaoyi/scalatags) - Alternative syntax for XML literals +- [scala-xml-dotty](https://github.com/felixmulder/scala-xml-dotty) - Macro library for XML literals in Dotty +- [xtract](https://github.com/lucidsoftware/xtract) - A library for deserializing XML + +See also the "XML" section of [Awesome Scala](https://github.com/lauris/awesome-scala). From 63d3c8f4f0ac162217eff8804339c51b04464f9e Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Mon, 16 Mar 2020 23:38:03 -0400 Subject: [PATCH 430/789] Fix lint warnings --- jvm/src/test/scala-2.x/scala/xml/XMLTestJVM2x.scala | 10 ---------- .../src/test/scala-2.x/scala/xml/ShouldCompile.scala | 3 --- shared/src/test/scala-2.x/scala/xml/XMLTest2x.scala | 8 -------- shared/src/test/scala/scala/xml/XMLTest.scala | 3 ++- 4 files changed, 2 insertions(+), 22 deletions(-) diff --git a/jvm/src/test/scala-2.x/scala/xml/XMLTestJVM2x.scala b/jvm/src/test/scala-2.x/scala/xml/XMLTestJVM2x.scala index 40bf56184..8a66a07e7 100644 --- a/jvm/src/test/scala-2.x/scala/xml/XMLTestJVM2x.scala +++ b/jvm/src/test/scala-2.x/scala/xml/XMLTestJVM2x.scala @@ -1,18 +1,8 @@ package scala.xml -import language.postfixOps - import org.junit.{Test => UnitTest} -import org.junit.Assert.assertTrue -import org.junit.Assert.assertFalse import org.junit.Assert.assertEquals import scala.xml.parsing.ConstructingParser -import java.io.StringWriter -import java.io.ByteArrayOutputStream -import java.io.StringReader -import scala.collection.Iterable -import scala.collection.Seq -import scala.xml.Utility.sort class XMLTestJVM2x { @UnitTest diff --git a/shared/src/test/scala-2.x/scala/xml/ShouldCompile.scala b/shared/src/test/scala-2.x/scala/xml/ShouldCompile.scala index d1aab6826..2a0d621c8 100644 --- a/shared/src/test/scala-2.x/scala/xml/ShouldCompile.scala +++ b/shared/src/test/scala-2.x/scala/xml/ShouldCompile.scala @@ -3,9 +3,6 @@ package scala.xml // these tests depend on xml, so they ended up here, // though really they are compiler tests -import scala.collection._ -import scala.collection.mutable.ArrayBuffer - // t1626 object o { val n = diff --git a/shared/src/test/scala-2.x/scala/xml/XMLTest2x.scala b/shared/src/test/scala-2.x/scala/xml/XMLTest2x.scala index aa01266fa..c7e39b93a 100644 --- a/shared/src/test/scala-2.x/scala/xml/XMLTest2x.scala +++ b/shared/src/test/scala-2.x/scala/xml/XMLTest2x.scala @@ -4,15 +4,7 @@ import language.postfixOps import org.junit.{Test => UnitTest} import org.junit.Assert.assertTrue -import org.junit.Assert.assertFalse import org.junit.Assert.assertEquals -import scala.xml.parsing.ConstructingParser -import java.io.StringWriter -import java.io.ByteArrayOutputStream -import java.io.StringReader -import scala.collection.Iterable -import scala.collection.Seq -import scala.xml.Utility.sort class XMLTest2x { // t-486 diff --git a/shared/src/test/scala/scala/xml/XMLTest.scala b/shared/src/test/scala/scala/xml/XMLTest.scala index 7644ac645..11fda53f9 100644 --- a/shared/src/test/scala/scala/xml/XMLTest.scala +++ b/shared/src/test/scala/scala/xml/XMLTest.scala @@ -538,7 +538,8 @@ Ours is the portal of hope, come as you are." @UnitTest def i1976: Unit = { - val node = { "whatever " } + val node = { "whatever " } + assertEquals("whatever", node.child.text) } @UnitTest From 226c1afb3af055c8014a71364135ca5e75751286 Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Mon, 16 Mar 2020 23:51:34 -0400 Subject: [PATCH 431/789] Fix lint warnings (cont.) --- shared/src/test/scala/scala/xml/XMLTest.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shared/src/test/scala/scala/xml/XMLTest.scala b/shared/src/test/scala/scala/xml/XMLTest.scala index 11fda53f9..c00c5aead 100644 --- a/shared/src/test/scala/scala/xml/XMLTest.scala +++ b/shared/src/test/scala/scala/xml/XMLTest.scala @@ -539,7 +539,7 @@ Ours is the portal of hope, come as you are." @UnitTest def i1976: Unit = { val node = { "whatever " } - assertEquals("whatever", node.child.text) + assertEquals("whatever ", node.child.text) } @UnitTest From 541f75dfbe7e1cb94145ea358ccdbd527dc3b55b Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Wed, 18 Mar 2020 14:34:14 -0400 Subject: [PATCH 432/789] Update dotty 0.23.0-RC1 --- .circleci/config.yml | 10 +++++----- .travis.yml | 6 +++--- build.sbt | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index de642011b..7043a17a9 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -89,9 +89,9 @@ workflows: java_version: jdk8 scala_version: 2.13.1 - scala_job: - name: dotty-0.22 + name: dotty-0.23 java_version: jdk8 - scala_version: 0.22.0-RC1 + scala_version: 0.23.0-RC1 - scala_job: name: jdk11_2.12 java_version: jdk11 @@ -103,7 +103,7 @@ workflows: - scala_job: name: jdk11_dotty java_version: jdk11 - scala_version: 0.22.0-RC1 + scala_version: 0.23.0-RC1 - scala_job: name: jdk13_2.12 java_version: jdk13 @@ -115,7 +115,7 @@ workflows: - scala_job: name: jdk13_dotty java_version: jdk13 - scala_version: 0.22.0-RC1 + scala_version: 0.23.0-RC1 - scala_job: name: jdk14_2.12 java_version: jdk14 @@ -127,7 +127,7 @@ workflows: - scala_job: name: jdk14_dotty java_version: jdk14 - scala_version: 0.22.0-RC1 + scala_version: 0.23.0-RC1 - scalajs_job: name: sjs0.6_2.12 scala_version: 2.12.10 diff --git a/.travis.yml b/.travis.yml index 0aefdf0bd..7363ae39b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,7 +5,7 @@ import: scala/scala-dev:travis/default.yml language: scala scala: - - 0.22.0-RC1 + - 0.23.0-RC1 - 2.12.10 - 2.13.1 @@ -18,9 +18,9 @@ env: matrix: exclude: - - scala: 0.22.0-RC1 + - scala: 0.23.0-RC1 env: SCALAJS_VERSION=0.6.32 ADOPTOPENJDK=8 - - scala: 0.22.0-RC1 + - scala: 0.23.0-RC1 env: SCALAJS_VERSION=1.0.1 ADOPTOPENJDK=8 install: diff --git a/build.sbt b/build.sbt index 684714ad9..273de189b 100644 --- a/build.sbt +++ b/build.sbt @@ -163,7 +163,7 @@ lazy val xml = crossProject(JSPlatform, JVMPlatform) ) .jsSettings( // The config for Travis has an exclude, but sbt-travisci doesn't catch it. - crossScalaVersions -= "0.22.0-RC1", + crossScalaVersions -= "0.23.0-RC1", // Scala.js cannot run forked tests fork in Test := false ) From c17cd103c64d8e74bad15f311cd688b23236e088 Mon Sep 17 00:00:00 2001 From: Daniel Sobral Date: Fri, 20 Mar 2020 18:53:53 -0600 Subject: [PATCH 433/789] Make RuleTranformer fully recursive [#257] RuleTransformer for the past eleven years or more has first recursed, then applied the rewrite rules as it backed out of the recursion. That prevented rewrite rules from acting on changes of previous rules unless they recursed themselves. The workaround has always been chain rule transformers instead of calling one rule transformer with all the rules. This change basically re-implements RuleTransformer as that workaround, and introduces a NestingTransformer which does the nesting. Clearly, if you have N rules you'll now recurse N times instead of once, though each rule is still only applied once for each element. On the other hand, a RewriteRule that recursed would incur in exponential times, and now they don't need to. The original behavior has no reason to be. It didn't prevent rules from seeing each other changes, nor was it particularly concerned with performance. With API changes coming on 2.0, I believe this is the right time to introduce this change. --- .../xml/transform/NestingTransformer.scala | 19 +++++++++++++++++++ .../scala/xml/transform/RuleTransformer.scala | 7 +++++-- .../scala/xml/TransformersTest.scala | 17 ++++++++++++++++- 3 files changed, 40 insertions(+), 3 deletions(-) create mode 100644 shared/src/main/scala/scala/xml/transform/NestingTransformer.scala diff --git a/shared/src/main/scala/scala/xml/transform/NestingTransformer.scala b/shared/src/main/scala/scala/xml/transform/NestingTransformer.scala new file mode 100644 index 000000000..321e195b1 --- /dev/null +++ b/shared/src/main/scala/scala/xml/transform/NestingTransformer.scala @@ -0,0 +1,19 @@ +/* __ *\ +** ________ ___ / / ___ Scala API ** +** / __/ __// _ | / / / _ | (c) 2002-2020, LAMP/EPFL ** +** __\ \/ /__/ __ |/ /__/ __ | (c) 2011-2020, Lightbend, Inc. ** +** /____/\___/_/ |_/____/_/ | | http://scala-lang.org/ ** +** |/ ** +\* */ + +package scala +package xml +package transform + +import scala.collection.Seq + +class NestingTransformer(rule: RewriteRule) extends BasicTransformer { + override def transform(n: Node): Seq[Node] = { + rule.transform(super.transform(n)) + } +} diff --git a/shared/src/main/scala/scala/xml/transform/RuleTransformer.scala b/shared/src/main/scala/scala/xml/transform/RuleTransformer.scala index d8c1a56d0..b7e62644a 100644 --- a/shared/src/main/scala/scala/xml/transform/RuleTransformer.scala +++ b/shared/src/main/scala/scala/xml/transform/RuleTransformer.scala @@ -13,6 +13,9 @@ package transform import scala.collection.Seq class RuleTransformer(rules: RewriteRule*) extends BasicTransformer { - override def transform(n: Node): Seq[Node] = - rules.foldLeft(super.transform(n)) { (res, rule) => rule transform res } + private val transformers = rules.map(new NestingTransformer(_)) + override def transform(n: Node): Seq[Node] = { + if (transformers.isEmpty) n + else transformers.tail.foldLeft(transformers.head.transform(n)) { (res, transformer) => transformer.transform(res) } + } } diff --git a/shared/src/test/scala-2.x/scala/xml/TransformersTest.scala b/shared/src/test/scala-2.x/scala/xml/TransformersTest.scala index 59ca25240..f8c5b661a 100644 --- a/shared/src/test/scala-2.x/scala/xml/TransformersTest.scala +++ b/shared/src/test/scala-2.x/scala/xml/TransformersTest.scala @@ -60,7 +60,7 @@ class TransformersTest { @Test def preserveReferentialComplexityInLinearComplexity = { // SI-4528 var i = 0 - + val xmlNode =

Hello Example

new RuleTransformer(new RewriteRule { @@ -77,4 +77,19 @@ class TransformersTest { assertEquals(1, i) } + + @Test + def appliesRulesRecursivelyOnPreviousChanges = { // #257 + def add(outer: Elem, inner: Node) = new RewriteRule { + override def transform(n: Node): Seq[Node] = n match { + case e: Elem if e.label == outer.label => e.copy(child = e.child ++ inner) + case other => other + } + } + + def transformer = new RuleTransformer(add(, ), add(, )) + + assertEquals(, transformer()) + } } + From 49d276e96ac3ab9cb43a8425f3ef6810a31d6f97 Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Fri, 27 Mar 2020 19:21:46 +0100 Subject: [PATCH 434/789] Update commons-lang3 to 3.10 --- build.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index 684714ad9..175f2c252 100644 --- a/build.sbt +++ b/build.sbt @@ -153,7 +153,7 @@ lazy val xml = crossProject(JSPlatform, JVMPlatform) libraryDependencies += "junit" % "junit" % "4.13" % Test, libraryDependencies += "com.novocode" % "junit-interface" % "0.11" % Test, - libraryDependencies += "org.apache.commons" % "commons-lang3" % "3.9" % Test, + libraryDependencies += "org.apache.commons" % "commons-lang3" % "3.10" % Test, libraryDependencies ++= { if (isDotty.value) Seq() From 9244022f1510f5a9d9f7736cd43d40ba834e5933 Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Tue, 31 Mar 2020 20:16:15 +0200 Subject: [PATCH 435/789] Update sbt to 1.3.9 --- project/build.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/build.properties b/project/build.properties index a919a9b5f..06703e34d 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version=1.3.8 +sbt.version=1.3.9 From 3650c0e579e251f95cebebcb80f1684610faea38 Mon Sep 17 00:00:00 2001 From: Scala Steward <43047562+scala-steward@users.noreply.github.com> Date: Wed, 15 Apr 2020 15:47:22 +0200 Subject: [PATCH 436/789] Update sbt to 1.3.10 (#425) --- project/build.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/build.properties b/project/build.properties index 06703e34d..797e7ccfd 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version=1.3.9 +sbt.version=1.3.10 From 9e148eb51887a984ce06244dbd09974efc7690b6 Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Wed, 15 Apr 2020 21:56:02 +0200 Subject: [PATCH 437/789] Update sbt-scala-module to 2.1.4 --- project/plugins.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/plugins.sbt b/project/plugins.sbt index cf01f136d..b7f5c84ef 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,7 +1,7 @@ val scalaJSVersion = Option(System.getenv("SCALAJS_VERSION")).filter(_.nonEmpty).getOrElse("0.6.32") -addSbtPlugin("org.scala-lang.modules" % "sbt-scala-module" % "2.1.3") +addSbtPlugin("org.scala-lang.modules" % "sbt-scala-module" % "2.1.4") addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.0.0") addSbtPlugin("org.scala-js" % "sbt-scalajs" % scalaJSVersion) addSbtPlugin("ch.epfl.lamp" % "sbt-dotty" % "0.4.0") From f0b1befde4f9f4cee21090c4052dea487c5e89e9 Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Thu, 16 Apr 2020 18:57:26 +0200 Subject: [PATCH 438/789] Update sbt-scala-module to 2.2.0 --- build.sbt | 2 +- project/plugins.sbt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/build.sbt b/build.sbt index 50fb2122f..c13c9caea 100644 --- a/build.sbt +++ b/build.sbt @@ -25,7 +25,7 @@ lazy val xml = crossProject(JSPlatform, JVMPlatform) .crossType(CrossType.Full) .in(file(".")) .settings(ScalaModulePlugin.scalaModuleSettings) - .jvmSettings(ScalaModulePlugin.scalaModuleSettingsJVM) + .jvmSettings(ScalaModulePlugin.scalaModuleOsgiSettings) .settings( name := "scala-xml", diff --git a/project/plugins.sbt b/project/plugins.sbt index b7f5c84ef..6f6c22458 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,7 +1,7 @@ val scalaJSVersion = Option(System.getenv("SCALAJS_VERSION")).filter(_.nonEmpty).getOrElse("0.6.32") -addSbtPlugin("org.scala-lang.modules" % "sbt-scala-module" % "2.1.4") +addSbtPlugin("org.scala-lang.modules" % "sbt-scala-module" % "2.2.0") addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.0.0") addSbtPlugin("org.scala-js" % "sbt-scalajs" % scalaJSVersion) addSbtPlugin("ch.epfl.lamp" % "sbt-dotty" % "0.4.0") From 316e1f0ec1bbd59aa4e1b5348b5b78d49b1b76e8 Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Tue, 12 May 2020 19:44:01 +0200 Subject: [PATCH 439/789] Update sbt-scalajs to 0.6.33 --- .circleci/config.yml | 6 +++--- .travis.yml | 4 ++-- project/plugins.sbt | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 7043a17a9..b3ba5d538 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -65,7 +65,7 @@ jobs: type: string scalajs_version: description: "ScalaJS version" - default: 0.6.32 + default: 0.6.33 type: string environment: SCALAJS_VERSION: << parameters.scalajs_version >> @@ -131,11 +131,11 @@ workflows: - scalajs_job: name: sjs0.6_2.12 scala_version: 2.12.10 - scalajs_version: 0.6.32 + scalajs_version: 0.6.33 - scalajs_job: name: sjs0.6_2.13 scala_version: 2.13.1 - scalajs_version: 0.6.32 + scalajs_version: 0.6.33 - scalajs_job: name: sjs1.0_2.12 scala_version: 2.12.10 diff --git a/.travis.yml b/.travis.yml index 7363ae39b..21f130d58 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,7 +11,7 @@ scala: env: - SCALAJS_VERSION= ADOPTOPENJDK=8 - - SCALAJS_VERSION=0.6.32 ADOPTOPENJDK=8 + - SCALAJS_VERSION=0.6.33 ADOPTOPENJDK=8 - SCALAJS_VERSION=1.0.1 ADOPTOPENJDK=8 - SCALAJS_VERSION= ADOPTOPENJDK=11 - SCALAJS_VERSION= ADOPTOPENJDK=13 @@ -19,7 +19,7 @@ env: matrix: exclude: - scala: 0.23.0-RC1 - env: SCALAJS_VERSION=0.6.32 ADOPTOPENJDK=8 + env: SCALAJS_VERSION=0.6.33 ADOPTOPENJDK=8 - scala: 0.23.0-RC1 env: SCALAJS_VERSION=1.0.1 ADOPTOPENJDK=8 diff --git a/project/plugins.sbt b/project/plugins.sbt index 6f6c22458..0e4eb1c41 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,5 +1,5 @@ val scalaJSVersion = - Option(System.getenv("SCALAJS_VERSION")).filter(_.nonEmpty).getOrElse("0.6.32") + Option(System.getenv("SCALAJS_VERSION")).filter(_.nonEmpty).getOrElse("0.6.33") addSbtPlugin("org.scala-lang.modules" % "sbt-scala-module" % "2.2.0") addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.0.0") From faa59619f1ad13d9b5c820ec2bf2b1fd09ee93c5 Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Sun, 31 May 2020 04:54:33 +0200 Subject: [PATCH 440/789] Update sbt to 1.3.12 --- project/build.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/build.properties b/project/build.properties index 797e7ccfd..654fe70c4 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version=1.3.10 +sbt.version=1.3.12 From 166d9ade7248cfcd08dc27f0693faf8a3004fb72 Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Mon, 1 Jun 2020 14:54:50 -0400 Subject: [PATCH 441/789] Latest stable release is 1.3.0 --- README.md | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 117192b8f..33edf2520 100644 --- a/README.md +++ b/README.md @@ -14,9 +14,9 @@ API documentation is available [here](https://scala.github.io/scala-xml/api/1.2. How to documentation is available in the [wiki](https://github.com/scala/scala-xml/wiki) -The latest stable release of Scala XML is 1.2.0. +The latest stable release of Scala XML is 1.3.0. -Milestone releases of Scala XML version 2.0 are available, starting with 2.0.0-M1. See the changes for 2.0 in `CHANGELOG.md`. +Experimental milestone releases of Scala XML version 2.0 are available, starting with 2.0.0-M1. See the changes for 2.0 in `CHANGELOG.md`. ## Maintenance status @@ -47,5 +47,8 @@ The XML spec has some features that are best turned off, to avoid unsavory thing - [ScalaTags](https://github.com/lihaoyi/scalatags) - Alternative syntax for XML literals - [scala-xml-dotty](https://github.com/felixmulder/scala-xml-dotty) - Macro library for XML literals in Dotty - [xtract](https://github.com/lucidsoftware/xtract) - A library for deserializing XML +https://github.com/TinkoffCreditSystems/phobos +https://github.com/dylemma/xml-spac +https://github.com/ScalaWilliam/xs4s See also the "XML" section of [Awesome Scala](https://github.com/lauris/awesome-scala). From c838c1a7e6c76ae0c0f50648d179bfb54985dbf7 Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Mon, 1 Jun 2020 15:01:09 -0400 Subject: [PATCH 442/789] Add more related projects --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 33edf2520..a829f2b89 100644 --- a/README.md +++ b/README.md @@ -43,12 +43,12 @@ The XML spec has some features that are best turned off, to avoid unsavory thing - [http4s-scala-xml](https://http4s.org/v0.21/entity/) - XML literal support in http4s - [Json4s XML](https://github.com/json4s/json4s) - Conversion to and from JSON - [monadic-html](https://github.com/OlivierBlanvillain/monadic-html) - DOM-like event-based programming with XHTML +- [phobos](https://github.com/TinkoffCreditSystems/phobos) - Data-binding library based on stream parsing using Aalto XML - [scalaxb](http://scalaxb.org/) - XML data binding, serialization, SOAP and WSDL support - [ScalaTags](https://github.com/lihaoyi/scalatags) - Alternative syntax for XML literals - [scala-xml-dotty](https://github.com/felixmulder/scala-xml-dotty) - Macro library for XML literals in Dotty +- [XML SPaC](https://github.com/dylemma/xml-spac) - Streaming event-based parser combinators +- [xs4s](https://github.com/ScalaWilliam/xs4s) - XML streaming for Scala - [xtract](https://github.com/lucidsoftware/xtract) - A library for deserializing XML -https://github.com/TinkoffCreditSystems/phobos -https://github.com/dylemma/xml-spac -https://github.com/ScalaWilliam/xs4s See also the "XML" section of [Awesome Scala](https://github.com/lauris/awesome-scala). From c4bb82236bff985da619d858f8565b9dfa354355 Mon Sep 17 00:00:00 2001 From: Scala Steward <43047562+scala-steward@users.noreply.github.com> Date: Thu, 25 Jun 2020 21:51:59 +0200 Subject: [PATCH 443/789] Update sbt-dotty to 0.4.1 (#424) the main change seems to be lampepfl/dotty#8653 --- project/plugins.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/plugins.sbt b/project/plugins.sbt index 0e4eb1c41..b61a0b599 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -4,4 +4,4 @@ val scalaJSVersion = addSbtPlugin("org.scala-lang.modules" % "sbt-scala-module" % "2.2.0") addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.0.0") addSbtPlugin("org.scala-js" % "sbt-scalajs" % scalaJSVersion) -addSbtPlugin("ch.epfl.lamp" % "sbt-dotty" % "0.4.0") +addSbtPlugin("ch.epfl.lamp" % "sbt-dotty" % "0.4.1") From 0db3a924050db5647839cb76842e31cce640b578 Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Sun, 28 Jun 2020 02:51:50 +0200 Subject: [PATCH 444/789] Update sbt to 1.3.13 --- project/build.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/build.properties b/project/build.properties index 654fe70c4..0837f7a13 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version=1.3.12 +sbt.version=1.3.13 From e534b688d28ac814c63576ff349b37db784215e2 Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Thu, 16 Jul 2020 17:20:04 +0200 Subject: [PATCH 445/789] Update commons-lang3 to 3.11 --- build.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index c13c9caea..228b35378 100644 --- a/build.sbt +++ b/build.sbt @@ -153,7 +153,7 @@ lazy val xml = crossProject(JSPlatform, JVMPlatform) libraryDependencies += "junit" % "junit" % "4.13" % Test, libraryDependencies += "com.novocode" % "junit-interface" % "0.11" % Test, - libraryDependencies += "org.apache.commons" % "commons-lang3" % "3.10" % Test, + libraryDependencies += "org.apache.commons" % "commons-lang3" % "3.11" % Test, libraryDependencies ++= { if (isDotty.value) Seq() From c79152ce11a694080a3603e78cd25c6a0d16e6e0 Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Thu, 27 Aug 2020 20:57:10 +0200 Subject: [PATCH 446/789] Update sbt-dotty to 0.4.2 --- project/plugins.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/plugins.sbt b/project/plugins.sbt index b61a0b599..0bae7a232 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -4,4 +4,4 @@ val scalaJSVersion = addSbtPlugin("org.scala-lang.modules" % "sbt-scala-module" % "2.2.0") addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.0.0") addSbtPlugin("org.scala-js" % "sbt-scalajs" % scalaJSVersion) -addSbtPlugin("ch.epfl.lamp" % "sbt-dotty" % "0.4.1") +addSbtPlugin("ch.epfl.lamp" % "sbt-dotty" % "0.4.2") From 03755cf9f20d6591ed7d447b9762772f5908d7d7 Mon Sep 17 00:00:00 2001 From: David Strawn Date: Sun, 6 Sep 2020 11:31:05 -0600 Subject: [PATCH 447/789] Update For Dotty 0.27.0-RC1 The only changes where some ambiguous references to symbols. --- .circleci/config.yml | 10 +++++----- .travis.yml | 6 +++--- build.sbt | 2 +- jvm/src/test/scala/scala/xml/XMLTest.scala | 2 +- .../main/scala/scala/xml/parsing/MarkupParser.scala | 2 +- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index b3ba5d538..c19e71ba3 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -89,9 +89,9 @@ workflows: java_version: jdk8 scala_version: 2.13.1 - scala_job: - name: dotty-0.23 + name: dotty-0.27.0-RC1 java_version: jdk8 - scala_version: 0.23.0-RC1 + scala_version: 0.27.0-RC1 - scala_job: name: jdk11_2.12 java_version: jdk11 @@ -103,7 +103,7 @@ workflows: - scala_job: name: jdk11_dotty java_version: jdk11 - scala_version: 0.23.0-RC1 + scala_version: 0.27.0-RC1 - scala_job: name: jdk13_2.12 java_version: jdk13 @@ -115,7 +115,7 @@ workflows: - scala_job: name: jdk13_dotty java_version: jdk13 - scala_version: 0.23.0-RC1 + scala_version: 0.27.0-RC1 - scala_job: name: jdk14_2.12 java_version: jdk14 @@ -127,7 +127,7 @@ workflows: - scala_job: name: jdk14_dotty java_version: jdk14 - scala_version: 0.23.0-RC1 + scala_version: 0.27.0-RC1 - scalajs_job: name: sjs0.6_2.12 scala_version: 2.12.10 diff --git a/.travis.yml b/.travis.yml index 21f130d58..5876bfbd9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,7 +5,7 @@ import: scala/scala-dev:travis/default.yml language: scala scala: - - 0.23.0-RC1 + - 0.27.0-RC1 - 2.12.10 - 2.13.1 @@ -18,9 +18,9 @@ env: matrix: exclude: - - scala: 0.23.0-RC1 + - scala: 0.27.0-RC1 env: SCALAJS_VERSION=0.6.33 ADOPTOPENJDK=8 - - scala: 0.23.0-RC1 + - scala: 0.27.0-RC1 env: SCALAJS_VERSION=1.0.1 ADOPTOPENJDK=8 install: diff --git a/build.sbt b/build.sbt index 228b35378..eb817b708 100644 --- a/build.sbt +++ b/build.sbt @@ -163,7 +163,7 @@ lazy val xml = crossProject(JSPlatform, JVMPlatform) ) .jsSettings( // The config for Travis has an exclude, but sbt-travisci doesn't catch it. - crossScalaVersions -= "0.23.0-RC1", + crossScalaVersions -= "0.27.0-RC1", // Scala.js cannot run forked tests fork in Test := false ) diff --git a/jvm/src/test/scala/scala/xml/XMLTest.scala b/jvm/src/test/scala/scala/xml/XMLTest.scala index 26336807f..0ccbc0767 100644 --- a/jvm/src/test/scala/scala/xml/XMLTest.scala +++ b/jvm/src/test/scala/scala/xml/XMLTest.scala @@ -35,7 +35,7 @@ class XMLTestJVM { val c = new Node { def label = "hello" override def hashCode() = - Utility.hashCode(prefix, label, attributes.hashCode(), scope.hashCode(), child); + Utility.hashCode(prefix, label, this.attributes.hashCode(), scope.hashCode(), child); def child = Elem(null, "world", e, sc); //def attributes = e; override def text = "" diff --git a/shared/src/main/scala/scala/xml/parsing/MarkupParser.scala b/shared/src/main/scala/scala/xml/parsing/MarkupParser.scala index 66ceb4c78..545abdbcf 100755 --- a/shared/src/main/scala/scala/xml/parsing/MarkupParser.scala +++ b/shared/src/main/scala/scala/xml/parsing/MarkupParser.scala @@ -548,7 +548,7 @@ trait MarkupParser extends MarkupParserCommon with TokenTests { } xToken('>') this.dtd = new DTD { - /*override var*/ externalID = extID + this.externalID = extID /*override val */ decls = handle.decls.reverse } //this.dtd.initializeEntities(); From d85e3f7524c6d7f198fb40df66e91c9b12f9de43 Mon Sep 17 00:00:00 2001 From: Philippus Date: Mon, 7 Sep 2020 07:47:39 +0200 Subject: [PATCH 448/789] Drop support for scala.js 0.6.x --- .circleci/config.yml | 10 +--------- .travis.yml | 3 --- project/plugins.sbt | 2 +- 3 files changed, 2 insertions(+), 13 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index c19e71ba3..b0721c5ac 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -65,7 +65,7 @@ jobs: type: string scalajs_version: description: "ScalaJS version" - default: 0.6.33 + default: 1.0.1 type: string environment: SCALAJS_VERSION: << parameters.scalajs_version >> @@ -128,14 +128,6 @@ workflows: name: jdk14_dotty java_version: jdk14 scala_version: 0.27.0-RC1 - - scalajs_job: - name: sjs0.6_2.12 - scala_version: 2.12.10 - scalajs_version: 0.6.33 - - scalajs_job: - name: sjs0.6_2.13 - scala_version: 2.13.1 - scalajs_version: 0.6.33 - scalajs_job: name: sjs1.0_2.12 scala_version: 2.12.10 diff --git a/.travis.yml b/.travis.yml index 5876bfbd9..5a824fbd8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,15 +11,12 @@ scala: env: - SCALAJS_VERSION= ADOPTOPENJDK=8 - - SCALAJS_VERSION=0.6.33 ADOPTOPENJDK=8 - SCALAJS_VERSION=1.0.1 ADOPTOPENJDK=8 - SCALAJS_VERSION= ADOPTOPENJDK=11 - SCALAJS_VERSION= ADOPTOPENJDK=13 matrix: exclude: - - scala: 0.27.0-RC1 - env: SCALAJS_VERSION=0.6.33 ADOPTOPENJDK=8 - scala: 0.27.0-RC1 env: SCALAJS_VERSION=1.0.1 ADOPTOPENJDK=8 diff --git a/project/plugins.sbt b/project/plugins.sbt index 0bae7a232..8169ee3d7 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,5 +1,5 @@ val scalaJSVersion = - Option(System.getenv("SCALAJS_VERSION")).filter(_.nonEmpty).getOrElse("0.6.33") + Option(System.getenv("SCALAJS_VERSION")).filter(_.nonEmpty).getOrElse("1.0.1") addSbtPlugin("org.scala-lang.modules" % "sbt-scala-module" % "2.2.0") addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.0.0") From 5f2f39d005c61bda170a5d9e1e66f6ce4da57435 Mon Sep 17 00:00:00 2001 From: Philippus Date: Mon, 7 Sep 2020 07:48:52 +0200 Subject: [PATCH 449/789] Update scala.js to 1.1.1 --- .circleci/config.yml | 6 +++--- .travis.yml | 4 ++-- project/plugins.sbt | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index b0721c5ac..19f59f858 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -65,7 +65,7 @@ jobs: type: string scalajs_version: description: "ScalaJS version" - default: 1.0.1 + default: 1.1.1 type: string environment: SCALAJS_VERSION: << parameters.scalajs_version >> @@ -131,8 +131,8 @@ workflows: - scalajs_job: name: sjs1.0_2.12 scala_version: 2.12.10 - scalajs_version: 1.0.1 + scalajs_version: 1.1.1 - scalajs_job: name: sjs1.0_2.13 scala_version: 2.13.1 - scalajs_version: 1.0.1 + scalajs_version: 1.1.1 diff --git a/.travis.yml b/.travis.yml index 5a824fbd8..91175f816 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,14 +11,14 @@ scala: env: - SCALAJS_VERSION= ADOPTOPENJDK=8 - - SCALAJS_VERSION=1.0.1 ADOPTOPENJDK=8 + - SCALAJS_VERSION=1.1.1 ADOPTOPENJDK=8 - SCALAJS_VERSION= ADOPTOPENJDK=11 - SCALAJS_VERSION= ADOPTOPENJDK=13 matrix: exclude: - scala: 0.27.0-RC1 - env: SCALAJS_VERSION=1.0.1 ADOPTOPENJDK=8 + env: SCALAJS_VERSION=1.1.1 ADOPTOPENJDK=8 install: - git fetch --tags # get all tags for sbt-dynver diff --git a/project/plugins.sbt b/project/plugins.sbt index 8169ee3d7..46a45723d 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,5 +1,5 @@ val scalaJSVersion = - Option(System.getenv("SCALAJS_VERSION")).filter(_.nonEmpty).getOrElse("1.0.1") + Option(System.getenv("SCALAJS_VERSION")).filter(_.nonEmpty).getOrElse("1.1.1") addSbtPlugin("org.scala-lang.modules" % "sbt-scala-module" % "2.2.0") addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.0.0") From 74778d6244df7bf5d68e18b88c61b474fa7ce179 Mon Sep 17 00:00:00 2001 From: David Strawn Date: Sun, 6 Sep 2020 12:54:49 -0600 Subject: [PATCH 450/789] Fix Invalid Comment Edge Case According to [the XML specification](https://www.w3.org/TR/xml11//#IDA5CES "W3 XML") XML comments can not end in `--->`. Prior to this commit creating a comment of the form `Comment("invalid-")` would yield no error though it should, since it is rendered as ``. This commit makes such `String` values yield an `IllegalArgumentException`. A companion object was also added with two helper methods, `validated` and `validatedOpt`, which allow for a user of the library to check if a `String` is valid without having to `catch` the `IllegalArgumentException`. --- shared/src/main/scala/scala/xml/Comment.scala | 8 ++++- .../test/scala/scala/xml/CommentTest.scala | 30 +++++++++++++++++++ 2 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 shared/src/test/scala/scala/xml/CommentTest.scala diff --git a/shared/src/main/scala/scala/xml/Comment.scala b/shared/src/main/scala/scala/xml/Comment.scala index 011cd3565..de5dd4db4 100644 --- a/shared/src/main/scala/scala/xml/Comment.scala +++ b/shared/src/main/scala/scala/xml/Comment.scala @@ -14,6 +14,8 @@ package xml * * @author Burak Emir * @param commentText the text contained in this node, may not contain "--" + * and the final character may not be `-` to prevent a closing span of `-->` + * which is invalid. [[https://www.w3.org/TR/xml11//#IDA5CES]] */ case class Comment(commentText: String) extends SpecialNode { @@ -22,8 +24,12 @@ case class Comment(commentText: String) extends SpecialNode { final override def doCollectNamespaces = false final override def doTransform = false - if (commentText contains "--") + if (commentText.contains("--")) { throw new IllegalArgumentException("text contains \"--\"") + } + if (commentText.length > 0 && commentText.charAt(commentText.length - 1) == '-') { + throw new IllegalArgumentException("The final character of a XML comment may not be '-'. See https://www.w3.org/TR/xml11//#IDA5CES") + } /** * Appends "" to this string buffer. diff --git a/shared/src/test/scala/scala/xml/CommentTest.scala b/shared/src/test/scala/scala/xml/CommentTest.scala new file mode 100644 index 000000000..3e7d11470 --- /dev/null +++ b/shared/src/test/scala/scala/xml/CommentTest.scala @@ -0,0 +1,30 @@ +package scala.xml + +import org.junit.Assert.assertEquals +import org.junit.Assert.assertTrue +import org.junit.Test + +final class CommentTest { + + @Test(expected=classOf[IllegalArgumentException]) + def invalidCommentWithTwoDashes: Unit = { + Comment("invalid--comment") + } + + @Test(expected=classOf[IllegalArgumentException]) + def invalidCommentWithFinalDash: Unit = { + Comment("invalid comment-") + } + + @Test + def validCommentWithDash: Unit = { + val valid: String = "valid-comment" + assertEquals(s"", Comment(valid).toString) + } + + @Test + def validEmptyComment: Unit = { + val valid: String = "" + assertEquals(s"", Comment(valid).toString) + } +} From 71400bfdb6b1503ba5d4a4e7c5822582bcd04dfd Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Wed, 9 Sep 2020 01:36:15 +0200 Subject: [PATCH 451/789] Update sbt-scalajs, scalajs-compiler to 1.2.0 --- .circleci/config.yml | 4 ++-- .travis.yml | 4 ++-- project/plugins.sbt | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index c19e71ba3..5b298b9ec 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -131,11 +131,11 @@ workflows: - scalajs_job: name: sjs0.6_2.12 scala_version: 2.12.10 - scalajs_version: 0.6.33 + scalajs_version: 1.2.0 - scalajs_job: name: sjs0.6_2.13 scala_version: 2.13.1 - scalajs_version: 0.6.33 + scalajs_version: 1.2.0 - scalajs_job: name: sjs1.0_2.12 scala_version: 2.12.10 diff --git a/.travis.yml b/.travis.yml index 5876bfbd9..ee228df0e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,7 +11,7 @@ scala: env: - SCALAJS_VERSION= ADOPTOPENJDK=8 - - SCALAJS_VERSION=0.6.33 ADOPTOPENJDK=8 + - SCALAJS_VERSION=1.2.0 ADOPTOPENJDK=8 - SCALAJS_VERSION=1.0.1 ADOPTOPENJDK=8 - SCALAJS_VERSION= ADOPTOPENJDK=11 - SCALAJS_VERSION= ADOPTOPENJDK=13 @@ -19,7 +19,7 @@ env: matrix: exclude: - scala: 0.27.0-RC1 - env: SCALAJS_VERSION=0.6.33 ADOPTOPENJDK=8 + env: SCALAJS_VERSION=1.2.0 ADOPTOPENJDK=8 - scala: 0.27.0-RC1 env: SCALAJS_VERSION=1.0.1 ADOPTOPENJDK=8 diff --git a/project/plugins.sbt b/project/plugins.sbt index 0bae7a232..adacd6e86 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,5 +1,5 @@ val scalaJSVersion = - Option(System.getenv("SCALAJS_VERSION")).filter(_.nonEmpty).getOrElse("0.6.33") + Option(System.getenv("SCALAJS_VERSION")).filter(_.nonEmpty).getOrElse("1.2.0") addSbtPlugin("org.scala-lang.modules" % "sbt-scala-module" % "2.2.0") addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.0.0") From a7999ce4ae56822bbdf49de08ea850564ec42dc3 Mon Sep 17 00:00:00 2001 From: Scala Steward <43047562+scala-steward@users.noreply.github.com> Date: Tue, 15 Sep 2020 23:56:49 +0200 Subject: [PATCH 452/789] Update sbt-scala-module to 2.2.1 (#445) --- project/plugins.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/plugins.sbt b/project/plugins.sbt index 0bae7a232..2f245690e 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,7 +1,7 @@ val scalaJSVersion = Option(System.getenv("SCALAJS_VERSION")).filter(_.nonEmpty).getOrElse("0.6.33") -addSbtPlugin("org.scala-lang.modules" % "sbt-scala-module" % "2.2.0") +addSbtPlugin("org.scala-lang.modules" % "sbt-scala-module" % "2.2.1") addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.0.0") addSbtPlugin("org.scala-js" % "sbt-scalajs" % scalaJSVersion) addSbtPlugin("ch.epfl.lamp" % "sbt-dotty" % "0.4.2") From 57353cd5b94d62ee37fb189ed2ba1779eaf1d0c3 Mon Sep 17 00:00:00 2001 From: Seth Tisue Date: Tue, 15 Sep 2020 15:19:15 -0700 Subject: [PATCH 453/789] bump Scala, sbt, Scala.js versions --- .travis.yml | 8 ++++---- .../test/scala/scala/xml/CompilerErrors.scala | 16 +++++++++++----- project/build.properties | 2 +- project/plugins.sbt | 2 +- 4 files changed, 17 insertions(+), 11 deletions(-) diff --git a/.travis.yml b/.travis.yml index 9c90c4644..bef473398 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,19 +6,19 @@ language: scala scala: - 2.11.12 - - 2.12.10 - - 2.13.1 + - 2.12.12 + - 2.13.3 env: - SCALAJS_VERSION= ADOPTOPENJDK=8 - - SCALAJS_VERSION=0.6.32 ADOPTOPENJDK=8 + - SCALAJS_VERSION=0.6.33 ADOPTOPENJDK=8 - SCALAJS_VERSION=1.0.1 ADOPTOPENJDK=8 - SCALAJS_VERSION= ADOPTOPENJDK=11 matrix: exclude: - scala: 2.11.12 - env: SCALAJS_VERSION=0.6.32 ADOPTOPENJDK=8 + env: SCALAJS_VERSION=0.6.33 ADOPTOPENJDK=8 - scala: 2.11.12 env: SCALAJS_VERSION=1.0.1 ADOPTOPENJDK=8 diff --git a/jvm/src/test/scala/scala/xml/CompilerErrors.scala b/jvm/src/test/scala/scala/xml/CompilerErrors.scala index 6096e5a60..995fd64ed 100644 --- a/jvm/src/test/scala/scala/xml/CompilerErrors.scala +++ b/jvm/src/test/scala/scala/xml/CompilerErrors.scala @@ -4,14 +4,20 @@ import org.junit.Test class CompilerErrors extends CompilerTesting { @Test - def t7185() = - expectXmlError("""|overloaded method value apply with alternatives: - | (f: scala.xml.Node => Boolean)scala.xml.NodeSeq - | (i: Int)scala.xml.Node - | cannot be applied to ()""".stripMargin, + def t7185() = { + // the error message here differs a bit by Scala version + import util.Properties.versionNumberString + val thing = + if (versionNumberString.startsWith("2.11") || versionNumberString.startsWith("2.12")) "method value" + else "method" + expectXmlError(s"""|overloaded $thing apply with alternatives: + | (f: scala.xml.Node => Boolean)scala.xml.NodeSeq + | (i: Int)scala.xml.Node + | cannot be applied to ()""".stripMargin, """|object Test { | () |}""") + } @Test def t1878_typer() = diff --git a/project/build.properties b/project/build.properties index a919a9b5f..0837f7a13 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version=1.3.8 +sbt.version=1.3.13 diff --git a/project/plugins.sbt b/project/plugins.sbt index c7107fa52..2f2ad8e24 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,5 +1,5 @@ val scalaJSVersion = - Option(System.getenv("SCALAJS_VERSION")).filter(_.nonEmpty).getOrElse("0.6.32") + Option(System.getenv("SCALAJS_VERSION")).filter(_.nonEmpty).getOrElse("0.6.33") addSbtPlugin("org.scala-lang.modules" % "sbt-scala-module" % "2.1.3") addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.0.0") From feaeaa98805655a1475e53336919d0e8b70f0fb3 Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Wed, 16 Sep 2020 00:40:57 +0200 Subject: [PATCH 454/789] Update sbt-scalajs, scalajs-compiler to 1.2.0 --- .circleci/config.yml | 4 ++-- .travis.yml | 4 ++-- project/plugins.sbt | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 19f59f858..4f13c1147 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -131,8 +131,8 @@ workflows: - scalajs_job: name: sjs1.0_2.12 scala_version: 2.12.10 - scalajs_version: 1.1.1 + scalajs_version: 1.2.0 - scalajs_job: name: sjs1.0_2.13 scala_version: 2.13.1 - scalajs_version: 1.1.1 + scalajs_version: 1.2.0 diff --git a/.travis.yml b/.travis.yml index 91175f816..e468f2a11 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,14 +11,14 @@ scala: env: - SCALAJS_VERSION= ADOPTOPENJDK=8 - - SCALAJS_VERSION=1.1.1 ADOPTOPENJDK=8 + - SCALAJS_VERSION=1.2.0 ADOPTOPENJDK=8 - SCALAJS_VERSION= ADOPTOPENJDK=11 - SCALAJS_VERSION= ADOPTOPENJDK=13 matrix: exclude: - scala: 0.27.0-RC1 - env: SCALAJS_VERSION=1.1.1 ADOPTOPENJDK=8 + env: SCALAJS_VERSION=1.2.0 ADOPTOPENJDK=8 install: - git fetch --tags # get all tags for sbt-dynver diff --git a/project/plugins.sbt b/project/plugins.sbt index bb869249b..1c4ecad95 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,5 +1,5 @@ val scalaJSVersion = - Option(System.getenv("SCALAJS_VERSION")).filter(_.nonEmpty).getOrElse("1.1.1") + Option(System.getenv("SCALAJS_VERSION")).filter(_.nonEmpty).getOrElse("1.2.0") addSbtPlugin("org.scala-lang.modules" % "sbt-scala-module" % "2.2.1") addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.0.0") From 7f35af5c172289b3efba0d98b0754fc1d674165a Mon Sep 17 00:00:00 2001 From: Seth Tisue Date: Tue, 15 Sep 2020 15:54:36 -0700 Subject: [PATCH 455/789] fix bad merge --- build.sbt | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/build.sbt b/build.sbt index 73e775c43..96ae59803 100644 --- a/build.sbt +++ b/build.sbt @@ -41,17 +41,9 @@ lazy val xml = crossProject(JSPlatform, JVMPlatform) scalacOptions in Test += "-Xxml:coalescing", scalaModuleMimaPreviousVersion := { -<<<<<<< HEAD if (isDotty.value) None // No such release yet - // else if (System.getenv("SCALAJS_VERSION") == "1.0.0") None + // else if (System.getenv("SCALAJS_VERSION") == "1.0.1") None else Some("1.3.0") -||||||| 172ce22 - if (System.getenv("SCALAJS_VERSION") == "1.0.0") None - else Some("1.2.0") -======= - if (System.getenv("SCALAJS_VERSION") == "1.0.1") None - else Some("1.2.0") ->>>>>>> origin/1.x }, mimaBinaryIssueFilters ++= { import com.typesafe.tools.mima.core._ From d2e5e848253119c31081ebcd8d76ae3cc347ca63 Mon Sep 17 00:00:00 2001 From: Seth Tisue Date: Tue, 15 Sep 2020 16:07:16 -0700 Subject: [PATCH 456/789] fix up version numbers in CircleCI config --- .circleci/config.yml | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 4f13c1147..855cc2822 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -20,7 +20,7 @@ commands: parameters: scala_version: type: string - default: 2.12.10 + default: 2.12.12 sbt_tasks: type: string default: update compile test:compile test doc package @@ -44,7 +44,7 @@ jobs: parameters: scala_version: description: "Scala version" - default: 2.12.10 + default: 2.12.12 type: string java_version: description: "Java version" @@ -61,7 +61,7 @@ jobs: parameters: scala_version: description: "Scala version" - default: 2.12.10 + default: 2.12.12 type: string scalajs_version: description: "ScalaJS version" @@ -81,13 +81,13 @@ workflows: build: jobs: - scala_job: - name: 2.12.10 + name: 2.12.12 java_version: jdk8 - scala_version: 2.12.10 + scala_version: 2.12.12 - scala_job: - name: 2.13.1 + name: 2.13.3 java_version: jdk8 - scala_version: 2.13.1 + scala_version: 2.13.3 - scala_job: name: dotty-0.27.0-RC1 java_version: jdk8 @@ -95,11 +95,11 @@ workflows: - scala_job: name: jdk11_2.12 java_version: jdk11 - scala_version: 2.12.10 + scala_version: 2.12.12 - scala_job: name: jdk11_2.13 java_version: jdk11 - scala_version: 2.13.1 + scala_version: 2.13.3 - scala_job: name: jdk11_dotty java_version: jdk11 @@ -107,11 +107,11 @@ workflows: - scala_job: name: jdk13_2.12 java_version: jdk13 - scala_version: 2.12.10 + scala_version: 2.12.12 - scala_job: name: jdk13_2.13 java_version: jdk13 - scala_version: 2.13.1 + scala_version: 2.13.3 - scala_job: name: jdk13_dotty java_version: jdk13 @@ -119,20 +119,20 @@ workflows: - scala_job: name: jdk14_2.12 java_version: jdk14 - scala_version: 2.12.10 + scala_version: 2.12.12 - scala_job: name: jdk14_2.13 java_version: jdk14 - scala_version: 2.13.1 + scala_version: 2.13.3 - scala_job: name: jdk14_dotty java_version: jdk14 scala_version: 0.27.0-RC1 - scalajs_job: name: sjs1.0_2.12 - scala_version: 2.12.10 + scala_version: 2.12.12 scalajs_version: 1.2.0 - scalajs_job: name: sjs1.0_2.13 - scala_version: 2.13.1 + scala_version: 2.13.3 scalajs_version: 1.2.0 From 04980b0bb5909be700caec6ea19d5f1272538122 Mon Sep 17 00:00:00 2001 From: Seth Tisue Date: Tue, 15 Sep 2020 16:27:11 -0700 Subject: [PATCH 457/789] update readme and changelog for 2.0.0-M2 (#449) --- CHANGELOG.md | 13 +++++++++++-- README.md | 2 +- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c725ae694..401161374 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,14 @@ # Scala XML Changes +## 2.0.0-M2 (2020-09-15) + +Published for Scala 2.12 and 2.13, Scala.js 1.2.0, +and Dotty 0.27.0-RC1. + +### Removed + +- Removed `scala.xml.dtd.ElementValidator` + ## 2.0.0-M1 (2019-10-21) Not binary compatible with Scala XML 1.2.0. @@ -7,8 +16,7 @@ Not binary compatible with Scala XML 1.2.0. Published for Scala 2.12, 2.13 and Scala.js 0.6, 1.0.0-M8. Artifacts are no longer published for Scala 2.11. -There have been a number of deprecated elements that have been -removed, see the "[Removed](#Removed)" section below. +Some deprecated elements have been removed; see the "[Removed](#Removed)" section below. ### Added @@ -57,5 +65,6 @@ the Scala compiler, not in the Scala XML library. - Remove `scala.xml.dtd.impl.PointedHedgeExp` - Remove `scala.xml.dtd.Scanner` - Remove `scala.xml.dtd.ContentModelParser` +- Remove `scala.xml.dtd.ElementValidator` - Remove `scala.xml.factory.Binder` - Remove `scala.xml.parsing.ValidatingMarkupHandler` diff --git a/README.md b/README.md index a829f2b89..1f48f9c75 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ How to documentation is available in the [wiki](https://github.com/scala/scala-x The latest stable release of Scala XML is 1.3.0. -Experimental milestone releases of Scala XML version 2.0 are available, starting with 2.0.0-M1. See the changes for 2.0 in `CHANGELOG.md`. +Experimental milestone releases of Scala XML version 2.0 are available. Since 2.0.0-M2, Dotty is supported. See the changes for 2.0 in `CHANGELOG.md`. ## Maintenance status From 45fcec46eee5de1ce1dac6eac4199fc7e8d3d325 Mon Sep 17 00:00:00 2001 From: David Strawn Date: Sun, 20 Sep 2020 09:08:42 -0600 Subject: [PATCH 458/789] Update SBT Modules Version Prior to this commit this project fails to build on JRE 15 due to an issue in a transitive dependency of `sbt-scala-module`. Attempting will yield this error. ``` [error] java.util.ConcurrentModificationException [error] at java.base/java.util.TreeMap.callMappingFunctionWithCheck(TreeMap.java:742) [error] at java.base/java.util.TreeMap.computeIfAbsent(TreeMap.java:596) [error] at aQute.bnd.osgi.Jar.putResource(Jar.java:288) [error] at aQute.bnd.osgi.Jar.buildFromZip(Jar.java:216) [error] at aQute.bnd.osgi.Jar.(Jar.java:122) [error] at aQute.bnd.osgi.Jar.(Jar.java:148) [error] at aQute.bnd.osgi.Analyzer.setClasspath(Analyzer.java:1597) [error] at com.typesafe.sbt.osgi.Osgi$.bundleTask(Osgi.scala:57) [error] at com.typesafe.sbt.osgi.SbtOsgi$.$anonfun$defaultOsgiSettings$1(SbtOsgi.scala:55) [error] at scala.Function1.$anonfun$compose$1(Function1.scala:49) [error] at sbt.internal.util.$tilde$greater.$anonfun$$u2219$1(TypeFunctions.scala:62) [error] at sbt.std.Transform$$anon$4.work(Transform.scala:67) [error] at sbt.Execute.$anonfun$submit$2(Execute.scala:281) [error] at sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:19) [error] at sbt.Execute.work(Execute.scala:290) [error] at sbt.Execute.$anonfun$submit$1(Execute.scala:281) [error] at sbt.ConcurrentRestrictions$$anon$4.$anonfun$submitValid$1(ConcurrentRestrictions.scala:178) [error] at sbt.CompletionService$$anon$2.call(CompletionService.scala:37) [error] at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) [error] at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) [error] at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) [error] at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130) [error] at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:630) [error] at java.base/java.lang.Thread.run(Thread.java:832) [error] (xml / osgiBundle) java.util.ConcurrentModificationException ``` See, * https://github.com/bndtools/bnd/issues/3903 * https://github.com/sbt/sbt-osgi/pull/72 * https://github.com/scala/sbt-scala-module/pull/102 --- project/plugins.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/plugins.sbt b/project/plugins.sbt index 1c4ecad95..3eccbd701 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,7 +1,7 @@ val scalaJSVersion = Option(System.getenv("SCALAJS_VERSION")).filter(_.nonEmpty).getOrElse("1.2.0") -addSbtPlugin("org.scala-lang.modules" % "sbt-scala-module" % "2.2.1") +addSbtPlugin("org.scala-lang.modules" % "sbt-scala-module" % "2.2.2") addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.0.0") addSbtPlugin("org.scala-js" % "sbt-scalajs" % scalaJSVersion) addSbtPlugin("ch.epfl.lamp" % "sbt-dotty" % "0.4.2") From 690516fc16319d97d4984feb5d3089f0ad9c8327 Mon Sep 17 00:00:00 2001 From: Scala Steward <43047562+scala-steward@users.noreply.github.com> Date: Mon, 19 Oct 2020 19:31:04 +0200 Subject: [PATCH 459/789] Update sbt-dotty to 0.4.4 (#456) --- project/plugins.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/plugins.sbt b/project/plugins.sbt index 3eccbd701..cc81a0c3e 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -4,4 +4,4 @@ val scalaJSVersion = addSbtPlugin("org.scala-lang.modules" % "sbt-scala-module" % "2.2.2") addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.0.0") addSbtPlugin("org.scala-js" % "sbt-scalajs" % scalaJSVersion) -addSbtPlugin("ch.epfl.lamp" % "sbt-dotty" % "0.4.2") +addSbtPlugin("ch.epfl.lamp" % "sbt-dotty" % "0.4.4") From 2f8ecd1240a0279096bfddafc4549ebe1c130ed8 Mon Sep 17 00:00:00 2001 From: Scala Steward <43047562+scala-steward@users.noreply.github.com> Date: Tue, 20 Oct 2020 20:30:13 +0200 Subject: [PATCH 460/789] Update sbt-scala-module to 2.2.3 (#458) --- project/plugins.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/plugins.sbt b/project/plugins.sbt index cc81a0c3e..7f730cfc6 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,7 +1,7 @@ val scalaJSVersion = Option(System.getenv("SCALAJS_VERSION")).filter(_.nonEmpty).getOrElse("1.2.0") -addSbtPlugin("org.scala-lang.modules" % "sbt-scala-module" % "2.2.2") +addSbtPlugin("org.scala-lang.modules" % "sbt-scala-module" % "2.2.3") addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.0.0") addSbtPlugin("org.scala-js" % "sbt-scalajs" % scalaJSVersion) addSbtPlugin("ch.epfl.lamp" % "sbt-dotty" % "0.4.4") From 0a0f8bdac89c72577196335c76934e03c3096fea Mon Sep 17 00:00:00 2001 From: Scala Steward <43047562+scala-steward@users.noreply.github.com> Date: Tue, 20 Oct 2020 20:30:27 +0200 Subject: [PATCH 461/789] Update sbt-scalajs, scalajs-compiler to 1.3.0 (#454) --- .circleci/config.yml | 4 ++-- .travis.yml | 4 ++-- project/plugins.sbt | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 855cc2822..2dbb605e2 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -131,8 +131,8 @@ workflows: - scalajs_job: name: sjs1.0_2.12 scala_version: 2.12.12 - scalajs_version: 1.2.0 + scalajs_version: 1.3.0 - scalajs_job: name: sjs1.0_2.13 scala_version: 2.13.3 - scalajs_version: 1.2.0 + scalajs_version: 1.3.0 diff --git a/.travis.yml b/.travis.yml index a1b0133d1..4c39fa5b5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,14 +11,14 @@ scala: env: - SCALAJS_VERSION= ADOPTOPENJDK=8 - - SCALAJS_VERSION=1.2.0 ADOPTOPENJDK=8 + - SCALAJS_VERSION=1.3.0 ADOPTOPENJDK=8 - SCALAJS_VERSION= ADOPTOPENJDK=11 - SCALAJS_VERSION= ADOPTOPENJDK=13 matrix: exclude: - scala: 0.27.0-RC1 - env: SCALAJS_VERSION=1.2.0 ADOPTOPENJDK=8 + env: SCALAJS_VERSION=1.3.0 ADOPTOPENJDK=8 install: - git fetch --tags # get all tags for sbt-dynver diff --git a/project/plugins.sbt b/project/plugins.sbt index 7f730cfc6..d559be982 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,5 +1,5 @@ val scalaJSVersion = - Option(System.getenv("SCALAJS_VERSION")).filter(_.nonEmpty).getOrElse("1.2.0") + Option(System.getenv("SCALAJS_VERSION")).filter(_.nonEmpty).getOrElse("1.3.0") addSbtPlugin("org.scala-lang.modules" % "sbt-scala-module" % "2.2.3") addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.0.0") From 9a56cdd0ce6168449110e2cf1a330936ff40297d Mon Sep 17 00:00:00 2001 From: Scala Steward <43047562+scala-steward@users.noreply.github.com> Date: Tue, 20 Oct 2020 20:30:42 +0200 Subject: [PATCH 462/789] Update junit to 4.13.1 (#453) --- build.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index 96ae59803..bbe6f625a 100644 --- a/build.sbt +++ b/build.sbt @@ -149,7 +149,7 @@ lazy val xml = crossProject(JSPlatform, JVMPlatform) .jvmSettings( OsgiKeys.exportPackage := Seq(s"scala.xml.*;version=${version.value}"), - libraryDependencies += "junit" % "junit" % "4.13" % Test, + libraryDependencies += "junit" % "junit" % "4.13.1" % Test, libraryDependencies += "com.novocode" % "junit-interface" % "0.11" % Test, libraryDependencies += "org.apache.commons" % "commons-lang3" % "3.11" % Test, libraryDependencies ++= { From ab664a5bad0f5d3da9067654277097b9b2d256e5 Mon Sep 17 00:00:00 2001 From: Seth Tisue Date: Mon, 26 Oct 2020 19:12:33 -0700 Subject: [PATCH 463/789] accommodate non-cross-built modules in build.sh --- build.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/build.sh b/build.sh index 11ca2bb0a..4c5a682a7 100755 --- a/build.sh +++ b/build.sh @@ -26,9 +26,9 @@ isReleaseJob() { } if [[ "$SCALAJS_VERSION" == "" ]]; then - projectPrefix="xml" + projectPrefix="xml/" else - projectPrefix="xmlJS" + projectPrefix="xmlJS/" fi verPat="[0-9]+\.[0-9]+\.[0-9]+(-[A-Za-z0-9-]+)?" @@ -43,12 +43,12 @@ if [[ "$TRAVIS_TAG" =~ $tagPat ]]; then fi # default is +publishSigned; we cross-build with travis jobs, not sbt's crossScalaVersions -export CI_RELEASE="$projectPrefix/publishSigned" -export CI_SNAPSHOT_RELEASE="$projectPrefix/publish" +export CI_RELEASE="${projectPrefix}publishSigned" +export CI_SNAPSHOT_RELEASE="${projectPrefix}publish" # default is sonatypeBundleRelease, which closes and releases the staging repo # see https://github.com/xerial/sbt-sonatype#commands # for now, until we're confident in the new release scripts, just close the staging repo. export CI_SONATYPE_RELEASE="; sonatypePrepare; sonatypeBundleUpload; sonatypeClose" -sbt clean $projectPrefix/test $projectPrefix/publishLocal $releaseTask +sbt clean ${projectPrefix}test ${projectPrefix}publishLocal $releaseTask From ee299f570aca7ab302c25f17ca121c643ff289dc Mon Sep 17 00:00:00 2001 From: Scala Steward <43047562+scala-steward@users.noreply.github.com> Date: Wed, 4 Nov 2020 15:42:32 +0100 Subject: [PATCH 464/789] Update sbt-dotty to 0.4.5 (#461) --- project/plugins.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/plugins.sbt b/project/plugins.sbt index d559be982..d1d6f1b3f 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -4,4 +4,4 @@ val scalaJSVersion = addSbtPlugin("org.scala-lang.modules" % "sbt-scala-module" % "2.2.3") addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.0.0") addSbtPlugin("org.scala-js" % "sbt-scalajs" % scalaJSVersion) -addSbtPlugin("ch.epfl.lamp" % "sbt-dotty" % "0.4.4") +addSbtPlugin("ch.epfl.lamp" % "sbt-dotty" % "0.4.5") From 652573de3a7e0547026f84e8caa3d8589fec1213 Mon Sep 17 00:00:00 2001 From: Scala Steward <43047562+scala-steward@users.noreply.github.com> Date: Thu, 19 Nov 2020 01:20:42 +0100 Subject: [PATCH 465/789] Update sbt-dotty to 0.4.6 (#463) --- project/plugins.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/plugins.sbt b/project/plugins.sbt index d1d6f1b3f..0110d6e70 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -4,4 +4,4 @@ val scalaJSVersion = addSbtPlugin("org.scala-lang.modules" % "sbt-scala-module" % "2.2.3") addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.0.0") addSbtPlugin("org.scala-js" % "sbt-scalajs" % scalaJSVersion) -addSbtPlugin("ch.epfl.lamp" % "sbt-dotty" % "0.4.5") +addSbtPlugin("ch.epfl.lamp" % "sbt-dotty" % "0.4.6") From 8d224b4d41237d407d0786af0eee3b160c0f4fae Mon Sep 17 00:00:00 2001 From: Scala Steward <43047562+scala-steward@users.noreply.github.com> Date: Thu, 19 Nov 2020 01:20:57 +0100 Subject: [PATCH 466/789] Update sbt-scalajs, scalajs-compiler, ... to 1.3.1 (#464) --- .circleci/config.yml | 4 ++-- .travis.yml | 4 ++-- project/plugins.sbt | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 2dbb605e2..4ca974cb4 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -131,8 +131,8 @@ workflows: - scalajs_job: name: sjs1.0_2.12 scala_version: 2.12.12 - scalajs_version: 1.3.0 + scalajs_version: 1.3.1 - scalajs_job: name: sjs1.0_2.13 scala_version: 2.13.3 - scalajs_version: 1.3.0 + scalajs_version: 1.3.1 diff --git a/.travis.yml b/.travis.yml index 4c39fa5b5..55cd551c0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,14 +11,14 @@ scala: env: - SCALAJS_VERSION= ADOPTOPENJDK=8 - - SCALAJS_VERSION=1.3.0 ADOPTOPENJDK=8 + - SCALAJS_VERSION=1.3.1 ADOPTOPENJDK=8 - SCALAJS_VERSION= ADOPTOPENJDK=11 - SCALAJS_VERSION= ADOPTOPENJDK=13 matrix: exclude: - scala: 0.27.0-RC1 - env: SCALAJS_VERSION=1.3.0 ADOPTOPENJDK=8 + env: SCALAJS_VERSION=1.3.1 ADOPTOPENJDK=8 install: - git fetch --tags # get all tags for sbt-dynver diff --git a/project/plugins.sbt b/project/plugins.sbt index 0110d6e70..ab0bb0c43 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,5 +1,5 @@ val scalaJSVersion = - Option(System.getenv("SCALAJS_VERSION")).filter(_.nonEmpty).getOrElse("1.3.0") + Option(System.getenv("SCALAJS_VERSION")).filter(_.nonEmpty).getOrElse("1.3.1") addSbtPlugin("org.scala-lang.modules" % "sbt-scala-module" % "2.2.3") addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.0.0") From 5ca832ad48b0b8cac66c84afad21d21d5c937522 Mon Sep 17 00:00:00 2001 From: Seth Tisue Date: Wed, 18 Nov 2020 16:27:12 -0800 Subject: [PATCH 467/789] disable failing Dottydoc I'm seeing a lot of repos doing this -- it's fine, Scala3doc will replace it --- build.sbt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/build.sbt b/build.sbt index bbe6f625a..d7a612007 100644 --- a/build.sbt +++ b/build.sbt @@ -40,6 +40,10 @@ lazy val xml = crossProject(JSPlatform, JVMPlatform) scalacOptions in Test += "-Xxml:coalescing", + // don't run Dottydoc, it errors and isn't needed anyway. + // but we leave `publishArtifact` set to true, otherwise Sonatype won't let us publish + Compile / doc / sources := (if (isDotty.value) Seq() else (Compile / doc/ sources).value), + scalaModuleMimaPreviousVersion := { if (isDotty.value) None // No such release yet // else if (System.getenv("SCALAJS_VERSION") == "1.0.1") None From 84fa0de96a8c1cc7588ae4548a5204b23eeeac02 Mon Sep 17 00:00:00 2001 From: Seth Tisue Date: Wed, 18 Nov 2020 16:27:18 -0800 Subject: [PATCH 468/789] upgrade sbt to 1.4.3 previously this was blocked by Dottydoc failing --- project/build.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/build.properties b/project/build.properties index 0837f7a13..947bdd302 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version=1.3.13 +sbt.version=1.4.3 From 70efc91c7485bf7f858405aaab1cb6b44e1e6936 Mon Sep 17 00:00:00 2001 From: David Strawn Date: Sun, 6 Sep 2020 11:31:05 -0600 Subject: [PATCH 469/789] Update For Scala 3.0.0-M2 --- .circleci/config.yml | 24 ++++++++++++++++-------- .travis.yml | 8 +++++--- build.sbt | 5 ++--- 3 files changed, 23 insertions(+), 14 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 4ca974cb4..6d958d652 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -89,9 +89,9 @@ workflows: java_version: jdk8 scala_version: 2.13.3 - scala_job: - name: dotty-0.27.0-RC1 + name: 3.0.0-M2 java_version: jdk8 - scala_version: 0.27.0-RC1 + scala_version: 3.0.0-M2 - scala_job: name: jdk11_2.12 java_version: jdk11 @@ -101,9 +101,9 @@ workflows: java_version: jdk11 scala_version: 2.13.3 - scala_job: - name: jdk11_dotty + name: jdk11_3.0 java_version: jdk11 - scala_version: 0.27.0-RC1 + scala_version: 3.0.0-M2 - scala_job: name: jdk13_2.12 java_version: jdk13 @@ -113,9 +113,9 @@ workflows: java_version: jdk13 scala_version: 2.13.3 - scala_job: - name: jdk13_dotty + name: jdk13_3.0 java_version: jdk13 - scala_version: 0.27.0-RC1 + scala_version: 3.0.0-M2 - scala_job: name: jdk14_2.12 java_version: jdk14 @@ -125,9 +125,17 @@ workflows: java_version: jdk14 scala_version: 2.13.3 - scala_job: - name: jdk14_dotty + name: jdk14_3.0 java_version: jdk14 - scala_version: 0.27.0-RC1 + scala_version: 3.0.0-M2 + - scalajs_job: + name: sjs0.6_2.12 + scala_version: 2.12.10 + scalajs_version: 0.6.33 + - scalajs_job: + name: sjs0.6_2.13 + scala_version: 2.13.1 + scalajs_version: 0.6.33 - scalajs_job: name: sjs1.0_2.12 scala_version: 2.12.12 diff --git a/.travis.yml b/.travis.yml index 55cd551c0..426699d81 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,7 +5,7 @@ import: scala/scala-dev:travis/default.yml language: scala scala: - - 0.27.0-RC1 + - 3.0.0-M2 - 2.12.12 - 2.13.3 @@ -17,8 +17,10 @@ env: matrix: exclude: - - scala: 0.27.0-RC1 - env: SCALAJS_VERSION=1.3.1 ADOPTOPENJDK=8 + - scala: 3.0.0-M1 + env: SCALAJS_VERSION=0.6.33 ADOPTOPENJDK=8 + - scala: 3.0.0-M1 + env: SCALAJS_VERSION=1.0.1 ADOPTOPENJDK=8 install: - git fetch --tags # get all tags for sbt-dynver diff --git a/build.sbt b/build.sbt index d7a612007..0aaa8c5f5 100644 --- a/build.sbt +++ b/build.sbt @@ -6,8 +6,7 @@ lazy val configSettings: Seq[Setting[_]] = Seq( val sv = scalaVersion.value Seq( CrossVersion.partialVersion(sv) match { - case Some((2, 13)) => file(dir.getPath ++ "-2.13+") - case Some((0, _)) => file(dir.getPath ++ "-2.13+") + case Some((major, minor)) if major > 2 || (major == 2 && minor >= 13) => file(dir.getPath ++ "-2.13+") case _ => file(dir.getPath ++ "-2.13-") }, CrossVersion.partialVersion(sv) match { @@ -165,7 +164,7 @@ lazy val xml = crossProject(JSPlatform, JVMPlatform) ) .jsSettings( // The config for Travis has an exclude, but sbt-travisci doesn't catch it. - crossScalaVersions -= "0.27.0-RC1", + crossScalaVersions -= "3.0.0-M2", // Scala.js cannot run forked tests fork in Test := false ) From 30b11a2f337cdd97d623524ea0760cf25678a739 Mon Sep 17 00:00:00 2001 From: Scala Steward <43047562+scala-steward@users.noreply.github.com> Date: Thu, 26 Nov 2020 01:53:33 +0100 Subject: [PATCH 470/789] Update sbt to 1.4.4 (#468) --- project/build.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/build.properties b/project/build.properties index 947bdd302..7de0a9382 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version=1.4.3 +sbt.version=1.4.4 From 72e77d0aa86780ecf039ff352e7c8a17055469ba Mon Sep 17 00:00:00 2001 From: Seth Tisue Date: Wed, 25 Nov 2020 17:02:20 -0800 Subject: [PATCH 471/789] Scala 2.13.4 (was 2.13.3) --- .circleci/config.yml | 12 ++++++------ .travis.yml | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 6d958d652..e1360822a 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -85,9 +85,9 @@ workflows: java_version: jdk8 scala_version: 2.12.12 - scala_job: - name: 2.13.3 + name: 2.13.4 java_version: jdk8 - scala_version: 2.13.3 + scala_version: 2.13.4 - scala_job: name: 3.0.0-M2 java_version: jdk8 @@ -99,7 +99,7 @@ workflows: - scala_job: name: jdk11_2.13 java_version: jdk11 - scala_version: 2.13.3 + scala_version: 2.13.4 - scala_job: name: jdk11_3.0 java_version: jdk11 @@ -111,7 +111,7 @@ workflows: - scala_job: name: jdk13_2.13 java_version: jdk13 - scala_version: 2.13.3 + scala_version: 2.13.4 - scala_job: name: jdk13_3.0 java_version: jdk13 @@ -123,7 +123,7 @@ workflows: - scala_job: name: jdk14_2.13 java_version: jdk14 - scala_version: 2.13.3 + scala_version: 2.13.4 - scala_job: name: jdk14_3.0 java_version: jdk14 @@ -142,5 +142,5 @@ workflows: scalajs_version: 1.3.1 - scalajs_job: name: sjs1.0_2.13 - scala_version: 2.13.3 + scala_version: 2.13.4 scalajs_version: 1.3.1 diff --git a/.travis.yml b/.travis.yml index 426699d81..df021bbe1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,7 +7,7 @@ language: scala scala: - 3.0.0-M2 - 2.12.12 - - 2.13.3 + - 2.13.4 env: - SCALAJS_VERSION= ADOPTOPENJDK=8 From 285327c4429ad2c75eb645faa9926dee6afeac4e Mon Sep 17 00:00:00 2001 From: Seth Tisue Date: Wed, 25 Nov 2020 17:02:38 -0800 Subject: [PATCH 472/789] build cleanup: drop old Scala.js cruft --- .circleci/config.yml | 8 -------- .travis.yml | 7 ------- build.sbt | 1 - 3 files changed, 16 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index e1360822a..0da6cfa82 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -128,14 +128,6 @@ workflows: name: jdk14_3.0 java_version: jdk14 scala_version: 3.0.0-M2 - - scalajs_job: - name: sjs0.6_2.12 - scala_version: 2.12.10 - scalajs_version: 0.6.33 - - scalajs_job: - name: sjs0.6_2.13 - scala_version: 2.13.1 - scalajs_version: 0.6.33 - scalajs_job: name: sjs1.0_2.12 scala_version: 2.12.12 diff --git a/.travis.yml b/.travis.yml index df021bbe1..995ce8216 100644 --- a/.travis.yml +++ b/.travis.yml @@ -15,13 +15,6 @@ env: - SCALAJS_VERSION= ADOPTOPENJDK=11 - SCALAJS_VERSION= ADOPTOPENJDK=13 -matrix: - exclude: - - scala: 3.0.0-M1 - env: SCALAJS_VERSION=0.6.33 ADOPTOPENJDK=8 - - scala: 3.0.0-M1 - env: SCALAJS_VERSION=1.0.1 ADOPTOPENJDK=8 - install: - git fetch --tags # get all tags for sbt-dynver diff --git a/build.sbt b/build.sbt index 0aaa8c5f5..8e393a707 100644 --- a/build.sbt +++ b/build.sbt @@ -45,7 +45,6 @@ lazy val xml = crossProject(JSPlatform, JVMPlatform) scalaModuleMimaPreviousVersion := { if (isDotty.value) None // No such release yet - // else if (System.getenv("SCALAJS_VERSION") == "1.0.1") None else Some("1.3.0") }, mimaBinaryIssueFilters ++= { From 57336604183f498c8e0797317027c404a1405586 Mon Sep 17 00:00:00 2001 From: Seth Tisue Date: Wed, 25 Nov 2020 17:19:23 -0800 Subject: [PATCH 473/789] CI: drop JDK 13 and 14, add 15 --- .circleci/config.yml | 31 ++++++++----------------------- .travis.yml | 2 +- 2 files changed, 9 insertions(+), 24 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 0da6cfa82..c3a014c75 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -7,12 +7,9 @@ executors: scala_jdk11_executor: docker: - image: circleci/openjdk:11-jdk - scala_jdk13_executor: + scala_jdk15_executor: docker: - - image: circleci/openjdk:13.0.1-jdk-buster - scala_jdk14_executor: - docker: - - image: circleci/openjdk:14-ea-26-jdk-buster + - image: circleci/openjdk:15-buster commands: sbt_cmd: @@ -105,28 +102,16 @@ workflows: java_version: jdk11 scala_version: 3.0.0-M2 - scala_job: - name: jdk13_2.12 - java_version: jdk13 - scala_version: 2.12.12 - - scala_job: - name: jdk13_2.13 - java_version: jdk13 - scala_version: 2.13.4 - - scala_job: - name: jdk13_3.0 - java_version: jdk13 - scala_version: 3.0.0-M2 - - scala_job: - name: jdk14_2.12 - java_version: jdk14 + name: jdk15_2.12 + java_version: jdk15 scala_version: 2.12.12 - scala_job: - name: jdk14_2.13 - java_version: jdk14 + name: jdk15_2.13 + java_version: jdk15 scala_version: 2.13.4 - scala_job: - name: jdk14_3.0 - java_version: jdk14 + name: jdk15_3.0 + java_version: jdk15 scala_version: 3.0.0-M2 - scalajs_job: name: sjs1.0_2.12 diff --git a/.travis.yml b/.travis.yml index 995ce8216..4f9db8432 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,7 +13,7 @@ env: - SCALAJS_VERSION= ADOPTOPENJDK=8 - SCALAJS_VERSION=1.3.1 ADOPTOPENJDK=8 - SCALAJS_VERSION= ADOPTOPENJDK=11 - - SCALAJS_VERSION= ADOPTOPENJDK=13 + - SCALAJS_VERSION= ADOPTOPENJDK=15 install: - git fetch --tags # get all tags for sbt-dynver From 45864edf31e1e6afa59df899cb2df296f135b7cf Mon Sep 17 00:00:00 2001 From: Seth Tisue Date: Wed, 25 Nov 2020 17:58:37 -0800 Subject: [PATCH 474/789] bump Scala 3 version in readme --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 1f48f9c75..6ee3064b6 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ How to documentation is available in the [wiki](https://github.com/scala/scala-x The latest stable release of Scala XML is 1.3.0. -Experimental milestone releases of Scala XML version 2.0 are available. Since 2.0.0-M2, Dotty is supported. See the changes for 2.0 in `CHANGELOG.md`. +Experimental milestone releases of Scala XML version 2.0 are available. Since 2.0.0-M3, Scala 3 is supported. See the changes for 2.0 in `CHANGELOG.md`. ## Maintenance status From 8825d98d4f4973203350a86bf1c7ba8abe5cb9d0 Mon Sep 17 00:00:00 2001 From: Seth Tisue Date: Thu, 26 Nov 2020 07:51:34 -0800 Subject: [PATCH 475/789] let javadoc.io host our Scaladoc as per discussion on #469 --- README.md | 2 +- build.sbt | 3 --- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/README.md b/README.md index 6ee3064b6..bf872194c 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ The standard Scala XML library. Please file XML issues here, not at https://gith The decoupling of scala-xml from the Scala compiler and standard library is possible because the compiler desugars XML literals in Scala source code into a set of method calls. Alternative implementations of these calls are welcome! (The calls are unfortunately only defined by the [implementation](https://github.com/scala/scala/blob/2.11.x/src/compiler/scala/tools/nsc/ast/parser/SymbolicXMLBuilder.scala).) -API documentation is available [here](https://scala.github.io/scala-xml/api/1.2.0/scala/xml/). +API documentation is available [here](https://javadoc.io/doc/org.scala-lang.modules/scala-xml_2.13/). How to documentation is available in the [wiki](https://github.com/scala/scala-xml/wiki) diff --git a/build.sbt b/build.sbt index 8e393a707..c119ef2e6 100644 --- a/build.sbt +++ b/build.sbt @@ -117,9 +117,6 @@ lazy val xml = crossProject(JSPlatform, JVMPlatform) ) }, - apiURL := Some( - url(s"""https://scala.github.io/scala-xml/api/${"-.*".r.replaceAllIn(version.value, "")}/""") - ), apiMappings ++= scalaInstance.value.libraryJars.filter { file => file.getName.startsWith("scala-library") && file.getName.endsWith(".jar") }.map { libraryJar => From 49486a31000ce27a91ce6ee885088a7f338d8805 Mon Sep 17 00:00:00 2001 From: David Strawn Date: Sun, 20 Sep 2020 09:20:14 -0600 Subject: [PATCH 476/789] Add JDK 16 To The CircleCI Build Though JDK16 is not yet released, building with it now will give us warnings about issues such as failure to build on JDK15 (https://github.com/scala/scala-xml/pull/450) Also adds the `osgiBundle` task to CI to catch issues with it. --- .circleci/config.yml | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index c3a014c75..3921b19a6 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -10,6 +10,9 @@ executors: scala_jdk15_executor: docker: - image: circleci/openjdk:15-buster + scala_jdk16_executor: + docker: + - image: circleci/openjdk:16-buster commands: sbt_cmd: @@ -20,7 +23,7 @@ commands: default: 2.12.12 sbt_tasks: type: string - default: update compile test:compile test doc package + default: update compile test:compile test doc package osgiBundle steps: - restore_cache: keys: @@ -52,7 +55,7 @@ jobs: - run: java -version - sbt_cmd: scala_version: << parameters.scala_version >> - sbt_tasks: xml/update xml/compile xml/test:compile xml/test xml/doc xml/package + sbt_tasks: xml/update xml/compile xml/test:compile xml/test xml/doc xml/package xml/osgiBundle scalajs_job: executor: scala_jdk8_executor parameters: @@ -113,6 +116,18 @@ workflows: name: jdk15_3.0 java_version: jdk15 scala_version: 3.0.0-M2 + - scala_job: + name: jdk16_2.12 + java_version: jdk16 + scala_version: 2.12.12 + - scala_job: + name: jdk16_2.13 + java_version: jdk16 + scala_version: 2.13.3 + - scala_job: + name: jdk16_3.0 + java_version: jdk16 + scala_version: 3.0.0-M2 - scalajs_job: name: sjs1.0_2.12 scala_version: 2.12.12 From 98926b2046ce692cf073c3799c557e0869e6d41e Mon Sep 17 00:00:00 2001 From: Scala Steward <43047562+scala-steward@users.noreply.github.com> Date: Sat, 19 Dec 2020 22:34:52 +0100 Subject: [PATCH 477/789] Update sbt-dotty to 0.5.1 (#476) --- project/plugins.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/plugins.sbt b/project/plugins.sbt index ab0bb0c43..0a92b600d 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -4,4 +4,4 @@ val scalaJSVersion = addSbtPlugin("org.scala-lang.modules" % "sbt-scala-module" % "2.2.3") addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.0.0") addSbtPlugin("org.scala-js" % "sbt-scalajs" % scalaJSVersion) -addSbtPlugin("ch.epfl.lamp" % "sbt-dotty" % "0.4.6") +addSbtPlugin("ch.epfl.lamp" % "sbt-dotty" % "0.5.1") From b8cbff87120a971dfb460876211553ca460c1874 Mon Sep 17 00:00:00 2001 From: Scala Steward <43047562+scala-steward@users.noreply.github.com> Date: Sat, 19 Dec 2020 22:35:04 +0100 Subject: [PATCH 478/789] Update sbt to 1.4.5 (#474) --- project/build.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/build.properties b/project/build.properties index 7de0a9382..c06db1bb2 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version=1.4.4 +sbt.version=1.4.5 From 622cfa1652cf6cd1af04e3bd4c0f217e03a8b6c7 Mon Sep 17 00:00:00 2001 From: Seth Tisue Date: Sat, 19 Dec 2020 15:26:35 -0800 Subject: [PATCH 479/789] add Scala 3.0.0-M3 to crossbuild --- .circleci/config.yml | 10 +++++++--- .travis.yml | 1 + build.sbt | 6 ++---- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 3921b19a6..b095729cc 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -88,6 +88,10 @@ workflows: name: 2.13.4 java_version: jdk8 scala_version: 2.13.4 + - scala_job: + name: 3.0.0-M3 + java_version: jdk8 + scala_version: 3.0.0-M3 - scala_job: name: 3.0.0-M2 java_version: jdk8 @@ -103,7 +107,7 @@ workflows: - scala_job: name: jdk11_3.0 java_version: jdk11 - scala_version: 3.0.0-M2 + scala_version: 3.0.0-M3 - scala_job: name: jdk15_2.12 java_version: jdk15 @@ -115,7 +119,7 @@ workflows: - scala_job: name: jdk15_3.0 java_version: jdk15 - scala_version: 3.0.0-M2 + scala_version: 3.0.0-M3 - scala_job: name: jdk16_2.12 java_version: jdk16 @@ -127,7 +131,7 @@ workflows: - scala_job: name: jdk16_3.0 java_version: jdk16 - scala_version: 3.0.0-M2 + scala_version: 3.0.0-M3 - scalajs_job: name: sjs1.0_2.12 scala_version: 2.12.12 diff --git a/.travis.yml b/.travis.yml index 4f9db8432..ba23b1d7b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,6 +5,7 @@ import: scala/scala-dev:travis/default.yml language: scala scala: + - 3.0.0-M3 - 3.0.0-M2 - 2.12.12 - 2.13.4 diff --git a/build.sbt b/build.sbt index c119ef2e6..a392cce29 100644 --- a/build.sbt +++ b/build.sbt @@ -37,7 +37,7 @@ lazy val xml = crossProject(JSPlatform, JVMPlatform) opts.split("\\s+").to[Seq] }, - scalacOptions in Test += "-Xxml:coalescing", + Test / scalacOptions += "-Xxml:coalescing", // don't run Dottydoc, it errors and isn't needed anyway. // but we leave `publishArtifact` set to true, otherwise Sonatype won't let us publish @@ -159,9 +159,7 @@ lazy val xml = crossProject(JSPlatform, JVMPlatform) } ) .jsSettings( - // The config for Travis has an exclude, but sbt-travisci doesn't catch it. - crossScalaVersions -= "3.0.0-M2", // Scala.js cannot run forked tests - fork in Test := false + Test / fork := false ) .jsConfigure(_.enablePlugins(ScalaJSJUnitPlugin)) From 2355d551a0016cddf1ac7b8e9a5945788fa018e0 Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Thu, 24 Dec 2020 12:35:31 +0100 Subject: [PATCH 480/789] Update sbt to 1.4.6 --- project/build.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/build.properties b/project/build.properties index c06db1bb2..d91c272d4 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version=1.4.5 +sbt.version=1.4.6 From 2ee43220c7e924701430b83e62746fc77a68bc2f Mon Sep 17 00:00:00 2001 From: Scala Steward <43047562+scala-steward@users.noreply.github.com> Date: Wed, 13 Jan 2021 01:03:27 +0100 Subject: [PATCH 481/789] Update scalajs-junit-test-plugin to 1.4.0 (#481) --- .circleci/config.yml | 4 ++-- .travis.yml | 2 +- project/plugins.sbt | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index b095729cc..85bdc8552 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -135,8 +135,8 @@ workflows: - scalajs_job: name: sjs1.0_2.12 scala_version: 2.12.12 - scalajs_version: 1.3.1 + scalajs_version: 1.4.0 - scalajs_job: name: sjs1.0_2.13 scala_version: 2.13.4 - scalajs_version: 1.3.1 + scalajs_version: 1.4.0 diff --git a/.travis.yml b/.travis.yml index ba23b1d7b..9758a4bac 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,7 +12,7 @@ scala: env: - SCALAJS_VERSION= ADOPTOPENJDK=8 - - SCALAJS_VERSION=1.3.1 ADOPTOPENJDK=8 + - SCALAJS_VERSION=1.4.0 ADOPTOPENJDK=8 - SCALAJS_VERSION= ADOPTOPENJDK=11 - SCALAJS_VERSION= ADOPTOPENJDK=15 diff --git a/project/plugins.sbt b/project/plugins.sbt index 0a92b600d..e70083e6a 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,5 +1,5 @@ val scalaJSVersion = - Option(System.getenv("SCALAJS_VERSION")).filter(_.nonEmpty).getOrElse("1.3.1") + Option(System.getenv("SCALAJS_VERSION")).filter(_.nonEmpty).getOrElse("1.4.0") addSbtPlugin("org.scala-lang.modules" % "sbt-scala-module" % "2.2.3") addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.0.0") From ec9f49d492aa55f519630ad48ba138e5172a5eff Mon Sep 17 00:00:00 2001 From: Scala Steward <43047562+scala-steward@users.noreply.github.com> Date: Thu, 28 Jan 2021 21:31:45 +0100 Subject: [PATCH 482/789] Update sbt-dotty to 0.5.2 (#483) --- project/plugins.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/plugins.sbt b/project/plugins.sbt index e70083e6a..ba23fbaeb 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -4,4 +4,4 @@ val scalaJSVersion = addSbtPlugin("org.scala-lang.modules" % "sbt-scala-module" % "2.2.3") addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.0.0") addSbtPlugin("org.scala-js" % "sbt-scalajs" % scalaJSVersion) -addSbtPlugin("ch.epfl.lamp" % "sbt-dotty" % "0.5.1") +addSbtPlugin("ch.epfl.lamp" % "sbt-dotty" % "0.5.2") From 97a90180838b27bde3f0020fb2702c460b4ad4a3 Mon Sep 17 00:00:00 2001 From: Scala Steward <43047562+scala-steward@users.noreply.github.com> Date: Fri, 29 Jan 2021 03:23:41 +0100 Subject: [PATCH 483/789] Update sbt-scalajs, scalajs-compiler, ... to 1.4.0 (#480) Co-authored-by: Seth Tisue --- .circleci/config.yml | 18 +++++++++--------- .travis.yml | 2 +- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 85bdc8552..c91fb5898 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -20,7 +20,7 @@ commands: parameters: scala_version: type: string - default: 2.12.12 + default: 2.12.13 sbt_tasks: type: string default: update compile test:compile test doc package osgiBundle @@ -44,7 +44,7 @@ jobs: parameters: scala_version: description: "Scala version" - default: 2.12.12 + default: 2.12.13 type: string java_version: description: "Java version" @@ -61,7 +61,7 @@ jobs: parameters: scala_version: description: "Scala version" - default: 2.12.12 + default: 2.12.13 type: string scalajs_version: description: "ScalaJS version" @@ -81,9 +81,9 @@ workflows: build: jobs: - scala_job: - name: 2.12.12 + name: 2.12.13 java_version: jdk8 - scala_version: 2.12.12 + scala_version: 2.12.13 - scala_job: name: 2.13.4 java_version: jdk8 @@ -99,7 +99,7 @@ workflows: - scala_job: name: jdk11_2.12 java_version: jdk11 - scala_version: 2.12.12 + scala_version: 2.12.13 - scala_job: name: jdk11_2.13 java_version: jdk11 @@ -111,7 +111,7 @@ workflows: - scala_job: name: jdk15_2.12 java_version: jdk15 - scala_version: 2.12.12 + scala_version: 2.12.13 - scala_job: name: jdk15_2.13 java_version: jdk15 @@ -123,7 +123,7 @@ workflows: - scala_job: name: jdk16_2.12 java_version: jdk16 - scala_version: 2.12.12 + scala_version: 2.12.13 - scala_job: name: jdk16_2.13 java_version: jdk16 @@ -134,7 +134,7 @@ workflows: scala_version: 3.0.0-M3 - scalajs_job: name: sjs1.0_2.12 - scala_version: 2.12.12 + scala_version: 2.12.13 scalajs_version: 1.4.0 - scalajs_job: name: sjs1.0_2.13 diff --git a/.travis.yml b/.travis.yml index 9758a4bac..7449e1727 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,7 +7,7 @@ language: scala scala: - 3.0.0-M3 - 3.0.0-M2 - - 2.12.12 + - 2.12.13 - 2.13.4 env: From 61fa0fdadf5cc2b2c23cecad6efc0f61ac602759 Mon Sep 17 00:00:00 2001 From: Lorenzo Gabriele Date: Sat, 23 Jan 2021 19:40:10 +0100 Subject: [PATCH 484/789] Add support for Scala Native 0.4 --- .travis.yml | 9 +++++---- build.sbt | 10 +++++++++- build.sh | 4 +++- project/plugins.sbt | 5 +++++ 4 files changed, 22 insertions(+), 6 deletions(-) diff --git a/.travis.yml b/.travis.yml index 7449e1727..b7ad9c919 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,10 +11,11 @@ scala: - 2.13.4 env: - - SCALAJS_VERSION= ADOPTOPENJDK=8 - - SCALAJS_VERSION=1.4.0 ADOPTOPENJDK=8 - - SCALAJS_VERSION= ADOPTOPENJDK=11 - - SCALAJS_VERSION= ADOPTOPENJDK=15 + - SCALAJS_VERSION= ADOPTOPENJDK=8 + - SCALAJS_VERSION=1.4.0 ADOPTOPENJDK=8 + - SCALANATIVE_VERSION=0.4.0 ADOPTOPENJDK=8 + - SCALAJS_VERSION= ADOPTOPENJDK=11 + - SCALAJS_VERSION= ADOPTOPENJDK=15 install: - git fetch --tags # get all tags for sbt-dynver diff --git a/build.sbt b/build.sbt index a392cce29..d4241eec8 100644 --- a/build.sbt +++ b/build.sbt @@ -18,7 +18,7 @@ lazy val configSettings: Seq[Setting[_]] = Seq( } ) -lazy val xml = crossProject(JSPlatform, JVMPlatform) +lazy val xml = crossProject(JSPlatform, JVMPlatform, NativePlatform) .withoutSuffixFor(JVMPlatform) .crossType(CrossType.Full) .in(file(".")) @@ -163,3 +163,11 @@ lazy val xml = crossProject(JSPlatform, JVMPlatform) Test / fork := false ) .jsConfigure(_.enablePlugins(ScalaJSJUnitPlugin)) + .nativeSettings( + scalaModuleMimaPreviousVersion := None, // No such release yet + // Scala Native cannot run forked tests + Test / fork := false, + libraryDependencies += "org.scala-native" %%% "junit-runtime" % nativeVersion % Test, + addCompilerPlugin("org.scala-native" % "junit-plugin" % nativeVersion cross CrossVersion.full), + Test / testOptions += Tests.Argument(TestFrameworks.JUnit, "-a", "-s", "-v") + ) diff --git a/build.sh b/build.sh index 4c5a682a7..b5253d68b 100755 --- a/build.sh +++ b/build.sh @@ -25,8 +25,10 @@ isReleaseJob() { fi } -if [[ "$SCALAJS_VERSION" == "" ]]; then +if [[ "$SCALAJS_VERSION" == "" ]] && [[ "$SCALANATIVE_VERSION" == "" ]]; then projectPrefix="xml/" +elif [[ "$SCALAJS_VERSION" == "" ]]; then + projectPrefix="xmlNative/" else projectPrefix="xmlJS/" fi diff --git a/project/plugins.sbt b/project/plugins.sbt index ba23fbaeb..ecd454c3c 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,7 +1,12 @@ val scalaJSVersion = Option(System.getenv("SCALAJS_VERSION")).filter(_.nonEmpty).getOrElse("1.4.0") +val scalaNativeVersion = + Option(System.getenv("SCALANATIVE_VERSION")).filter(_.nonEmpty).getOrElse("0.4.0") + addSbtPlugin("org.scala-lang.modules" % "sbt-scala-module" % "2.2.3") addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.0.0") +addSbtPlugin("org.portable-scala" % "sbt-scala-native-crossproject" % "1.0.0") addSbtPlugin("org.scala-js" % "sbt-scalajs" % scalaJSVersion) +addSbtPlugin("org.scala-native" % "sbt-scala-native" % scalaNativeVersion) addSbtPlugin("ch.epfl.lamp" % "sbt-dotty" % "0.5.2") From 154361ba0108477425665b76f18092d43995dd34 Mon Sep 17 00:00:00 2001 From: Lorenzo Gabriele Date: Sat, 23 Jan 2021 19:55:27 +0100 Subject: [PATCH 485/789] Exclude Scala 3 from Scala Native builds --- .travis.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.travis.yml b/.travis.yml index b7ad9c919..4778e5ee8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -17,6 +17,13 @@ env: - SCALAJS_VERSION= ADOPTOPENJDK=11 - SCALAJS_VERSION= ADOPTOPENJDK=15 +jobs: + exclude: + - scala: 3.0.0-M2 + env: SCALANATIVE_VERSION=0.4.0 ADOPTOPENJDK=8 + - scala: 3.0.0-M3 + env: SCALANATIVE_VERSION=0.4.0 ADOPTOPENJDK=8 + install: - git fetch --tags # get all tags for sbt-dynver From 047e95391e6a2a4b6c0aa122e98446f184edd6ea Mon Sep 17 00:00:00 2001 From: Lorenzo Gabriele Date: Sat, 23 Jan 2021 20:13:25 +0100 Subject: [PATCH 486/789] Add junit-runtime in the compile scope --- build.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index d4241eec8..4a869a866 100644 --- a/build.sbt +++ b/build.sbt @@ -167,7 +167,7 @@ lazy val xml = crossProject(JSPlatform, JVMPlatform, NativePlatform) scalaModuleMimaPreviousVersion := None, // No such release yet // Scala Native cannot run forked tests Test / fork := false, - libraryDependencies += "org.scala-native" %%% "junit-runtime" % nativeVersion % Test, + libraryDependencies += "org.scala-native" %%% "junit-runtime" % nativeVersion, addCompilerPlugin("org.scala-native" % "junit-plugin" % nativeVersion cross CrossVersion.full), Test / testOptions += Tests.Argument(TestFrameworks.JUnit, "-a", "-s", "-v") ) From 4dff89960b0cb828b7037d3a0020e54443a5f403 Mon Sep 17 00:00:00 2001 From: Lorenzo Gabriele Date: Fri, 29 Jan 2021 13:55:49 +0100 Subject: [PATCH 487/789] Move JUnit Plugin to the test scope --- build.sbt | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/build.sbt b/build.sbt index 4a869a866..c3a6009cb 100644 --- a/build.sbt +++ b/build.sbt @@ -167,7 +167,23 @@ lazy val xml = crossProject(JSPlatform, JVMPlatform, NativePlatform) scalaModuleMimaPreviousVersion := None, // No such release yet // Scala Native cannot run forked tests Test / fork := false, - libraryDependencies += "org.scala-native" %%% "junit-runtime" % nativeVersion, - addCompilerPlugin("org.scala-native" % "junit-plugin" % nativeVersion cross CrossVersion.full), + libraryDependencies += "org.scala-native" %%% "junit-runtime" % nativeVersion % Test, + Test / scalacOptions += { + val log = streams.value.log + val retrieveDir = baseDirectory.value / "scala-native-junit-plugin-jars" + val lm = dependencyResolution.value + val cp = lm + .retrieve( + "org.scala-native" % s"junit-plugin_${scalaVersion.value}" % nativeVersion, + scalaModuleInfo = None, + retrieveDir, + log + ) + .fold(w => throw w.resolveException, identity(_)) + val jarPath = cp + .find(_.toString.contains(s"/org/scala-native/junit-plugin_${scalaVersion.value}/$nativeVersion/junit-plugin_${scalaVersion.value}-$nativeVersion.jar")) + .getOrElse(throw new Exception("Can't find Scala Native junit-plugin jar")) + s"-Xplugin:$jarPath" + }, Test / testOptions += Tests.Argument(TestFrameworks.JUnit, "-a", "-s", "-v") ) From 79f9bb915fbf87b28c4d32d8961665b245ba23a2 Mon Sep 17 00:00:00 2001 From: Lorenzo Gabriele Date: Fri, 29 Jan 2021 15:13:33 +0100 Subject: [PATCH 488/789] Simplify classpath search MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Sébastien Doeraene --- build.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index c3a6009cb..9ff6394ee 100644 --- a/build.sbt +++ b/build.sbt @@ -181,7 +181,7 @@ lazy val xml = crossProject(JSPlatform, JVMPlatform, NativePlatform) ) .fold(w => throw w.resolveException, identity(_)) val jarPath = cp - .find(_.toString.contains(s"/org/scala-native/junit-plugin_${scalaVersion.value}/$nativeVersion/junit-plugin_${scalaVersion.value}-$nativeVersion.jar")) + .find(_.toString.contains("junit-plugin")) .getOrElse(throw new Exception("Can't find Scala Native junit-plugin jar")) s"-Xplugin:$jarPath" }, From e5f4e516f3737ff9f648a3f2b53299d829d71fc6 Mon Sep 17 00:00:00 2001 From: Lorenzo Gabriele Date: Fri, 29 Jan 2021 17:13:45 +0100 Subject: [PATCH 489/789] Add CircleCI Scala Native steps --- .circleci/config.yml | 36 ++++++++++++++++++++++++++++++++++++ .scalafmt.conf | 1 + 2 files changed, 37 insertions(+) create mode 100644 .scalafmt.conf diff --git a/.circleci/config.yml b/.circleci/config.yml index c91fb5898..099837669 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -13,6 +13,9 @@ executors: scala_jdk16_executor: docker: - image: circleci/openjdk:16-buster + scala_native_executor: + machine: + image: ubuntu-1604:202004-01 commands: sbt_cmd: @@ -76,6 +79,31 @@ jobs: - sbt_cmd: scala_version: << parameters.scala_version >> sbt_tasks: xmlJS/update xmlJS/compile xmlJS/test:compile xmlJS/test xmlJS/doc xmlJS/package + scalanative_job: + executor: scala_native_executor + parameters: + scala_version: + description: "Scala version" + default: 2.12.13 + type: string + scalanative_version: + description: "Scala Native version" + default: 0.4.0 + type: string + environment: + SCALANATIVE_VERSION: << parameters.scalanative_version >> + steps: + - checkout + - run: + name: Install dependencies + command: | + echo "deb https://dl.bintray.com/sbt/debian /" | sudo tee -a /etc/apt/sources.list.d/sbt.list + curl -sL "https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x2EE0EA64E40A89B84B2DF73499E82A75642AC823" | sudo apt-key add + sudo apt-get update + sudo apt-get install sbt clang-8 openjdk-8-jdk + - sbt_cmd: + scala_version: << parameters.scala_version >> + sbt_tasks: xmlNative/update xmlNative/compile xmlNative/test:compile xmlNative/test xmlNative/doc xmlNative/package workflows: build: @@ -140,3 +168,11 @@ workflows: name: sjs1.0_2.13 scala_version: 2.13.4 scalajs_version: 1.4.0 + - scalanative_job: + name: native0.4_2.12 + scala_version: 2.12.13 + scalanative_version: 0.4.0 + - scalanative_job: + name: native0.4_2.13 + scala_version: 2.13.4 + scalanative_version: 0.4.0 diff --git a/.scalafmt.conf b/.scalafmt.conf new file mode 100644 index 000000000..ffbdff9fd --- /dev/null +++ b/.scalafmt.conf @@ -0,0 +1 @@ +version = "2.7.4" From 03bb7ad82c335c2f725adcd7213bd5bd9ea1e433 Mon Sep 17 00:00:00 2001 From: Lorenzo Gabriele Date: Fri, 29 Jan 2021 17:25:32 +0100 Subject: [PATCH 490/789] Add clang system links --- .circleci/config.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index 099837669..52c67f749 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -101,6 +101,8 @@ jobs: curl -sL "https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x2EE0EA64E40A89B84B2DF73499E82A75642AC823" | sudo apt-key add sudo apt-get update sudo apt-get install sbt clang-8 openjdk-8-jdk + sudo ln -s /usr/lib/llvm-8/bin/clang /usr/bin/clang + sudo ln -s /usr/lib/llvm-8/bin/clang++ /usr/bin/clang++ - sbt_cmd: scala_version: << parameters.scala_version >> sbt_tasks: xmlNative/update xmlNative/compile xmlNative/test:compile xmlNative/test xmlNative/doc xmlNative/package From 05c8ba2de0e7155f4e97a601237853c72fba5c47 Mon Sep 17 00:00:00 2001 From: Lorenzo Gabriele Date: Fri, 29 Jan 2021 17:32:38 +0100 Subject: [PATCH 491/789] Add -y to apt-get install command in CircleCI --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 52c67f749..a5f38c020 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -100,7 +100,7 @@ jobs: echo "deb https://dl.bintray.com/sbt/debian /" | sudo tee -a /etc/apt/sources.list.d/sbt.list curl -sL "https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x2EE0EA64E40A89B84B2DF73499E82A75642AC823" | sudo apt-key add sudo apt-get update - sudo apt-get install sbt clang-8 openjdk-8-jdk + sudo apt-get install -y sbt clang-8 openjdk-8-jdk sudo ln -s /usr/lib/llvm-8/bin/clang /usr/bin/clang sudo ln -s /usr/lib/llvm-8/bin/clang++ /usr/bin/clang++ - sbt_cmd: From e1f39320d9c2853886829f60ebe79bddc2825399 Mon Sep 17 00:00:00 2001 From: Scala Steward <43047562+scala-steward@users.noreply.github.com> Date: Mon, 1 Feb 2021 06:08:31 +0100 Subject: [PATCH 492/789] Update sbt to 1.4.7 (#486) --- project/build.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/build.properties b/project/build.properties index d91c272d4..0b2e09c5a 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version=1.4.6 +sbt.version=1.4.7 From 079426dadd77b12f671319a4fdc4e211c797db69 Mon Sep 17 00:00:00 2001 From: Seth Tisue Date: Sun, 31 Jan 2021 21:09:40 -0800 Subject: [PATCH 493/789] copyright 2021 --- NOTICE | 4 ++-- build.sbt | 15 ++++++++++++++ project/plugins.sbt | 1 + .../scala/xml/ScalaVersionSpecific.scala | 12 +++++++++++ shared/src/main/scala/scala/xml/Atom.scala | 18 ++++++++++------- .../src/main/scala/scala/xml/Attribute.scala | 18 ++++++++++------- shared/src/main/scala/scala/xml/Comment.scala | 18 ++++++++++------- .../src/main/scala/scala/xml/Document.scala | 18 ++++++++++------- shared/src/main/scala/scala/xml/Elem.scala | 20 ++++++++++--------- .../src/main/scala/scala/xml/EntityRef.scala | 18 ++++++++++------- .../src/main/scala/scala/xml/Equality.scala | 18 ++++++++++------- shared/src/main/scala/scala/xml/Group.scala | 18 ++++++++++------- .../xml/MalformedAttributeException.scala | 18 ++++++++++------- .../src/main/scala/scala/xml/MetaData.scala | 20 ++++++++++--------- .../scala/scala/xml/NamespaceBinding.scala | 18 ++++++++++------- shared/src/main/scala/scala/xml/Node.scala | 18 ++++++++++------- .../src/main/scala/scala/xml/NodeBuffer.scala | 18 ++++++++++------- shared/src/main/scala/scala/xml/NodeSeq.scala | 18 ++++++++++------- shared/src/main/scala/scala/xml/Null.scala | 18 ++++++++++------- shared/src/main/scala/scala/xml/PCData.scala | 18 ++++++++++------- .../scala/scala/xml/PrefixedAttribute.scala | 18 ++++++++++------- .../main/scala/scala/xml/PrettyPrinter.scala | 18 ++++++++++------- .../src/main/scala/scala/xml/ProcInstr.scala | 18 ++++++++++------- shared/src/main/scala/scala/xml/QNode.scala | 18 ++++++++++------- .../main/scala/scala/xml/SpecialNode.scala | 18 ++++++++++------- shared/src/main/scala/scala/xml/Text.scala | 18 ++++++++++------- .../src/main/scala/scala/xml/TextBuffer.scala | 18 ++++++++++------- .../src/main/scala/scala/xml/TopScope.scala | 18 ++++++++++------- .../src/main/scala/scala/xml/TypeSymbol.scala | 18 ++++++++++------- .../src/main/scala/scala/xml/Unparsed.scala | 18 ++++++++++------- .../scala/scala/xml/UnprefixedAttribute.scala | 18 ++++++++++------- shared/src/main/scala/scala/xml/Utility.scala | 18 ++++++++++------- shared/src/main/scala/scala/xml/XML.scala | 18 ++++++++++------- shared/src/main/scala/scala/xml/Xhtml.scala | 18 ++++++++++------- .../scala/scala/xml/dtd/ContentModel.scala | 18 ++++++++++------- shared/src/main/scala/scala/xml/dtd/DTD.scala | 18 ++++++++++------- .../src/main/scala/scala/xml/dtd/Decl.scala | 18 ++++++++++------- .../main/scala/scala/xml/dtd/DocType.scala | 18 ++++++++++------- .../main/scala/scala/xml/dtd/ExternalID.scala | 18 ++++++++++------- .../src/main/scala/scala/xml/dtd/Tokens.scala | 18 ++++++++++------- .../scala/xml/dtd/ValidationException.scala | 18 ++++++++++------- .../main/scala/scala/xml/dtd/impl/Base.scala | 18 ++++++++++------- .../scala/xml/dtd/impl/BaseBerrySethi.scala | 18 ++++++++++------- .../scala/xml/dtd/impl/DetWordAutom.scala | 18 ++++++++++------- .../scala/scala/xml/dtd/impl/Inclusion.scala | 18 ++++++++++------- .../scala/xml/dtd/impl/NondetWordAutom.scala | 18 ++++++++++------- .../xml/dtd/impl/SubsetConstruction.scala | 18 ++++++++++------- .../scala/xml/dtd/impl/SyntaxError.scala | 18 ++++++++++------- .../scala/xml/dtd/impl/WordBerrySethi.scala | 18 ++++++++++------- .../scala/scala/xml/dtd/impl/WordExp.scala | 18 ++++++++++------- .../scala/xml/factory/LoggedNodeFactory.scala | 18 ++++++++++------- .../scala/scala/xml/factory/NodeFactory.scala | 18 ++++++++++------- .../scala/scala/xml/factory/XMLLoader.scala | 18 ++++++++++------- .../include/CircularIncludeException.scala | 18 ++++++++++------- .../UnavailableResourceException.scala | 18 ++++++++++------- .../scala/xml/include/XIncludeException.scala | 18 ++++++++++------- .../xml/include/sax/EncodingHeuristics.scala | 18 ++++++++++------- .../xml/include/sax/XIncludeFilter.scala | 18 ++++++++++------- .../scala/xml/include/sax/XIncluder.scala | 18 ++++++++++------- shared/src/main/scala/scala/xml/package.scala | 18 ++++++++++------- .../xml/parsing/ConstructingHandler.scala | 18 ++++++++++------- .../xml/parsing/ConstructingParser.scala | 18 ++++++++++------- .../xml/parsing/DefaultMarkupHandler.scala | 18 ++++++++++------- .../scala/xml/parsing/ExternalSources.scala | 18 ++++++++++------- .../scala/xml/parsing/FactoryAdapter.scala | 18 ++++++++++------- .../scala/scala/xml/parsing/FatalError.scala | 18 ++++++++++------- .../scala/xml/parsing/MarkupHandler.scala | 18 ++++++++++------- .../scala/xml/parsing/MarkupParser.scala | 18 ++++++++++------- .../xml/parsing/MarkupParserCommon.scala | 18 ++++++++++------- .../xml/parsing/NoBindingFactoryAdapter.scala | 18 ++++++++++------- .../scala/scala/xml/parsing/TokenTests.scala | 18 ++++++++++------- .../scala/xml/parsing/XhtmlEntities.scala | 18 ++++++++++------- .../scala/scala/xml/parsing/XhtmlParser.scala | 18 ++++++++++------- .../xml/transform/BasicTransformer.scala | 18 ++++++++++------- .../xml/transform/NestingTransformer.scala | 18 ++++++++++------- .../scala/xml/transform/RewriteRule.scala | 18 ++++++++++------- .../scala/xml/transform/RuleTransformer.scala | 18 ++++++++++------- 77 files changed, 833 insertions(+), 517 deletions(-) diff --git a/NOTICE b/NOTICE index 55798713d..006f16089 100644 --- a/NOTICE +++ b/NOTICE @@ -1,6 +1,6 @@ scala-xml -Copyright (c) 2002-2020 EPFL -Copyright (c) 2011-2020 Lightbend, Inc. +Copyright (c) 2002-2021 EPFL +Copyright (c) 2011-2021 Lightbend, Inc. scala-xml includes software developed at LAMP/EPFL (https://lamp.epfl.ch/) and diff --git a/build.sbt b/build.sbt index 9ff6394ee..936ff74f9 100644 --- a/build.sbt +++ b/build.sbt @@ -1,5 +1,8 @@ import sbtcrossproject.CrossPlugin.autoImport.{crossProject, CrossType} +ThisBuild / startYear := Some(2002) +ThisBuild / licenses += (("Apache-2.0", url("https://www.apache.org/licenses/LICENSE-2.0"))) + lazy val configSettings: Seq[Setting[_]] = Seq( unmanagedSourceDirectories ++= { unmanagedSourceDirectories.value.flatMap { dir => @@ -43,6 +46,18 @@ lazy val xml = crossProject(JSPlatform, JVMPlatform, NativePlatform) // but we leave `publishArtifact` set to true, otherwise Sonatype won't let us publish Compile / doc / sources := (if (isDotty.value) Seq() else (Compile / doc/ sources).value), + headerLicense := Some(HeaderLicense.Custom( + s"""|Scala (https://www.scala-lang.org) + | + |Copyright EPFL and Lightbend, Inc. + | + |Licensed under Apache License 2.0 + |(http://www.apache.org/licenses/LICENSE-2.0). + | + |See the NOTICE file distributed with this work for + |additional information regarding copyright ownership. + |""".stripMargin)), + scalaModuleMimaPreviousVersion := { if (isDotty.value) None // No such release yet else Some("1.3.0") diff --git a/project/plugins.sbt b/project/plugins.sbt index ecd454c3c..4f9ce3b67 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -10,3 +10,4 @@ addSbtPlugin("org.portable-scala" % "sbt-scala-native-crossproject" % "1.0.0") addSbtPlugin("org.scala-js" % "sbt-scalajs" % scalaJSVersion) addSbtPlugin("org.scala-native" % "sbt-scala-native" % scalaNativeVersion) addSbtPlugin("ch.epfl.lamp" % "sbt-dotty" % "0.5.2") +addSbtPlugin("de.heikoseeberger" % "sbt-header" % "5.6.0") diff --git a/shared/src/main/scala-2.13+/scala/xml/ScalaVersionSpecific.scala b/shared/src/main/scala-2.13+/scala/xml/ScalaVersionSpecific.scala index 4258c100f..f2cdb817d 100644 --- a/shared/src/main/scala-2.13+/scala/xml/ScalaVersionSpecific.scala +++ b/shared/src/main/scala-2.13+/scala/xml/ScalaVersionSpecific.scala @@ -1,3 +1,15 @@ +/* + * Scala (https://www.scala-lang.org) + * + * Copyright EPFL and Lightbend, Inc. + * + * Licensed under Apache License 2.0 + * (http://www.apache.org/licenses/LICENSE-2.0). + * + * See the NOTICE file distributed with this work for + * additional information regarding copyright ownership. + */ + package scala.xml import scala.collection.immutable.StrictOptimizedSeqOps diff --git a/shared/src/main/scala/scala/xml/Atom.scala b/shared/src/main/scala/scala/xml/Atom.scala index c6ae51eac..89f805c28 100644 --- a/shared/src/main/scala/scala/xml/Atom.scala +++ b/shared/src/main/scala/scala/xml/Atom.scala @@ -1,10 +1,14 @@ -/* __ *\ -** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2020, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | (c) 2011-2020, Lightbend, Inc. ** -** /____/\___/_/ |_/____/_/ | | http://scala-lang.org/ ** -** |/ ** -\* */ +/* + * Scala (https://www.scala-lang.org) + * + * Copyright EPFL and Lightbend, Inc. + * + * Licensed under Apache License 2.0 + * (http://www.apache.org/licenses/LICENSE-2.0). + * + * See the NOTICE file distributed with this work for + * additional information regarding copyright ownership. + */ package scala package xml diff --git a/shared/src/main/scala/scala/xml/Attribute.scala b/shared/src/main/scala/scala/xml/Attribute.scala index 5ee69b138..e73c6c8b9 100644 --- a/shared/src/main/scala/scala/xml/Attribute.scala +++ b/shared/src/main/scala/scala/xml/Attribute.scala @@ -1,10 +1,14 @@ -/* __ *\ -** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2020, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | (c) 2011-2020, Lightbend, Inc. ** -** /____/\___/_/ |_/____/_/ | | http://scala-lang.org/ ** -** |/ ** -\* */ +/* + * Scala (https://www.scala-lang.org) + * + * Copyright EPFL and Lightbend, Inc. + * + * Licensed under Apache License 2.0 + * (http://www.apache.org/licenses/LICENSE-2.0). + * + * See the NOTICE file distributed with this work for + * additional information regarding copyright ownership. + */ package scala package xml diff --git a/shared/src/main/scala/scala/xml/Comment.scala b/shared/src/main/scala/scala/xml/Comment.scala index de5dd4db4..52b6e787d 100644 --- a/shared/src/main/scala/scala/xml/Comment.scala +++ b/shared/src/main/scala/scala/xml/Comment.scala @@ -1,10 +1,14 @@ -/* __ *\ -** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2020, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | (c) 2011-2020, Lightbend, Inc. ** -** /____/\___/_/ |_/____/_/ | | http://scala-lang.org/ ** -** |/ ** -\* */ +/* + * Scala (https://www.scala-lang.org) + * + * Copyright EPFL and Lightbend, Inc. + * + * Licensed under Apache License 2.0 + * (http://www.apache.org/licenses/LICENSE-2.0). + * + * See the NOTICE file distributed with this work for + * additional information regarding copyright ownership. + */ package scala package xml diff --git a/shared/src/main/scala/scala/xml/Document.scala b/shared/src/main/scala/scala/xml/Document.scala index 3c20db529..5ea235bf7 100644 --- a/shared/src/main/scala/scala/xml/Document.scala +++ b/shared/src/main/scala/scala/xml/Document.scala @@ -1,10 +1,14 @@ -/* __ *\ -** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2020, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | (c) 2011-2020, Lightbend, Inc. ** -** /____/\___/_/ |_/____/_/ | | http://scala-lang.org/ ** -** |/ ** -\* */ +/* + * Scala (https://www.scala-lang.org) + * + * Copyright EPFL and Lightbend, Inc. + * + * Licensed under Apache License 2.0 + * (http://www.apache.org/licenses/LICENSE-2.0). + * + * See the NOTICE file distributed with this work for + * additional information regarding copyright ownership. + */ package scala package xml diff --git a/shared/src/main/scala/scala/xml/Elem.scala b/shared/src/main/scala/scala/xml/Elem.scala index ae1ee7bf0..9015c4b9e 100755 --- a/shared/src/main/scala/scala/xml/Elem.scala +++ b/shared/src/main/scala/scala/xml/Elem.scala @@ -1,12 +1,14 @@ -/* __ *\ -** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2002-2020, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | (c) 2011-2020, Lightbend, Inc. ** -** /____/\___/_/ |_/____/_/ | | http://scala-lang.org/ ** -** |/ ** -** Copyright 2008 Google Inc. ** -** All Rights Reserved. ** -\* */ +/* + * Scala (https://www.scala-lang.org) + * + * Copyright EPFL and Lightbend, Inc. + * + * Licensed under Apache License 2.0 + * (http://www.apache.org/licenses/LICENSE-2.0). + * + * See the NOTICE file distributed with this work for + * additional information regarding copyright ownership. + */ package scala package xml diff --git a/shared/src/main/scala/scala/xml/EntityRef.scala b/shared/src/main/scala/scala/xml/EntityRef.scala index 8b5df563f..1e94db5fd 100644 --- a/shared/src/main/scala/scala/xml/EntityRef.scala +++ b/shared/src/main/scala/scala/xml/EntityRef.scala @@ -1,10 +1,14 @@ -/* __ *\ -** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2020, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | (c) 2011-2020, Lightbend, Inc. ** -** /____/\___/_/ |_/____/_/ | | http://scala-lang.org/ ** -** |/ ** -\* */ +/* + * Scala (https://www.scala-lang.org) + * + * Copyright EPFL and Lightbend, Inc. + * + * Licensed under Apache License 2.0 + * (http://www.apache.org/licenses/LICENSE-2.0). + * + * See the NOTICE file distributed with this work for + * additional information regarding copyright ownership. + */ package scala package xml diff --git a/shared/src/main/scala/scala/xml/Equality.scala b/shared/src/main/scala/scala/xml/Equality.scala index fdfd2e9bf..716a912e1 100644 --- a/shared/src/main/scala/scala/xml/Equality.scala +++ b/shared/src/main/scala/scala/xml/Equality.scala @@ -1,10 +1,14 @@ -/* __ *\ -** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2020, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | (c) 2011-2020, Lightbend, Inc. ** -** /____/\___/_/ |_/____/_/ | | http://scala-lang.org/ ** -** |/ ** -\* */ +/* + * Scala (https://www.scala-lang.org) + * + * Copyright EPFL and Lightbend, Inc. + * + * Licensed under Apache License 2.0 + * (http://www.apache.org/licenses/LICENSE-2.0). + * + * See the NOTICE file distributed with this work for + * additional information regarding copyright ownership. + */ package scala package xml diff --git a/shared/src/main/scala/scala/xml/Group.scala b/shared/src/main/scala/scala/xml/Group.scala index d9fdf4427..a53b0f681 100644 --- a/shared/src/main/scala/scala/xml/Group.scala +++ b/shared/src/main/scala/scala/xml/Group.scala @@ -1,10 +1,14 @@ -/* __ *\ -** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2020, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | (c) 2011-2020, Lightbend, Inc. ** -** /____/\___/_/ |_/____/_/ | | http://scala-lang.org/ ** -** |/ ** -\* */ +/* + * Scala (https://www.scala-lang.org) + * + * Copyright EPFL and Lightbend, Inc. + * + * Licensed under Apache License 2.0 + * (http://www.apache.org/licenses/LICENSE-2.0). + * + * See the NOTICE file distributed with this work for + * additional information regarding copyright ownership. + */ package scala package xml diff --git a/shared/src/main/scala/scala/xml/MalformedAttributeException.scala b/shared/src/main/scala/scala/xml/MalformedAttributeException.scala index 9798b1151..5a9fa766d 100644 --- a/shared/src/main/scala/scala/xml/MalformedAttributeException.scala +++ b/shared/src/main/scala/scala/xml/MalformedAttributeException.scala @@ -1,10 +1,14 @@ -/* __ *\ -** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2020, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | (c) 2011-2020, Lightbend, Inc. ** -** /____/\___/_/ |_/____/_/ | | http://scala-lang.org/ ** -** |/ ** -\* */ +/* + * Scala (https://www.scala-lang.org) + * + * Copyright EPFL and Lightbend, Inc. + * + * Licensed under Apache License 2.0 + * (http://www.apache.org/licenses/LICENSE-2.0). + * + * See the NOTICE file distributed with this work for + * additional information regarding copyright ownership. + */ package scala package xml diff --git a/shared/src/main/scala/scala/xml/MetaData.scala b/shared/src/main/scala/scala/xml/MetaData.scala index 32ec2cdca..c36587fc3 100644 --- a/shared/src/main/scala/scala/xml/MetaData.scala +++ b/shared/src/main/scala/scala/xml/MetaData.scala @@ -1,12 +1,14 @@ -/* __ *\ -** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2020, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | (c) 2011-2020, Lightbend, Inc. ** -** /____/\___/_/ |_/____/_/ | | http://scala-lang.org/ ** -** |/ ** -** Copyright 2008 Google Inc. ** -** All Rights Reserved. ** -\* */ +/* + * Scala (https://www.scala-lang.org) + * + * Copyright EPFL and Lightbend, Inc. + * + * Licensed under Apache License 2.0 + * (http://www.apache.org/licenses/LICENSE-2.0). + * + * See the NOTICE file distributed with this work for + * additional information regarding copyright ownership. + */ package scala package xml diff --git a/shared/src/main/scala/scala/xml/NamespaceBinding.scala b/shared/src/main/scala/scala/xml/NamespaceBinding.scala index 9cdcd8dd6..7a750d37c 100644 --- a/shared/src/main/scala/scala/xml/NamespaceBinding.scala +++ b/shared/src/main/scala/scala/xml/NamespaceBinding.scala @@ -1,10 +1,14 @@ -/* __ *\ -** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2002-2020, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | (c) 2011-2020, Lightbend, Inc. ** -** /____/\___/_/ |_/____/_/ | | http://scala-lang.org/ ** -** |/ ** -\* */ +/* + * Scala (https://www.scala-lang.org) + * + * Copyright EPFL and Lightbend, Inc. + * + * Licensed under Apache License 2.0 + * (http://www.apache.org/licenses/LICENSE-2.0). + * + * See the NOTICE file distributed with this work for + * additional information regarding copyright ownership. + */ package scala package xml diff --git a/shared/src/main/scala/scala/xml/Node.scala b/shared/src/main/scala/scala/xml/Node.scala index 34d7f2011..d1a34338b 100755 --- a/shared/src/main/scala/scala/xml/Node.scala +++ b/shared/src/main/scala/scala/xml/Node.scala @@ -1,10 +1,14 @@ -/* __ *\ -** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2020, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | (c) 2011-2020, Lightbend, Inc. ** -** /____/\___/_/ |_/____/_/ | | http://scala-lang.org/ ** -** |/ ** -\* */ +/* + * Scala (https://www.scala-lang.org) + * + * Copyright EPFL and Lightbend, Inc. + * + * Licensed under Apache License 2.0 + * (http://www.apache.org/licenses/LICENSE-2.0). + * + * See the NOTICE file distributed with this work for + * additional information regarding copyright ownership. + */ package scala package xml diff --git a/shared/src/main/scala/scala/xml/NodeBuffer.scala b/shared/src/main/scala/scala/xml/NodeBuffer.scala index 275211fda..363f2dea5 100644 --- a/shared/src/main/scala/scala/xml/NodeBuffer.scala +++ b/shared/src/main/scala/scala/xml/NodeBuffer.scala @@ -1,10 +1,14 @@ -/* __ *\ -** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2020, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | (c) 2011-2020, Lightbend, Inc. ** -** /____/\___/_/ |_/____/_/ | | http://scala-lang.org/ ** -** |/ ** -\* */ +/* + * Scala (https://www.scala-lang.org) + * + * Copyright EPFL and Lightbend, Inc. + * + * Licensed under Apache License 2.0 + * (http://www.apache.org/licenses/LICENSE-2.0). + * + * See the NOTICE file distributed with this work for + * additional information regarding copyright ownership. + */ package scala package xml diff --git a/shared/src/main/scala/scala/xml/NodeSeq.scala b/shared/src/main/scala/scala/xml/NodeSeq.scala index 5c77279b8..7f7daf638 100644 --- a/shared/src/main/scala/scala/xml/NodeSeq.scala +++ b/shared/src/main/scala/scala/xml/NodeSeq.scala @@ -1,10 +1,14 @@ -/* __ *\ -** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2020, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | (c) 2011-2020, Lightbend, Inc. ** -** /____/\___/_/ |_/____/_/ | | http://scala-lang.org/ ** -** |/ ** -\* */ +/* + * Scala (https://www.scala-lang.org) + * + * Copyright EPFL and Lightbend, Inc. + * + * Licensed under Apache License 2.0 + * (http://www.apache.org/licenses/LICENSE-2.0). + * + * See the NOTICE file distributed with this work for + * additional information regarding copyright ownership. + */ package scala package xml diff --git a/shared/src/main/scala/scala/xml/Null.scala b/shared/src/main/scala/scala/xml/Null.scala index 4ca30aba0..b98965910 100644 --- a/shared/src/main/scala/scala/xml/Null.scala +++ b/shared/src/main/scala/scala/xml/Null.scala @@ -1,10 +1,14 @@ -/* __ *\ -** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2020, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | (c) 2011-2020, Lightbend, Inc. ** -** /____/\___/_/ |_/____/_/ | | http://scala-lang.org/ ** -** |/ ** -\* */ +/* + * Scala (https://www.scala-lang.org) + * + * Copyright EPFL and Lightbend, Inc. + * + * Licensed under Apache License 2.0 + * (http://www.apache.org/licenses/LICENSE-2.0). + * + * See the NOTICE file distributed with this work for + * additional information regarding copyright ownership. + */ package scala package xml diff --git a/shared/src/main/scala/scala/xml/PCData.scala b/shared/src/main/scala/scala/xml/PCData.scala index eeaeff1eb..0b85bfe88 100644 --- a/shared/src/main/scala/scala/xml/PCData.scala +++ b/shared/src/main/scala/scala/xml/PCData.scala @@ -1,10 +1,14 @@ -/* __ *\ -** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2020, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | (c) 2011-2020, Lightbend, Inc. ** -** /____/\___/_/ |_/____/_/ | | http://scala-lang.org/ ** -** |/ ** -\* */ +/* + * Scala (https://www.scala-lang.org) + * + * Copyright EPFL and Lightbend, Inc. + * + * Licensed under Apache License 2.0 + * (http://www.apache.org/licenses/LICENSE-2.0). + * + * See the NOTICE file distributed with this work for + * additional information regarding copyright ownership. + */ package scala package xml diff --git a/shared/src/main/scala/scala/xml/PrefixedAttribute.scala b/shared/src/main/scala/scala/xml/PrefixedAttribute.scala index 10c6ef608..56c5a66ed 100644 --- a/shared/src/main/scala/scala/xml/PrefixedAttribute.scala +++ b/shared/src/main/scala/scala/xml/PrefixedAttribute.scala @@ -1,10 +1,14 @@ -/* __ *\ -** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2020, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | (c) 2011-2020, Lightbend, Inc. ** -** /____/\___/_/ |_/____/_/ | | http://scala-lang.org/ ** -** |/ ** -\* */ +/* + * Scala (https://www.scala-lang.org) + * + * Copyright EPFL and Lightbend, Inc. + * + * Licensed under Apache License 2.0 + * (http://www.apache.org/licenses/LICENSE-2.0). + * + * See the NOTICE file distributed with this work for + * additional information regarding copyright ownership. + */ package scala package xml diff --git a/shared/src/main/scala/scala/xml/PrettyPrinter.scala b/shared/src/main/scala/scala/xml/PrettyPrinter.scala index 57c8c0b9a..c99893d5e 100755 --- a/shared/src/main/scala/scala/xml/PrettyPrinter.scala +++ b/shared/src/main/scala/scala/xml/PrettyPrinter.scala @@ -1,10 +1,14 @@ -/* __ *\ -** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2020, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | (c) 2011-2020, Lightbend, Inc. ** -** /____/\___/_/ |_/____/_/ | | http://scala-lang.org/ ** -** |/ ** -\* */ +/* + * Scala (https://www.scala-lang.org) + * + * Copyright EPFL and Lightbend, Inc. + * + * Licensed under Apache License 2.0 + * (http://www.apache.org/licenses/LICENSE-2.0). + * + * See the NOTICE file distributed with this work for + * additional information regarding copyright ownership. + */ package scala package xml diff --git a/shared/src/main/scala/scala/xml/ProcInstr.scala b/shared/src/main/scala/scala/xml/ProcInstr.scala index 39eb538ad..2bab1d7ef 100644 --- a/shared/src/main/scala/scala/xml/ProcInstr.scala +++ b/shared/src/main/scala/scala/xml/ProcInstr.scala @@ -1,10 +1,14 @@ -/* __ *\ -** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2020, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | (c) 2011-2020, Lightbend, Inc. ** -** /____/\___/_/ |_/____/_/ | | http://scala-lang.org/ ** -** |/ ** -\* */ +/* + * Scala (https://www.scala-lang.org) + * + * Copyright EPFL and Lightbend, Inc. + * + * Licensed under Apache License 2.0 + * (http://www.apache.org/licenses/LICENSE-2.0). + * + * See the NOTICE file distributed with this work for + * additional information regarding copyright ownership. + */ package scala package xml diff --git a/shared/src/main/scala/scala/xml/QNode.scala b/shared/src/main/scala/scala/xml/QNode.scala index 92ed109f9..059297026 100644 --- a/shared/src/main/scala/scala/xml/QNode.scala +++ b/shared/src/main/scala/scala/xml/QNode.scala @@ -1,10 +1,14 @@ -/* __ *\ -** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2020, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | (c) 2011-2020, Lightbend, Inc. ** -** /____/\___/_/ |_/____/_/ | | http://scala-lang.org/ ** -** |/ ** -\* */ +/* + * Scala (https://www.scala-lang.org) + * + * Copyright EPFL and Lightbend, Inc. + * + * Licensed under Apache License 2.0 + * (http://www.apache.org/licenses/LICENSE-2.0). + * + * See the NOTICE file distributed with this work for + * additional information regarding copyright ownership. + */ package scala package xml diff --git a/shared/src/main/scala/scala/xml/SpecialNode.scala b/shared/src/main/scala/scala/xml/SpecialNode.scala index 99b1d6807..775983b14 100644 --- a/shared/src/main/scala/scala/xml/SpecialNode.scala +++ b/shared/src/main/scala/scala/xml/SpecialNode.scala @@ -1,10 +1,14 @@ -/* __ *\ -** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2020, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | (c) 2011-2020, Lightbend, Inc. ** -** /____/\___/_/ |_/____/_/ | | http://scala-lang.org/ ** -** |/ ** -\* */ +/* + * Scala (https://www.scala-lang.org) + * + * Copyright EPFL and Lightbend, Inc. + * + * Licensed under Apache License 2.0 + * (http://www.apache.org/licenses/LICENSE-2.0). + * + * See the NOTICE file distributed with this work for + * additional information regarding copyright ownership. + */ package scala package xml diff --git a/shared/src/main/scala/scala/xml/Text.scala b/shared/src/main/scala/scala/xml/Text.scala index b1b8ef2e4..2136b2462 100644 --- a/shared/src/main/scala/scala/xml/Text.scala +++ b/shared/src/main/scala/scala/xml/Text.scala @@ -1,10 +1,14 @@ -/* __ *\ -** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2020, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | (c) 2011-2020, Lightbend, Inc. ** -** /____/\___/_/ |_/____/_/ | | http://scala-lang.org/ ** -** |/ ** -\* */ +/* + * Scala (https://www.scala-lang.org) + * + * Copyright EPFL and Lightbend, Inc. + * + * Licensed under Apache License 2.0 + * (http://www.apache.org/licenses/LICENSE-2.0). + * + * See the NOTICE file distributed with this work for + * additional information regarding copyright ownership. + */ package scala package xml diff --git a/shared/src/main/scala/scala/xml/TextBuffer.scala b/shared/src/main/scala/scala/xml/TextBuffer.scala index 49835a0ad..d8aed3127 100644 --- a/shared/src/main/scala/scala/xml/TextBuffer.scala +++ b/shared/src/main/scala/scala/xml/TextBuffer.scala @@ -1,10 +1,14 @@ -/* __ *\ -** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2020, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | (c) 2011-2020, Lightbend, Inc. ** -** /____/\___/_/ |_/____/_/ | | http://scala-lang.org/ ** -** |/ ** -\* */ +/* + * Scala (https://www.scala-lang.org) + * + * Copyright EPFL and Lightbend, Inc. + * + * Licensed under Apache License 2.0 + * (http://www.apache.org/licenses/LICENSE-2.0). + * + * See the NOTICE file distributed with this work for + * additional information regarding copyright ownership. + */ package scala package xml diff --git a/shared/src/main/scala/scala/xml/TopScope.scala b/shared/src/main/scala/scala/xml/TopScope.scala index dde97b423..743df8532 100644 --- a/shared/src/main/scala/scala/xml/TopScope.scala +++ b/shared/src/main/scala/scala/xml/TopScope.scala @@ -1,10 +1,14 @@ -/* __ *\ -** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2002-2020, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | (c) 2011-2020, Lightbend, Inc. ** -** /____/\___/_/ |_/____/_/ | | http://scala-lang.org/ ** -** |/ ** -\* */ +/* + * Scala (https://www.scala-lang.org) + * + * Copyright EPFL and Lightbend, Inc. + * + * Licensed under Apache License 2.0 + * (http://www.apache.org/licenses/LICENSE-2.0). + * + * See the NOTICE file distributed with this work for + * additional information regarding copyright ownership. + */ package scala package xml diff --git a/shared/src/main/scala/scala/xml/TypeSymbol.scala b/shared/src/main/scala/scala/xml/TypeSymbol.scala index 17521ebd6..5d1f2590a 100644 --- a/shared/src/main/scala/scala/xml/TypeSymbol.scala +++ b/shared/src/main/scala/scala/xml/TypeSymbol.scala @@ -1,10 +1,14 @@ -/* __ *\ -** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2002-2020, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | (c) 2011-2020, Lightbend, Inc. ** -** /____/\___/_/ |_/____/_/ | | http://scala-lang.org/ ** -** |/ ** -\* */ +/* + * Scala (https://www.scala-lang.org) + * + * Copyright EPFL and Lightbend, Inc. + * + * Licensed under Apache License 2.0 + * (http://www.apache.org/licenses/LICENSE-2.0). + * + * See the NOTICE file distributed with this work for + * additional information regarding copyright ownership. + */ package scala package xml diff --git a/shared/src/main/scala/scala/xml/Unparsed.scala b/shared/src/main/scala/scala/xml/Unparsed.scala index ee59e2635..80bde6873 100644 --- a/shared/src/main/scala/scala/xml/Unparsed.scala +++ b/shared/src/main/scala/scala/xml/Unparsed.scala @@ -1,10 +1,14 @@ -/* __ *\ -** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2020, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | (c) 2011-2020, Lightbend, Inc. ** -** /____/\___/_/ |_/____/_/ | | http://scala-lang.org/ ** -** |/ ** -\* */ +/* + * Scala (https://www.scala-lang.org) + * + * Copyright EPFL and Lightbend, Inc. + * + * Licensed under Apache License 2.0 + * (http://www.apache.org/licenses/LICENSE-2.0). + * + * See the NOTICE file distributed with this work for + * additional information regarding copyright ownership. + */ package scala package xml diff --git a/shared/src/main/scala/scala/xml/UnprefixedAttribute.scala b/shared/src/main/scala/scala/xml/UnprefixedAttribute.scala index 9ff1b5a04..d3b0c6796 100644 --- a/shared/src/main/scala/scala/xml/UnprefixedAttribute.scala +++ b/shared/src/main/scala/scala/xml/UnprefixedAttribute.scala @@ -1,10 +1,14 @@ -/* __ *\ -** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2002-2020, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | (c) 2011-2020, Lightbend, Inc. ** -** /____/\___/_/ |_/____/_/ | | http://scala-lang.org/ ** -** |/ ** -\* */ +/* + * Scala (https://www.scala-lang.org) + * + * Copyright EPFL and Lightbend, Inc. + * + * Licensed under Apache License 2.0 + * (http://www.apache.org/licenses/LICENSE-2.0). + * + * See the NOTICE file distributed with this work for + * additional information regarding copyright ownership. + */ package scala package xml diff --git a/shared/src/main/scala/scala/xml/Utility.scala b/shared/src/main/scala/scala/xml/Utility.scala index d53dab8a8..be5ff3e8d 100755 --- a/shared/src/main/scala/scala/xml/Utility.scala +++ b/shared/src/main/scala/scala/xml/Utility.scala @@ -1,10 +1,14 @@ -/* __ *\ -** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2020, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | (c) 2011-2020, Lightbend, Inc. ** -** /____/\___/_/ |_/____/_/ | | http://scala-lang.org/ ** -** |/ ** -\* */ +/* + * Scala (https://www.scala-lang.org) + * + * Copyright EPFL and Lightbend, Inc. + * + * Licensed under Apache License 2.0 + * (http://www.apache.org/licenses/LICENSE-2.0). + * + * See the NOTICE file distributed with this work for + * additional information regarding copyright ownership. + */ package scala package xml diff --git a/shared/src/main/scala/scala/xml/XML.scala b/shared/src/main/scala/scala/xml/XML.scala index 587681700..ed7ad8336 100755 --- a/shared/src/main/scala/scala/xml/XML.scala +++ b/shared/src/main/scala/scala/xml/XML.scala @@ -1,10 +1,14 @@ -/* __ *\ -** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2020, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | (c) 2011-2020, Lightbend, Inc. ** -** /____/\___/_/ |_/____/_/ | | http://scala-lang.org/ ** -** |/ ** -\* */ +/* + * Scala (https://www.scala-lang.org) + * + * Copyright EPFL and Lightbend, Inc. + * + * Licensed under Apache License 2.0 + * (http://www.apache.org/licenses/LICENSE-2.0). + * + * See the NOTICE file distributed with this work for + * additional information regarding copyright ownership. + */ package scala package xml diff --git a/shared/src/main/scala/scala/xml/Xhtml.scala b/shared/src/main/scala/scala/xml/Xhtml.scala index ce7fab773..614720d54 100644 --- a/shared/src/main/scala/scala/xml/Xhtml.scala +++ b/shared/src/main/scala/scala/xml/Xhtml.scala @@ -1,10 +1,14 @@ -/* __ *\ -** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2020, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | (c) 2011-2020, Lightbend, Inc. ** -** /____/\___/_/ |_/____/_/ | | http://scala-lang.org/ ** -** |/ ** -\* */ +/* + * Scala (https://www.scala-lang.org) + * + * Copyright EPFL and Lightbend, Inc. + * + * Licensed under Apache License 2.0 + * (http://www.apache.org/licenses/LICENSE-2.0). + * + * See the NOTICE file distributed with this work for + * additional information regarding copyright ownership. + */ package scala package xml diff --git a/shared/src/main/scala/scala/xml/dtd/ContentModel.scala b/shared/src/main/scala/scala/xml/dtd/ContentModel.scala index 043e0bf41..0981c6875 100644 --- a/shared/src/main/scala/scala/xml/dtd/ContentModel.scala +++ b/shared/src/main/scala/scala/xml/dtd/ContentModel.scala @@ -1,10 +1,14 @@ -/* __ *\ -** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2002-2020, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | (c) 2011-2020, Lightbend, Inc. ** -** /____/\___/_/ |_/____/_/ | | http://scala-lang.org/ ** -** |/ ** -\* */ +/* + * Scala (https://www.scala-lang.org) + * + * Copyright EPFL and Lightbend, Inc. + * + * Licensed under Apache License 2.0 + * (http://www.apache.org/licenses/LICENSE-2.0). + * + * See the NOTICE file distributed with this work for + * additional information regarding copyright ownership. + */ package scala package xml diff --git a/shared/src/main/scala/scala/xml/dtd/DTD.scala b/shared/src/main/scala/scala/xml/dtd/DTD.scala index dd51edf0c..919c8acb3 100644 --- a/shared/src/main/scala/scala/xml/dtd/DTD.scala +++ b/shared/src/main/scala/scala/xml/dtd/DTD.scala @@ -1,10 +1,14 @@ -/* __ *\ -** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2002-2020, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | (c) 2011-2020, Lightbend, Inc. ** -** /____/\___/_/ |_/____/_/ | | http://scala-lang.org/ ** -** |/ ** -\* */ +/* + * Scala (https://www.scala-lang.org) + * + * Copyright EPFL and Lightbend, Inc. + * + * Licensed under Apache License 2.0 + * (http://www.apache.org/licenses/LICENSE-2.0). + * + * See the NOTICE file distributed with this work for + * additional information regarding copyright ownership. + */ package scala package xml diff --git a/shared/src/main/scala/scala/xml/dtd/Decl.scala b/shared/src/main/scala/scala/xml/dtd/Decl.scala index 7191e5289..5497dbb74 100644 --- a/shared/src/main/scala/scala/xml/dtd/Decl.scala +++ b/shared/src/main/scala/scala/xml/dtd/Decl.scala @@ -1,10 +1,14 @@ -/* __ *\ -** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2020, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | (c) 2011-2020, Lightbend, Inc. ** -** /____/\___/_/ |_/____/_/ | | http://www.scala-lang.org/ ** -** |/ ** -\* */ +/* + * Scala (https://www.scala-lang.org) + * + * Copyright EPFL and Lightbend, Inc. + * + * Licensed under Apache License 2.0 + * (http://www.apache.org/licenses/LICENSE-2.0). + * + * See the NOTICE file distributed with this work for + * additional information regarding copyright ownership. + */ package scala package xml diff --git a/shared/src/main/scala/scala/xml/dtd/DocType.scala b/shared/src/main/scala/scala/xml/dtd/DocType.scala index deaf3ec56..3e967f03b 100644 --- a/shared/src/main/scala/scala/xml/dtd/DocType.scala +++ b/shared/src/main/scala/scala/xml/dtd/DocType.scala @@ -1,10 +1,14 @@ -/* __ *\ -** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2020, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | (c) 2011-2020, Lightbend, Inc. ** -** /____/\___/_/ |_/____/_/ | | http://scala-lang.org/ ** -** |/ ** -\* */ +/* + * Scala (https://www.scala-lang.org) + * + * Copyright EPFL and Lightbend, Inc. + * + * Licensed under Apache License 2.0 + * (http://www.apache.org/licenses/LICENSE-2.0). + * + * See the NOTICE file distributed with this work for + * additional information regarding copyright ownership. + */ package scala package xml diff --git a/shared/src/main/scala/scala/xml/dtd/ExternalID.scala b/shared/src/main/scala/scala/xml/dtd/ExternalID.scala index dd7c18be5..d47b0b173 100644 --- a/shared/src/main/scala/scala/xml/dtd/ExternalID.scala +++ b/shared/src/main/scala/scala/xml/dtd/ExternalID.scala @@ -1,10 +1,14 @@ -/* __ *\ -** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2020, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | (c) 2011-2020, Lightbend, Inc. ** -** /____/\___/_/ |_/____/_/ | | http://www.scala-lang.org/ ** -** |/ ** -\* */ +/* + * Scala (https://www.scala-lang.org) + * + * Copyright EPFL and Lightbend, Inc. + * + * Licensed under Apache License 2.0 + * (http://www.apache.org/licenses/LICENSE-2.0). + * + * See the NOTICE file distributed with this work for + * additional information regarding copyright ownership. + */ package scala package xml diff --git a/shared/src/main/scala/scala/xml/dtd/Tokens.scala b/shared/src/main/scala/scala/xml/dtd/Tokens.scala index 0a93b4a83..9d6542a16 100644 --- a/shared/src/main/scala/scala/xml/dtd/Tokens.scala +++ b/shared/src/main/scala/scala/xml/dtd/Tokens.scala @@ -1,10 +1,14 @@ -/* __ *\ -** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2002-2020, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | (c) 2011-2020, Lightbend, Inc. ** -** /____/\___/_/ |_/____/_/ | | http://www.scala-lang.org/ ** -** |/ ** -\* */ +/* + * Scala (https://www.scala-lang.org) + * + * Copyright EPFL and Lightbend, Inc. + * + * Licensed under Apache License 2.0 + * (http://www.apache.org/licenses/LICENSE-2.0). + * + * See the NOTICE file distributed with this work for + * additional information regarding copyright ownership. + */ package scala package xml diff --git a/shared/src/main/scala/scala/xml/dtd/ValidationException.scala b/shared/src/main/scala/scala/xml/dtd/ValidationException.scala index f135f2aea..3e9af6845 100644 --- a/shared/src/main/scala/scala/xml/dtd/ValidationException.scala +++ b/shared/src/main/scala/scala/xml/dtd/ValidationException.scala @@ -1,10 +1,14 @@ -/* __ *\ -** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2002-2020, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | (c) 2011-2020, Lightbend, Inc. ** -** /____/\___/_/ |_/____/_/ | | http://www.scala-lang.org/ ** -** |/ ** -\* */ +/* + * Scala (https://www.scala-lang.org) + * + * Copyright EPFL and Lightbend, Inc. + * + * Licensed under Apache License 2.0 + * (http://www.apache.org/licenses/LICENSE-2.0). + * + * See the NOTICE file distributed with this work for + * additional information regarding copyright ownership. + */ package scala package xml diff --git a/shared/src/main/scala/scala/xml/dtd/impl/Base.scala b/shared/src/main/scala/scala/xml/dtd/impl/Base.scala index 7b567aecf..e042e709f 100644 --- a/shared/src/main/scala/scala/xml/dtd/impl/Base.scala +++ b/shared/src/main/scala/scala/xml/dtd/impl/Base.scala @@ -1,10 +1,14 @@ -/* __ *\ -** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2020, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | (c) 2011-2020, Lightbend, Inc. ** -** /____/\___/_/ |_/____/_/ | | http://scala-lang.org/ ** -** |/ ** -\* */ +/* + * Scala (https://www.scala-lang.org) + * + * Copyright EPFL and Lightbend, Inc. + * + * Licensed under Apache License 2.0 + * (http://www.apache.org/licenses/LICENSE-2.0). + * + * See the NOTICE file distributed with this work for + * additional information regarding copyright ownership. + */ package scala package xml.dtd.impl diff --git a/shared/src/main/scala/scala/xml/dtd/impl/BaseBerrySethi.scala b/shared/src/main/scala/scala/xml/dtd/impl/BaseBerrySethi.scala index d02490240..84ea9fdb0 100644 --- a/shared/src/main/scala/scala/xml/dtd/impl/BaseBerrySethi.scala +++ b/shared/src/main/scala/scala/xml/dtd/impl/BaseBerrySethi.scala @@ -1,10 +1,14 @@ -/* __ *\ -** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2020, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | (c) 2011-2020, Lightbend, Inc. ** -** /____/\___/_/ |_/____/_/ | | http://scala-lang.org/ ** -** |/ ** -\* */ +/* + * Scala (https://www.scala-lang.org) + * + * Copyright EPFL and Lightbend, Inc. + * + * Licensed under Apache License 2.0 + * (http://www.apache.org/licenses/LICENSE-2.0). + * + * See the NOTICE file distributed with this work for + * additional information regarding copyright ownership. + */ package scala package xml.dtd.impl diff --git a/shared/src/main/scala/scala/xml/dtd/impl/DetWordAutom.scala b/shared/src/main/scala/scala/xml/dtd/impl/DetWordAutom.scala index a336fb02e..ffd7e27d2 100644 --- a/shared/src/main/scala/scala/xml/dtd/impl/DetWordAutom.scala +++ b/shared/src/main/scala/scala/xml/dtd/impl/DetWordAutom.scala @@ -1,10 +1,14 @@ -/* __ *\ -** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2020, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | (c) 2011-2020, Lightbend, Inc. ** -** /____/\___/_/ |_/____/_/ | | http://scala-lang.org/ ** -** |/ ** -\* */ +/* + * Scala (https://www.scala-lang.org) + * + * Copyright EPFL and Lightbend, Inc. + * + * Licensed under Apache License 2.0 + * (http://www.apache.org/licenses/LICENSE-2.0). + * + * See the NOTICE file distributed with this work for + * additional information regarding copyright ownership. + */ package scala package xml.dtd.impl diff --git a/shared/src/main/scala/scala/xml/dtd/impl/Inclusion.scala b/shared/src/main/scala/scala/xml/dtd/impl/Inclusion.scala index 1b1d7c09d..8cc36cd88 100644 --- a/shared/src/main/scala/scala/xml/dtd/impl/Inclusion.scala +++ b/shared/src/main/scala/scala/xml/dtd/impl/Inclusion.scala @@ -1,10 +1,14 @@ -/* __ *\ -** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2020, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | (c) 2011-2020, Lightbend, Inc. ** -** /____/\___/_/ |_/____/_/ | | http://scala-lang.org/ ** -** |/ ** -\* */ +/* + * Scala (https://www.scala-lang.org) + * + * Copyright EPFL and Lightbend, Inc. + * + * Licensed under Apache License 2.0 + * (http://www.apache.org/licenses/LICENSE-2.0). + * + * See the NOTICE file distributed with this work for + * additional information regarding copyright ownership. + */ package scala package xml.dtd.impl diff --git a/shared/src/main/scala/scala/xml/dtd/impl/NondetWordAutom.scala b/shared/src/main/scala/scala/xml/dtd/impl/NondetWordAutom.scala index 5f6f2d156..306f64c0f 100644 --- a/shared/src/main/scala/scala/xml/dtd/impl/NondetWordAutom.scala +++ b/shared/src/main/scala/scala/xml/dtd/impl/NondetWordAutom.scala @@ -1,10 +1,14 @@ -/* __ *\ -** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2020, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | (c) 2011-2020, Lightbend, Inc. ** -** /____/\___/_/ |_/____/_/ | | http://scala-lang.org/ ** -** |/ ** -\* */ +/* + * Scala (https://www.scala-lang.org) + * + * Copyright EPFL and Lightbend, Inc. + * + * Licensed under Apache License 2.0 + * (http://www.apache.org/licenses/LICENSE-2.0). + * + * See the NOTICE file distributed with this work for + * additional information regarding copyright ownership. + */ package scala package xml.dtd.impl diff --git a/shared/src/main/scala/scala/xml/dtd/impl/SubsetConstruction.scala b/shared/src/main/scala/scala/xml/dtd/impl/SubsetConstruction.scala index d793d4b08..5a9f0c089 100644 --- a/shared/src/main/scala/scala/xml/dtd/impl/SubsetConstruction.scala +++ b/shared/src/main/scala/scala/xml/dtd/impl/SubsetConstruction.scala @@ -1,10 +1,14 @@ -/* __ *\ -** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2020, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | (c) 2011-2020, Lightbend, Inc. ** -** /____/\___/_/ |_/____/_/ | | http://scala-lang.org/ ** -** |/ ** -\* */ +/* + * Scala (https://www.scala-lang.org) + * + * Copyright EPFL and Lightbend, Inc. + * + * Licensed under Apache License 2.0 + * (http://www.apache.org/licenses/LICENSE-2.0). + * + * See the NOTICE file distributed with this work for + * additional information regarding copyright ownership. + */ package scala package xml.dtd.impl diff --git a/shared/src/main/scala/scala/xml/dtd/impl/SyntaxError.scala b/shared/src/main/scala/scala/xml/dtd/impl/SyntaxError.scala index 20b396b64..46d7c4713 100644 --- a/shared/src/main/scala/scala/xml/dtd/impl/SyntaxError.scala +++ b/shared/src/main/scala/scala/xml/dtd/impl/SyntaxError.scala @@ -1,10 +1,14 @@ -/* __ *\ -** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2020, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | (c) 2011-2020, Lightbend, Inc. ** -** /____/\___/_/ |_/____/_/ | | http://scala-lang.org/ ** -** |/ ** -\* */ +/* + * Scala (https://www.scala-lang.org) + * + * Copyright EPFL and Lightbend, Inc. + * + * Licensed under Apache License 2.0 + * (http://www.apache.org/licenses/LICENSE-2.0). + * + * See the NOTICE file distributed with this work for + * additional information regarding copyright ownership. + */ package scala package xml.dtd.impl diff --git a/shared/src/main/scala/scala/xml/dtd/impl/WordBerrySethi.scala b/shared/src/main/scala/scala/xml/dtd/impl/WordBerrySethi.scala index ee2ee2be0..58c3a7783 100644 --- a/shared/src/main/scala/scala/xml/dtd/impl/WordBerrySethi.scala +++ b/shared/src/main/scala/scala/xml/dtd/impl/WordBerrySethi.scala @@ -1,10 +1,14 @@ -/* __ *\ -** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2020, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | (c) 2011-2020, Lightbend, Inc. ** -** /____/\___/_/ |_/____/_/ | | http://scala-lang.org/ ** -** |/ ** -\* */ +/* + * Scala (https://www.scala-lang.org) + * + * Copyright EPFL and Lightbend, Inc. + * + * Licensed under Apache License 2.0 + * (http://www.apache.org/licenses/LICENSE-2.0). + * + * See the NOTICE file distributed with this work for + * additional information regarding copyright ownership. + */ package scala package xml.dtd.impl diff --git a/shared/src/main/scala/scala/xml/dtd/impl/WordExp.scala b/shared/src/main/scala/scala/xml/dtd/impl/WordExp.scala index 709dc6fa2..a34eda9c6 100644 --- a/shared/src/main/scala/scala/xml/dtd/impl/WordExp.scala +++ b/shared/src/main/scala/scala/xml/dtd/impl/WordExp.scala @@ -1,10 +1,14 @@ -/* __ *\ -** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2020, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | (c) 2011-2020, Lightbend, Inc. ** -** /____/\___/_/ |_/____/_/ | | http://scala-lang.org/ ** -** |/ ** -\* */ +/* + * Scala (https://www.scala-lang.org) + * + * Copyright EPFL and Lightbend, Inc. + * + * Licensed under Apache License 2.0 + * (http://www.apache.org/licenses/LICENSE-2.0). + * + * See the NOTICE file distributed with this work for + * additional information regarding copyright ownership. + */ package scala package xml.dtd.impl diff --git a/shared/src/main/scala/scala/xml/factory/LoggedNodeFactory.scala b/shared/src/main/scala/scala/xml/factory/LoggedNodeFactory.scala index 4acbe86dc..a1932cb92 100644 --- a/shared/src/main/scala/scala/xml/factory/LoggedNodeFactory.scala +++ b/shared/src/main/scala/scala/xml/factory/LoggedNodeFactory.scala @@ -1,10 +1,14 @@ -/* __ *\ -** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2002-2020, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | (c) 2011-2020, Lightbend, Inc. ** -** /____/\___/_/ |_/____/_/ | | http://scala-lang.org/ ** -** |/ ** -\* */ +/* + * Scala (https://www.scala-lang.org) + * + * Copyright EPFL and Lightbend, Inc. + * + * Licensed under Apache License 2.0 + * (http://www.apache.org/licenses/LICENSE-2.0). + * + * See the NOTICE file distributed with this work for + * additional information regarding copyright ownership. + */ package scala package xml diff --git a/shared/src/main/scala/scala/xml/factory/NodeFactory.scala b/shared/src/main/scala/scala/xml/factory/NodeFactory.scala index 15a63b396..ad70d8885 100644 --- a/shared/src/main/scala/scala/xml/factory/NodeFactory.scala +++ b/shared/src/main/scala/scala/xml/factory/NodeFactory.scala @@ -1,10 +1,14 @@ -/* __ *\ -** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2020, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | (c) 2011-2020, Lightbend, Inc. ** -** /____/\___/_/ |_/____/_/ | | http://scala-lang.org/ ** -** |/ ** -\* */ +/* + * Scala (https://www.scala-lang.org) + * + * Copyright EPFL and Lightbend, Inc. + * + * Licensed under Apache License 2.0 + * (http://www.apache.org/licenses/LICENSE-2.0). + * + * See the NOTICE file distributed with this work for + * additional information regarding copyright ownership. + */ package scala package xml diff --git a/shared/src/main/scala/scala/xml/factory/XMLLoader.scala b/shared/src/main/scala/scala/xml/factory/XMLLoader.scala index dd4b6339c..5f60acc2a 100644 --- a/shared/src/main/scala/scala/xml/factory/XMLLoader.scala +++ b/shared/src/main/scala/scala/xml/factory/XMLLoader.scala @@ -1,10 +1,14 @@ -/* __ *\ -** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2020, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | (c) 2011-2020, Lightbend, Inc. ** -** /____/\___/_/ |_/____/_/ | | http://scala-lang.org/ ** -** |/ ** -\* */ +/* + * Scala (https://www.scala-lang.org) + * + * Copyright EPFL and Lightbend, Inc. + * + * Licensed under Apache License 2.0 + * (http://www.apache.org/licenses/LICENSE-2.0). + * + * See the NOTICE file distributed with this work for + * additional information regarding copyright ownership. + */ package scala package xml diff --git a/shared/src/main/scala/scala/xml/include/CircularIncludeException.scala b/shared/src/main/scala/scala/xml/include/CircularIncludeException.scala index 3977bebae..07a20e3f8 100644 --- a/shared/src/main/scala/scala/xml/include/CircularIncludeException.scala +++ b/shared/src/main/scala/scala/xml/include/CircularIncludeException.scala @@ -1,10 +1,14 @@ -/* __ *\ -** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2002-2020, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | (c) 2011-2020, Lightbend, Inc. ** -** /____/\___/_/ |_/____/_/ | | http://scala-lang.org/ ** -** |/ ** -\* */ +/* + * Scala (https://www.scala-lang.org) + * + * Copyright EPFL and Lightbend, Inc. + * + * Licensed under Apache License 2.0 + * (http://www.apache.org/licenses/LICENSE-2.0). + * + * See the NOTICE file distributed with this work for + * additional information regarding copyright ownership. + */ package scala package xml diff --git a/shared/src/main/scala/scala/xml/include/UnavailableResourceException.scala b/shared/src/main/scala/scala/xml/include/UnavailableResourceException.scala index 3f07eccea..7499a3f14 100644 --- a/shared/src/main/scala/scala/xml/include/UnavailableResourceException.scala +++ b/shared/src/main/scala/scala/xml/include/UnavailableResourceException.scala @@ -1,10 +1,14 @@ -/* __ *\ -** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2002-2020, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | (c) 2011-2020, Lightbend, Inc. ** -** /____/\___/_/ |_/____/_/ | | http://scala-lang.org/ ** -** |/ ** -\* */ +/* + * Scala (https://www.scala-lang.org) + * + * Copyright EPFL and Lightbend, Inc. + * + * Licensed under Apache License 2.0 + * (http://www.apache.org/licenses/LICENSE-2.0). + * + * See the NOTICE file distributed with this work for + * additional information regarding copyright ownership. + */ package scala package xml diff --git a/shared/src/main/scala/scala/xml/include/XIncludeException.scala b/shared/src/main/scala/scala/xml/include/XIncludeException.scala index 07d20fe16..89f42dcce 100644 --- a/shared/src/main/scala/scala/xml/include/XIncludeException.scala +++ b/shared/src/main/scala/scala/xml/include/XIncludeException.scala @@ -1,10 +1,14 @@ -/* __ *\ -** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2002-2020, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | (c) 2011-2020, Lightbend, Inc. ** -** /____/\___/_/ |_/____/_/ | | http://scala-lang.org/ ** -** |/ ** -\* */ +/* + * Scala (https://www.scala-lang.org) + * + * Copyright EPFL and Lightbend, Inc. + * + * Licensed under Apache License 2.0 + * (http://www.apache.org/licenses/LICENSE-2.0). + * + * See the NOTICE file distributed with this work for + * additional information regarding copyright ownership. + */ package scala package xml diff --git a/shared/src/main/scala/scala/xml/include/sax/EncodingHeuristics.scala b/shared/src/main/scala/scala/xml/include/sax/EncodingHeuristics.scala index b9937649e..62444f87c 100644 --- a/shared/src/main/scala/scala/xml/include/sax/EncodingHeuristics.scala +++ b/shared/src/main/scala/scala/xml/include/sax/EncodingHeuristics.scala @@ -1,10 +1,14 @@ -/* __ *\ -** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2002-2020, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | (c) 2011-2020, Lightbend, Inc. ** -** /____/\___/_/ |_/____/_/ | | http://scala-lang.org/ ** -** |/ ** -\* */ +/* + * Scala (https://www.scala-lang.org) + * + * Copyright EPFL and Lightbend, Inc. + * + * Licensed under Apache License 2.0 + * (http://www.apache.org/licenses/LICENSE-2.0). + * + * See the NOTICE file distributed with this work for + * additional information regarding copyright ownership. + */ package scala package xml diff --git a/shared/src/main/scala/scala/xml/include/sax/XIncludeFilter.scala b/shared/src/main/scala/scala/xml/include/sax/XIncludeFilter.scala index 4af846259..de10e7706 100644 --- a/shared/src/main/scala/scala/xml/include/sax/XIncludeFilter.scala +++ b/shared/src/main/scala/scala/xml/include/sax/XIncludeFilter.scala @@ -1,10 +1,14 @@ -/* __ *\ -** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2002-2020, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | (c) 2011-2020, Lightbend, Inc. ** -** /____/\___/_/ |_/____/_/ | | http://scala-lang.org/ ** -** |/ ** -\* */ +/* + * Scala (https://www.scala-lang.org) + * + * Copyright EPFL and Lightbend, Inc. + * + * Licensed under Apache License 2.0 + * (http://www.apache.org/licenses/LICENSE-2.0). + * + * See the NOTICE file distributed with this work for + * additional information regarding copyright ownership. + */ package scala package xml diff --git a/shared/src/main/scala/scala/xml/include/sax/XIncluder.scala b/shared/src/main/scala/scala/xml/include/sax/XIncluder.scala index 473df23b9..a54664002 100644 --- a/shared/src/main/scala/scala/xml/include/sax/XIncluder.scala +++ b/shared/src/main/scala/scala/xml/include/sax/XIncluder.scala @@ -1,10 +1,14 @@ -/* __ *\ -** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2002-2020, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | (c) 2011-2020, Lightbend, Inc. ** -** /____/\___/_/ |_/____/_/ | | http://scala-lang.org/ ** -** |/ ** -\* */ +/* + * Scala (https://www.scala-lang.org) + * + * Copyright EPFL and Lightbend, Inc. + * + * Licensed under Apache License 2.0 + * (http://www.apache.org/licenses/LICENSE-2.0). + * + * See the NOTICE file distributed with this work for + * additional information regarding copyright ownership. + */ package scala package xml diff --git a/shared/src/main/scala/scala/xml/package.scala b/shared/src/main/scala/scala/xml/package.scala index 66e2577c9..7847f63ba 100644 --- a/shared/src/main/scala/scala/xml/package.scala +++ b/shared/src/main/scala/scala/xml/package.scala @@ -1,10 +1,14 @@ -/* __ *\ -** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2020, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | (c) 2011-2020, Lightbend, Inc. ** -** /____/\___/_/ |_/____/_/ | | http://scala-lang.org/ ** -** |/ ** -\* */ +/* + * Scala (https://www.scala-lang.org) + * + * Copyright EPFL and Lightbend, Inc. + * + * Licensed under Apache License 2.0 + * (http://www.apache.org/licenses/LICENSE-2.0). + * + * See the NOTICE file distributed with this work for + * additional information regarding copyright ownership. + */ package scala diff --git a/shared/src/main/scala/scala/xml/parsing/ConstructingHandler.scala b/shared/src/main/scala/scala/xml/parsing/ConstructingHandler.scala index 05cda5658..e63559501 100755 --- a/shared/src/main/scala/scala/xml/parsing/ConstructingHandler.scala +++ b/shared/src/main/scala/scala/xml/parsing/ConstructingHandler.scala @@ -1,10 +1,14 @@ -/* __ *\ -** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2002-2020, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | (c) 2011-2020, Lightbend, Inc. ** -** /____/\___/_/ |_/____/_/ | | http://scala-lang.org/ ** -** |/ ** -\* */ +/* + * Scala (https://www.scala-lang.org) + * + * Copyright EPFL and Lightbend, Inc. + * + * Licensed under Apache License 2.0 + * (http://www.apache.org/licenses/LICENSE-2.0). + * + * See the NOTICE file distributed with this work for + * additional information regarding copyright ownership. + */ package scala package xml diff --git a/shared/src/main/scala/scala/xml/parsing/ConstructingParser.scala b/shared/src/main/scala/scala/xml/parsing/ConstructingParser.scala index cacd7802f..e2f238e5b 100644 --- a/shared/src/main/scala/scala/xml/parsing/ConstructingParser.scala +++ b/shared/src/main/scala/scala/xml/parsing/ConstructingParser.scala @@ -1,10 +1,14 @@ -/* __ *\ -** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2020, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | (c) 2011-2020, Lightbend, Inc. ** -** /____/\___/_/ |_/____/_/ | | http://scala-lang.org/ ** -** |/ ** -\* */ +/* + * Scala (https://www.scala-lang.org) + * + * Copyright EPFL and Lightbend, Inc. + * + * Licensed under Apache License 2.0 + * (http://www.apache.org/licenses/LICENSE-2.0). + * + * See the NOTICE file distributed with this work for + * additional information regarding copyright ownership. + */ package scala package xml diff --git a/shared/src/main/scala/scala/xml/parsing/DefaultMarkupHandler.scala b/shared/src/main/scala/scala/xml/parsing/DefaultMarkupHandler.scala index 46b9e612b..c0bf8b72c 100755 --- a/shared/src/main/scala/scala/xml/parsing/DefaultMarkupHandler.scala +++ b/shared/src/main/scala/scala/xml/parsing/DefaultMarkupHandler.scala @@ -1,10 +1,14 @@ -/* __ *\ -** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2002-2020, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | (c) 2011-2020, Lightbend, Inc. ** -** /____/\___/_/ |_/____/_/ | | http://scala-lang.org/ ** -** |/ ** -\* */ +/* + * Scala (https://www.scala-lang.org) + * + * Copyright EPFL and Lightbend, Inc. + * + * Licensed under Apache License 2.0 + * (http://www.apache.org/licenses/LICENSE-2.0). + * + * See the NOTICE file distributed with this work for + * additional information regarding copyright ownership. + */ package scala package xml diff --git a/shared/src/main/scala/scala/xml/parsing/ExternalSources.scala b/shared/src/main/scala/scala/xml/parsing/ExternalSources.scala index 731a7b19a..f03ffa165 100644 --- a/shared/src/main/scala/scala/xml/parsing/ExternalSources.scala +++ b/shared/src/main/scala/scala/xml/parsing/ExternalSources.scala @@ -1,10 +1,14 @@ -/* __ *\ -** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2020, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | (c) 2011-2020, Lightbend, Inc. ** -** /____/\___/_/ |_/____/_/ | | http://scala-lang.org/ ** -** |/ ** -\* */ +/* + * Scala (https://www.scala-lang.org) + * + * Copyright EPFL and Lightbend, Inc. + * + * Licensed under Apache License 2.0 + * (http://www.apache.org/licenses/LICENSE-2.0). + * + * See the NOTICE file distributed with this work for + * additional information regarding copyright ownership. + */ package scala package xml diff --git a/shared/src/main/scala/scala/xml/parsing/FactoryAdapter.scala b/shared/src/main/scala/scala/xml/parsing/FactoryAdapter.scala index aa05fe564..accc9a68e 100644 --- a/shared/src/main/scala/scala/xml/parsing/FactoryAdapter.scala +++ b/shared/src/main/scala/scala/xml/parsing/FactoryAdapter.scala @@ -1,10 +1,14 @@ -/* __ *\ -** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2020, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | (c) 2011-2020, Lightbend, Inc. ** -** /____/\___/_/ |_/____/_/ | | http://scala-lang.org/ ** -** |/ ** -\* */ +/* + * Scala (https://www.scala-lang.org) + * + * Copyright EPFL and Lightbend, Inc. + * + * Licensed under Apache License 2.0 + * (http://www.apache.org/licenses/LICENSE-2.0). + * + * See the NOTICE file distributed with this work for + * additional information regarding copyright ownership. + */ package scala package xml diff --git a/shared/src/main/scala/scala/xml/parsing/FatalError.scala b/shared/src/main/scala/scala/xml/parsing/FatalError.scala index 88f17ff4c..e77b7577d 100644 --- a/shared/src/main/scala/scala/xml/parsing/FatalError.scala +++ b/shared/src/main/scala/scala/xml/parsing/FatalError.scala @@ -1,10 +1,14 @@ -/* __ *\ -** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2002-2020, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | (c) 2011-2020, Lightbend, Inc. ** -** /____/\___/_/ |_/____/_/ | | http://scala-lang.org/ ** -** |/ ** -\* */ +/* + * Scala (https://www.scala-lang.org) + * + * Copyright EPFL and Lightbend, Inc. + * + * Licensed under Apache License 2.0 + * (http://www.apache.org/licenses/LICENSE-2.0). + * + * See the NOTICE file distributed with this work for + * additional information regarding copyright ownership. + */ package scala package xml diff --git a/shared/src/main/scala/scala/xml/parsing/MarkupHandler.scala b/shared/src/main/scala/scala/xml/parsing/MarkupHandler.scala index a411515c8..bd4a2715d 100755 --- a/shared/src/main/scala/scala/xml/parsing/MarkupHandler.scala +++ b/shared/src/main/scala/scala/xml/parsing/MarkupHandler.scala @@ -1,10 +1,14 @@ -/* __ *\ -** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2020, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | (c) 2011-2020, Lightbend, Inc. ** -** /____/\___/_/ |_/____/_/ | | http://scala-lang.org/ ** -** |/ ** -\* */ +/* + * Scala (https://www.scala-lang.org) + * + * Copyright EPFL and Lightbend, Inc. + * + * Licensed under Apache License 2.0 + * (http://www.apache.org/licenses/LICENSE-2.0). + * + * See the NOTICE file distributed with this work for + * additional information regarding copyright ownership. + */ package scala package xml diff --git a/shared/src/main/scala/scala/xml/parsing/MarkupParser.scala b/shared/src/main/scala/scala/xml/parsing/MarkupParser.scala index 545abdbcf..95ec2ec55 100755 --- a/shared/src/main/scala/scala/xml/parsing/MarkupParser.scala +++ b/shared/src/main/scala/scala/xml/parsing/MarkupParser.scala @@ -1,10 +1,14 @@ -/* __ *\ -** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2020, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | (c) 2011-2020, Lightbend, Inc. ** -** /____/\___/_/ |_/____/_/ | | http://scala-lang.org/ ** -** |/ ** -\* */ +/* + * Scala (https://www.scala-lang.org) + * + * Copyright EPFL and Lightbend, Inc. + * + * Licensed under Apache License 2.0 + * (http://www.apache.org/licenses/LICENSE-2.0). + * + * See the NOTICE file distributed with this work for + * additional information regarding copyright ownership. + */ package scala package xml diff --git a/shared/src/main/scala/scala/xml/parsing/MarkupParserCommon.scala b/shared/src/main/scala/scala/xml/parsing/MarkupParserCommon.scala index 8b4692836..1a3886589 100644 --- a/shared/src/main/scala/scala/xml/parsing/MarkupParserCommon.scala +++ b/shared/src/main/scala/scala/xml/parsing/MarkupParserCommon.scala @@ -1,10 +1,14 @@ -/* __ *\ -** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2020, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | (c) 2011-2020, Lightbend, Inc. ** -** /____/\___/_/ |_/____/_/ | | http://scala-lang.org/ ** -** |/ ** -\* */ +/* + * Scala (https://www.scala-lang.org) + * + * Copyright EPFL and Lightbend, Inc. + * + * Licensed under Apache License 2.0 + * (http://www.apache.org/licenses/LICENSE-2.0). + * + * See the NOTICE file distributed with this work for + * additional information regarding copyright ownership. + */ package scala package xml diff --git a/shared/src/main/scala/scala/xml/parsing/NoBindingFactoryAdapter.scala b/shared/src/main/scala/scala/xml/parsing/NoBindingFactoryAdapter.scala index f0b74fa30..819d8ca30 100644 --- a/shared/src/main/scala/scala/xml/parsing/NoBindingFactoryAdapter.scala +++ b/shared/src/main/scala/scala/xml/parsing/NoBindingFactoryAdapter.scala @@ -1,10 +1,14 @@ -/* __ *\ -** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2020, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | (c) 2011-2020, Lightbend, Inc. ** -** /____/\___/_/ |_/____/_/ | | http://scala-lang.org/ ** -** |/ ** -\* */ +/* + * Scala (https://www.scala-lang.org) + * + * Copyright EPFL and Lightbend, Inc. + * + * Licensed under Apache License 2.0 + * (http://www.apache.org/licenses/LICENSE-2.0). + * + * See the NOTICE file distributed with this work for + * additional information regarding copyright ownership. + */ package scala package xml diff --git a/shared/src/main/scala/scala/xml/parsing/TokenTests.scala b/shared/src/main/scala/scala/xml/parsing/TokenTests.scala index 6e9fdc31d..8b8a539a4 100644 --- a/shared/src/main/scala/scala/xml/parsing/TokenTests.scala +++ b/shared/src/main/scala/scala/xml/parsing/TokenTests.scala @@ -1,10 +1,14 @@ -/* __ *\ -** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2020, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | (c) 2011-2020, Lightbend, Inc. ** -** /____/\___/_/ |_/____/_/ | | http://scala-lang.org/ ** -** |/ ** -\* */ +/* + * Scala (https://www.scala-lang.org) + * + * Copyright EPFL and Lightbend, Inc. + * + * Licensed under Apache License 2.0 + * (http://www.apache.org/licenses/LICENSE-2.0). + * + * See the NOTICE file distributed with this work for + * additional information regarding copyright ownership. + */ package scala package xml diff --git a/shared/src/main/scala/scala/xml/parsing/XhtmlEntities.scala b/shared/src/main/scala/scala/xml/parsing/XhtmlEntities.scala index b43c62cd2..89b53d844 100644 --- a/shared/src/main/scala/scala/xml/parsing/XhtmlEntities.scala +++ b/shared/src/main/scala/scala/xml/parsing/XhtmlEntities.scala @@ -1,10 +1,14 @@ -/* __ *\ -** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2020, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | (c) 2011-2020, Lightbend, Inc. ** -** /____/\___/_/ |_/____/_/ | | http://scala-lang.org/ ** -** |/ ** -\* */ +/* + * Scala (https://www.scala-lang.org) + * + * Copyright EPFL and Lightbend, Inc. + * + * Licensed under Apache License 2.0 + * (http://www.apache.org/licenses/LICENSE-2.0). + * + * See the NOTICE file distributed with this work for + * additional information regarding copyright ownership. + */ package scala package xml diff --git a/shared/src/main/scala/scala/xml/parsing/XhtmlParser.scala b/shared/src/main/scala/scala/xml/parsing/XhtmlParser.scala index 3aabc71cc..0d2504c86 100644 --- a/shared/src/main/scala/scala/xml/parsing/XhtmlParser.scala +++ b/shared/src/main/scala/scala/xml/parsing/XhtmlParser.scala @@ -1,10 +1,14 @@ -/* __ *\ -** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2020, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | (c) 2011-2020, Lightbend, Inc. ** -** /____/\___/_/ |_/____/_/ | | http://scala-lang.org/ ** -** |/ ** -\* */ +/* + * Scala (https://www.scala-lang.org) + * + * Copyright EPFL and Lightbend, Inc. + * + * Licensed under Apache License 2.0 + * (http://www.apache.org/licenses/LICENSE-2.0). + * + * See the NOTICE file distributed with this work for + * additional information regarding copyright ownership. + */ package scala package xml diff --git a/shared/src/main/scala/scala/xml/transform/BasicTransformer.scala b/shared/src/main/scala/scala/xml/transform/BasicTransformer.scala index c74a9e37a..53dc8002f 100644 --- a/shared/src/main/scala/scala/xml/transform/BasicTransformer.scala +++ b/shared/src/main/scala/scala/xml/transform/BasicTransformer.scala @@ -1,10 +1,14 @@ -/* __ *\ -** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2002-2020, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | (c) 2011-2020, Lightbend, Inc. ** -** /____/\___/_/ |_/____/_/ | | http://scala-lang.org/ ** -** |/ ** -\* */ +/* + * Scala (https://www.scala-lang.org) + * + * Copyright EPFL and Lightbend, Inc. + * + * Licensed under Apache License 2.0 + * (http://www.apache.org/licenses/LICENSE-2.0). + * + * See the NOTICE file distributed with this work for + * additional information regarding copyright ownership. + */ package scala package xml diff --git a/shared/src/main/scala/scala/xml/transform/NestingTransformer.scala b/shared/src/main/scala/scala/xml/transform/NestingTransformer.scala index 321e195b1..f0b7d69b4 100644 --- a/shared/src/main/scala/scala/xml/transform/NestingTransformer.scala +++ b/shared/src/main/scala/scala/xml/transform/NestingTransformer.scala @@ -1,10 +1,14 @@ -/* __ *\ -** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2002-2020, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | (c) 2011-2020, Lightbend, Inc. ** -** /____/\___/_/ |_/____/_/ | | http://scala-lang.org/ ** -** |/ ** -\* */ +/* + * Scala (https://www.scala-lang.org) + * + * Copyright EPFL and Lightbend, Inc. + * + * Licensed under Apache License 2.0 + * (http://www.apache.org/licenses/LICENSE-2.0). + * + * See the NOTICE file distributed with this work for + * additional information regarding copyright ownership. + */ package scala package xml diff --git a/shared/src/main/scala/scala/xml/transform/RewriteRule.scala b/shared/src/main/scala/scala/xml/transform/RewriteRule.scala index 0a9d01aa6..5ef1ad6c3 100644 --- a/shared/src/main/scala/scala/xml/transform/RewriteRule.scala +++ b/shared/src/main/scala/scala/xml/transform/RewriteRule.scala @@ -1,10 +1,14 @@ -/* __ *\ -** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2002-2020, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | (c) 2011-2020, Lightbend, Inc. ** -** /____/\___/_/ |_/____/_/ | | http://scala-lang.org/ ** -** |/ ** -\* */ +/* + * Scala (https://www.scala-lang.org) + * + * Copyright EPFL and Lightbend, Inc. + * + * Licensed under Apache License 2.0 + * (http://www.apache.org/licenses/LICENSE-2.0). + * + * See the NOTICE file distributed with this work for + * additional information regarding copyright ownership. + */ package scala package xml diff --git a/shared/src/main/scala/scala/xml/transform/RuleTransformer.scala b/shared/src/main/scala/scala/xml/transform/RuleTransformer.scala index b7e62644a..45fddc1f4 100644 --- a/shared/src/main/scala/scala/xml/transform/RuleTransformer.scala +++ b/shared/src/main/scala/scala/xml/transform/RuleTransformer.scala @@ -1,10 +1,14 @@ -/* __ *\ -** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2002-2020, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | (c) 2011-2020, Lightbend, Inc. ** -** /____/\___/_/ |_/____/_/ | | http://scala-lang.org/ ** -** |/ ** -\* */ +/* + * Scala (https://www.scala-lang.org) + * + * Copyright EPFL and Lightbend, Inc. + * + * Licensed under Apache License 2.0 + * (http://www.apache.org/licenses/LICENSE-2.0). + * + * See the NOTICE file distributed with this work for + * additional information regarding copyright ownership. + */ package scala package xml From 6fc115e11d08a92d92721e07974cd4f265891692 Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Thu, 4 Feb 2021 23:06:50 +0100 Subject: [PATCH 494/789] Update sbt-scala-module to 2.2.4 --- project/plugins.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/plugins.sbt b/project/plugins.sbt index 4f9ce3b67..2fe1c167f 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -4,7 +4,7 @@ val scalaJSVersion = val scalaNativeVersion = Option(System.getenv("SCALANATIVE_VERSION")).filter(_.nonEmpty).getOrElse("0.4.0") -addSbtPlugin("org.scala-lang.modules" % "sbt-scala-module" % "2.2.3") +addSbtPlugin("org.scala-lang.modules" % "sbt-scala-module" % "2.2.4") addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.0.0") addSbtPlugin("org.portable-scala" % "sbt-scala-native-crossproject" % "1.0.0") addSbtPlugin("org.scala-js" % "sbt-scalajs" % scalaJSVersion) From e5d4c0b5bd8429b09c59cfb20eb288f937bf8e20 Mon Sep 17 00:00:00 2001 From: Scala Steward <43047562+scala-steward@users.noreply.github.com> Date: Tue, 16 Feb 2021 22:25:40 +0100 Subject: [PATCH 495/789] Update sbt-dotty to 0.5.3 (#491) --- project/plugins.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/plugins.sbt b/project/plugins.sbt index 2fe1c167f..fcf01a639 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -9,5 +9,5 @@ addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.0.0") addSbtPlugin("org.portable-scala" % "sbt-scala-native-crossproject" % "1.0.0") addSbtPlugin("org.scala-js" % "sbt-scalajs" % scalaJSVersion) addSbtPlugin("org.scala-native" % "sbt-scala-native" % scalaNativeVersion) -addSbtPlugin("ch.epfl.lamp" % "sbt-dotty" % "0.5.2") +addSbtPlugin("ch.epfl.lamp" % "sbt-dotty" % "0.5.3") addSbtPlugin("de.heikoseeberger" % "sbt-header" % "5.6.0") From 0e845933378fac35c559c30db9fd35d692eaa88d Mon Sep 17 00:00:00 2001 From: Scala Steward <43047562+scala-steward@users.noreply.github.com> Date: Tue, 16 Feb 2021 22:30:53 +0100 Subject: [PATCH 496/789] Update junit to 4.13.2 (#490) --- build.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index 936ff74f9..3b35e4d66 100644 --- a/build.sbt +++ b/build.sbt @@ -163,7 +163,7 @@ lazy val xml = crossProject(JSPlatform, JVMPlatform, NativePlatform) .jvmSettings( OsgiKeys.exportPackage := Seq(s"scala.xml.*;version=${version.value}"), - libraryDependencies += "junit" % "junit" % "4.13.1" % Test, + libraryDependencies += "junit" % "junit" % "4.13.2" % Test, libraryDependencies += "com.novocode" % "junit-interface" % "0.11" % Test, libraryDependencies += "org.apache.commons" % "commons-lang3" % "3.11" % Test, libraryDependencies ++= { From 9dfc2678a9bd1396fc25d0b271704c7a550a0252 Mon Sep 17 00:00:00 2001 From: Scala Steward <43047562+scala-steward@users.noreply.github.com> Date: Tue, 16 Feb 2021 22:31:11 +0100 Subject: [PATCH 497/789] Update sbt-scalajs, scalajs-compiler, ... to 1.5.0 (#489) --- .circleci/config.yml | 4 ++-- .travis.yml | 2 +- project/plugins.sbt | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index a5f38c020..4ea8ec413 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -165,11 +165,11 @@ workflows: - scalajs_job: name: sjs1.0_2.12 scala_version: 2.12.13 - scalajs_version: 1.4.0 + scalajs_version: 1.5.0 - scalajs_job: name: sjs1.0_2.13 scala_version: 2.13.4 - scalajs_version: 1.4.0 + scalajs_version: 1.5.0 - scalanative_job: name: native0.4_2.12 scala_version: 2.12.13 diff --git a/.travis.yml b/.travis.yml index 4778e5ee8..397aa4751 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,7 +12,7 @@ scala: env: - SCALAJS_VERSION= ADOPTOPENJDK=8 - - SCALAJS_VERSION=1.4.0 ADOPTOPENJDK=8 + - SCALAJS_VERSION=1.5.0 ADOPTOPENJDK=8 - SCALANATIVE_VERSION=0.4.0 ADOPTOPENJDK=8 - SCALAJS_VERSION= ADOPTOPENJDK=11 - SCALAJS_VERSION= ADOPTOPENJDK=15 diff --git a/project/plugins.sbt b/project/plugins.sbt index fcf01a639..16f79e89f 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,5 +1,5 @@ val scalaJSVersion = - Option(System.getenv("SCALAJS_VERSION")).filter(_.nonEmpty).getOrElse("1.4.0") + Option(System.getenv("SCALAJS_VERSION")).filter(_.nonEmpty).getOrElse("1.5.0") val scalaNativeVersion = Option(System.getenv("SCALANATIVE_VERSION")).filter(_.nonEmpty).getOrElse("0.4.0") From 34cba03716ec324692b24199d025abf200774299 Mon Sep 17 00:00:00 2001 From: Seth Tisue Date: Tue, 16 Feb 2021 18:18:47 -0800 Subject: [PATCH 498/789] support Scala 3.0.0-RC1 (and drop 3.0.0-M2) (#493) --- .circleci/config.yml | 14 +++++++------- .travis.yml | 6 +++--- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 4ea8ec413..5b6fa9dfe 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -119,13 +119,13 @@ workflows: java_version: jdk8 scala_version: 2.13.4 - scala_job: - name: 3.0.0-M3 + name: 3.0.0-RC1 java_version: jdk8 - scala_version: 3.0.0-M3 + scala_version: 3.0.0-RC1 - scala_job: - name: 3.0.0-M2 + name: 3.0.0-M3 java_version: jdk8 - scala_version: 3.0.0-M2 + scala_version: 3.0.0-M3 - scala_job: name: jdk11_2.12 java_version: jdk11 @@ -137,7 +137,7 @@ workflows: - scala_job: name: jdk11_3.0 java_version: jdk11 - scala_version: 3.0.0-M3 + scala_version: 3.0.0-RC1 - scala_job: name: jdk15_2.12 java_version: jdk15 @@ -149,7 +149,7 @@ workflows: - scala_job: name: jdk15_3.0 java_version: jdk15 - scala_version: 3.0.0-M3 + scala_version: 3.0.0-RC1 - scala_job: name: jdk16_2.12 java_version: jdk16 @@ -161,7 +161,7 @@ workflows: - scala_job: name: jdk16_3.0 java_version: jdk16 - scala_version: 3.0.0-M3 + scala_version: 3.0.0-RC1 - scalajs_job: name: sjs1.0_2.12 scala_version: 2.12.13 diff --git a/.travis.yml b/.travis.yml index 397aa4751..3f6ca6f37 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,8 +5,8 @@ import: scala/scala-dev:travis/default.yml language: scala scala: + - 3.0.0-RC1 - 3.0.0-M3 - - 3.0.0-M2 - 2.12.13 - 2.13.4 @@ -19,10 +19,10 @@ env: jobs: exclude: - - scala: 3.0.0-M2 - env: SCALANATIVE_VERSION=0.4.0 ADOPTOPENJDK=8 - scala: 3.0.0-M3 env: SCALANATIVE_VERSION=0.4.0 ADOPTOPENJDK=8 + - scala: 3.0.0-RC1 + env: SCALANATIVE_VERSION=0.4.0 ADOPTOPENJDK=8 install: - git fetch --tags # get all tags for sbt-dynver From 38a01922577b8d0980f1ff577ac7afb75bbb4eb2 Mon Sep 17 00:00:00 2001 From: Seth Tisue Date: Tue, 16 Feb 2021 19:02:39 -0800 Subject: [PATCH 499/789] tweak Scala 3 wording in readme --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index bf872194c..462a20d77 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ How to documentation is available in the [wiki](https://github.com/scala/scala-x The latest stable release of Scala XML is 1.3.0. -Experimental milestone releases of Scala XML version 2.0 are available. Since 2.0.0-M3, Scala 3 is supported. See the changes for 2.0 in `CHANGELOG.md`. +Our experimental milestones in the 2.0.0-Mx series include support for Scala 3 prerelease versions. See also the changes for 2.0 in `CHANGELOG.md`. ## Maintenance status From e7f313aaec8d4b8e9ce6e6c1947e09b157e6f81d Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Sat, 27 Feb 2021 02:10:22 +0100 Subject: [PATCH 500/789] Update scala-compiler, scala-library to 2.13.5 --- .circleci/config.yml | 14 +++++++------- .travis.yml | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 5b6fa9dfe..10936d085 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -115,9 +115,9 @@ workflows: java_version: jdk8 scala_version: 2.12.13 - scala_job: - name: 2.13.4 + name: 2.13.5 java_version: jdk8 - scala_version: 2.13.4 + scala_version: 2.13.5 - scala_job: name: 3.0.0-RC1 java_version: jdk8 @@ -133,7 +133,7 @@ workflows: - scala_job: name: jdk11_2.13 java_version: jdk11 - scala_version: 2.13.4 + scala_version: 2.13.5 - scala_job: name: jdk11_3.0 java_version: jdk11 @@ -145,7 +145,7 @@ workflows: - scala_job: name: jdk15_2.13 java_version: jdk15 - scala_version: 2.13.4 + scala_version: 2.13.5 - scala_job: name: jdk15_3.0 java_version: jdk15 @@ -157,7 +157,7 @@ workflows: - scala_job: name: jdk16_2.13 java_version: jdk16 - scala_version: 2.13.3 + scala_version: 2.13.5 - scala_job: name: jdk16_3.0 java_version: jdk16 @@ -168,7 +168,7 @@ workflows: scalajs_version: 1.5.0 - scalajs_job: name: sjs1.0_2.13 - scala_version: 2.13.4 + scala_version: 2.13.5 scalajs_version: 1.5.0 - scalanative_job: name: native0.4_2.12 @@ -176,5 +176,5 @@ workflows: scalanative_version: 0.4.0 - scalanative_job: name: native0.4_2.13 - scala_version: 2.13.4 + scala_version: 2.13.5 scalanative_version: 0.4.0 diff --git a/.travis.yml b/.travis.yml index 3f6ca6f37..79d410a72 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,7 +8,7 @@ scala: - 3.0.0-RC1 - 3.0.0-M3 - 2.12.13 - - 2.13.4 + - 2.13.5 env: - SCALAJS_VERSION= ADOPTOPENJDK=8 From d360cb63e0ce4bfb911a71dc3499ea7f2f31bad1 Mon Sep 17 00:00:00 2001 From: Scala Steward <43047562+scala-steward@users.noreply.github.com> Date: Wed, 3 Mar 2021 21:48:42 +0100 Subject: [PATCH 501/789] Update commons-lang3 to 3.12.0 (#495) --- build.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index 3b35e4d66..200aac178 100644 --- a/build.sbt +++ b/build.sbt @@ -165,7 +165,7 @@ lazy val xml = crossProject(JSPlatform, JVMPlatform, NativePlatform) libraryDependencies += "junit" % "junit" % "4.13.2" % Test, libraryDependencies += "com.novocode" % "junit-interface" % "0.11" % Test, - libraryDependencies += "org.apache.commons" % "commons-lang3" % "3.11" % Test, + libraryDependencies += "org.apache.commons" % "commons-lang3" % "3.12.0" % Test, libraryDependencies ++= { if (isDotty.value) Seq() From 06f1a36bdb1a2088da12ecd678378d8b3050d548 Mon Sep 17 00:00:00 2001 From: Seth Tisue Date: Wed, 3 Mar 2021 21:22:16 -0800 Subject: [PATCH 502/789] Revert "Fix SI-5645 Don't escape quotes in PCDATA" This reverts commit adb40f3f78fff373a7536fe73ccc3d1a4e3233da. --- jvm/src/test/scala/scala/xml/XMLTest.scala | 5 +---- shared/src/main/scala/scala/xml/Text.scala | 2 +- shared/src/main/scala/scala/xml/Utility.scala | 14 ------------- shared/src/test/scala/scala/xml/XMLTest.scala | 20 ++----------------- 4 files changed, 4 insertions(+), 37 deletions(-) diff --git a/jvm/src/test/scala/scala/xml/XMLTest.scala b/jvm/src/test/scala/scala/xml/XMLTest.scala index 0ccbc0767..e4321aa62 100644 --- a/jvm/src/test/scala/scala/xml/XMLTest.scala +++ b/jvm/src/test/scala/scala/xml/XMLTest.scala @@ -315,10 +315,7 @@ class XMLTestJVM { val inputStream = new java.io.ByteArrayInputStream(outputStream.toByteArray) val streamReader = new java.io.InputStreamReader(inputStream, XML.encoding) - def unescapeQuotes(str: String) = - """.r.replaceFirstIn(str, "\"") - val xmlFixed = unescapeQuotes(xml.toString) - assertEquals(xmlFixed, XML.load(streamReader).toString) + assertEquals(xml.toString, XML.load(streamReader).toString) } @UnitTest diff --git a/shared/src/main/scala/scala/xml/Text.scala b/shared/src/main/scala/scala/xml/Text.scala index 2136b2462..0232e69b1 100644 --- a/shared/src/main/scala/scala/xml/Text.scala +++ b/shared/src/main/scala/scala/xml/Text.scala @@ -27,7 +27,7 @@ class Text(data: String) extends Atom[String](data) { * specification. */ override def buildString(sb: StringBuilder): StringBuilder = - Utility.escapeText(data, sb) + Utility.escape(data, sb) } /** diff --git a/shared/src/main/scala/scala/xml/Utility.scala b/shared/src/main/scala/scala/xml/Utility.scala index be5ff3e8d..1a5226d69 100755 --- a/shared/src/main/scala/scala/xml/Utility.scala +++ b/shared/src/main/scala/scala/xml/Utility.scala @@ -131,20 +131,6 @@ object Utility extends AnyRef with parsing.TokenTests { } } - /** - * Appends escaped string to `s`, but not ". - */ - final def escapeText(text: String, s: StringBuilder): StringBuilder = { - val escTextMap = escMap - '"' // Remove quotes from escMap - text.iterator.foldLeft(s) { (s, c) => - escTextMap.get(c) match { - case Some(str) => s ++= str - case _ if c >= ' ' || "\n\r\t".contains(c) => s += c - case _ => s // noop - } - } - } - /** * Appends unescaped string to `s`, `amp` becomes `&`, * `lt` becomes `<` etc.. diff --git a/shared/src/test/scala/scala/xml/XMLTest.scala b/shared/src/test/scala/scala/xml/XMLTest.scala index c00c5aead..8e8e3acb0 100644 --- a/shared/src/test/scala/scala/xml/XMLTest.scala +++ b/shared/src/test/scala/scala/xml/XMLTest.scala @@ -256,10 +256,10 @@ class XMLTest { @UnitTest def escape = assertEquals(""" - "Come, come again, whoever you are, come! + "Come, come again, whoever you are, come! Heathen, fire worshipper or idolatrous, come! Come even if you broke your penitence a hundred times, -Ours is the portal of hope, come as you are." +Ours is the portal of hope, come as you are." Mevlana Celaleddin Rumi""", .attributes) } - @UnitTest - def t5645: Unit = { - - val bar = "baz" - val script = - - val expected = - """|""".stripMargin - - assertEquals(expected, script.toString) - } - @UnitTest def t5843: Unit = { val foo = scala.xml.Attribute(null, "foo", "1", scala.xml.Null) From 06b14f43db7c7189f0d4a70893408564ee6571b1 Mon Sep 17 00:00:00 2001 From: Scala Steward <43047562+scala-steward@users.noreply.github.com> Date: Mon, 8 Mar 2021 19:06:02 +0100 Subject: [PATCH 503/789] Update sbt to 1.4.8 (#498) --- project/build.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/build.properties b/project/build.properties index 0b2e09c5a..b5ef6fff3 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version=1.4.7 +sbt.version=1.4.8 From f60d0e0467026467602608f6e5801b8967ad809d Mon Sep 17 00:00:00 2001 From: Scala Steward <43047562+scala-steward@users.noreply.github.com> Date: Fri, 12 Mar 2021 17:48:00 +0100 Subject: [PATCH 504/789] Update sbt to 1.4.9 (#500) --- project/build.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/build.properties b/project/build.properties index b5ef6fff3..dbae93bcf 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version=1.4.8 +sbt.version=1.4.9 From ebe2d37f0cb4b1ceea8143bc95bd782040fd0436 Mon Sep 17 00:00:00 2001 From: Seth Tisue Date: Fri, 12 Mar 2021 08:57:50 -0800 Subject: [PATCH 505/789] add sbt-version-policy and advance mimaPreviousVersion fixes #497 --- build.sbt | 71 +++++---------------------------------------- build.sh | 2 +- project/plugins.sbt | 1 + 3 files changed, 10 insertions(+), 64 deletions(-) diff --git a/build.sbt b/build.sbt index 200aac178..511d1a688 100644 --- a/build.sbt +++ b/build.sbt @@ -3,6 +3,9 @@ import sbtcrossproject.CrossPlugin.autoImport.{crossProject, CrossType} ThisBuild / startYear := Some(2002) ThisBuild / licenses += (("Apache-2.0", url("https://www.apache.org/licenses/LICENSE-2.0"))) +ThisBuild / versionScheme := Some("early-semver") +ThisBuild / versionPolicyIntention := Compatibility.BinaryAndSourceCompatible + lazy val configSettings: Seq[Setting[_]] = Seq( unmanagedSourceDirectories ++= { unmanagedSourceDirectories.value.flatMap { dir => @@ -59,74 +62,16 @@ lazy val xml = crossProject(JSPlatform, JVMPlatform, NativePlatform) |""".stripMargin)), scalaModuleMimaPreviousVersion := { - if (isDotty.value) None // No such release yet - else Some("1.3.0") + // pending resolution of https://github.com/scalacenter/sbt-version-policy/issues/62 + if (isDotty.value) None + else Some("2.0.0-M5") }, mimaBinaryIssueFilters ++= { import com.typesafe.tools.mima.core._ import com.typesafe.tools.mima.core.ProblemFilters._ Seq( - // scala-xml 1.1.1 deprecated XMLEventReader, so it broke - // binary compatibility for 2.0.0 in the following way: - exclude[MissingClassProblem]("scala.xml.pull.EvComment"), - exclude[MissingClassProblem]("scala.xml.pull.EvComment$"), - exclude[MissingClassProblem]("scala.xml.pull.EvElemEnd"), - exclude[MissingClassProblem]("scala.xml.pull.EvElemEnd$"), - exclude[MissingClassProblem]("scala.xml.pull.EvElemStart"), - exclude[MissingClassProblem]("scala.xml.pull.EvElemStart$"), - exclude[MissingClassProblem]("scala.xml.pull.EvEntityRef"), - exclude[MissingClassProblem]("scala.xml.pull.EvEntityRef$"), - exclude[MissingClassProblem]("scala.xml.pull.EvProcInstr"), - exclude[MissingClassProblem]("scala.xml.pull.EvProcInstr$"), - exclude[MissingClassProblem]("scala.xml.pull.EvText"), - exclude[MissingClassProblem]("scala.xml.pull.EvText$"), - exclude[MissingClassProblem]("scala.xml.pull.ExceptionEvent"), - exclude[MissingClassProblem]("scala.xml.pull.ExceptionEvent$"), - exclude[MissingClassProblem]("scala.xml.pull.ProducerConsumerIterator"), - exclude[MissingClassProblem]("scala.xml.pull.XMLEvent"), - exclude[MissingClassProblem]("scala.xml.pull.XMLEventReader"), - exclude[MissingClassProblem]("scala.xml.pull.XMLEventReader$POISON$"), - exclude[MissingClassProblem]("scala.xml.pull.XMLEventReader$Parser"), - exclude[MissingClassProblem]("scala.xml.pull.package"), - exclude[MissingClassProblem]("scala.xml.pull.package$"), - exclude[MissingTypesProblem]("scala.xml.Atom"), - exclude[MissingTypesProblem]("scala.xml.Comment"), - exclude[MissingTypesProblem]("scala.xml.Document"), - exclude[MissingTypesProblem]("scala.xml.EntityRef"), - exclude[MissingTypesProblem]("scala.xml.PCData"), - exclude[MissingTypesProblem]("scala.xml.ProcInstr"), - exclude[MissingTypesProblem]("scala.xml.SpecialNode"), - exclude[MissingTypesProblem]("scala.xml.Text"), - exclude[MissingTypesProblem]("scala.xml.Unparsed"), - // Miscellaneous deprecations - exclude[MissingClassProblem]("scala.xml.dtd.impl.PointedHedgeExp"), - exclude[MissingClassProblem]("scala.xml.dtd.impl.PointedHedgeExp$TopIter$"), - exclude[MissingClassProblem]("scala.xml.dtd.impl.PointedHedgeExp$Node$"), - exclude[MissingClassProblem]("scala.xml.dtd.impl.PointedHedgeExp$Point$"), - exclude[MissingClassProblem]("scala.xml.dtd.impl.PointedHedgeExp$TopIter"), - exclude[MissingClassProblem]("scala.xml.dtd.impl.PointedHedgeExp$Node"), - exclude[MissingClassProblem]("scala.xml.dtd.Scanner"), - exclude[MissingClassProblem]("scala.xml.dtd.ContentModelParser$"), - exclude[MissingClassProblem]("scala.xml.dtd.ContentModelParser"), - exclude[MissingClassProblem]("scala.xml.dtd.ElementValidator"), - exclude[MissingClassProblem]("scala.xml.dtd.ElementValidator"), - exclude[MissingClassProblem]("scala.xml.factory.Binder"), - exclude[MissingClassProblem]("scala.xml.parsing.ValidatingMarkupHandler"), - exclude[MissingClassProblem]("scala.xml.persistent.CachedFileStorage"), - exclude[MissingClassProblem]("scala.xml.persistent.Index"), - exclude[MissingClassProblem]("scala.xml.persistent.SetStorage"), - exclude[DirectMissingMethodProblem]("scala.xml.dtd.ContentModel.parse"), - exclude[DirectMissingMethodProblem]("scala.xml.Elem.this"), - exclude[DirectMissingMethodProblem]("scala.xml.Elem.apply"), - exclude[DirectMissingMethodProblem]("scala.xml.Elem.processXml"), - exclude[DirectMissingMethodProblem]("scala.xml.Elem.xmlToProcess"), - // Scala 2.12 deprecated mutable.Stack, so we broke - // binary compatibility for 2.0.0 in the following way: - exclude[IncompatibleMethTypeProblem]("scala.xml.parsing.FactoryAdapter.scopeStack_="), - exclude[IncompatibleResultTypeProblem]("scala.xml.parsing.FactoryAdapter.hStack"), - exclude[IncompatibleResultTypeProblem]("scala.xml.parsing.FactoryAdapter.scopeStack"), - exclude[IncompatibleResultTypeProblem]("scala.xml.parsing.FactoryAdapter.attribStack"), - exclude[IncompatibleResultTypeProblem]("scala.xml.parsing.FactoryAdapter.tagStack"), + // because we reverted #279 + exclude[DirectMissingMethodProblem]("scala.xml.Utility.escapeText"), // New MiMa checks for generic signature changes exclude[IncompatibleSignatureProblem]("*"), ) diff --git a/build.sh b/build.sh index b5253d68b..373cc1eca 100755 --- a/build.sh +++ b/build.sh @@ -53,4 +53,4 @@ export CI_SNAPSHOT_RELEASE="${projectPrefix}publish" # for now, until we're confident in the new release scripts, just close the staging repo. export CI_SONATYPE_RELEASE="; sonatypePrepare; sonatypeBundleUpload; sonatypeClose" -sbt clean ${projectPrefix}test ${projectPrefix}publishLocal $releaseTask +sbt clean ${projectPrefix}test ${projectPrefix}versionPolicyCheck ${projectPrefix}publishLocal $releaseTask diff --git a/project/plugins.sbt b/project/plugins.sbt index 16f79e89f..f3aa6c35e 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -11,3 +11,4 @@ addSbtPlugin("org.scala-js" % "sbt-scalajs" % scalaJSVersion) addSbtPlugin("org.scala-native" % "sbt-scala-native" % scalaNativeVersion) addSbtPlugin("ch.epfl.lamp" % "sbt-dotty" % "0.5.3") addSbtPlugin("de.heikoseeberger" % "sbt-header" % "5.6.0") +addSbtPlugin("ch.epfl.scala" % "sbt-version-policy" % "1.0.0-RC5") From 5ee7224f81c936d4d1ad801ea1fae7b51263609e Mon Sep 17 00:00:00 2001 From: Seth Tisue Date: Sat, 13 Mar 2021 11:34:12 -0800 Subject: [PATCH 506/789] fix versionPolicyCheck on JDK 15 --- build.sbt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/build.sbt b/build.sbt index 511d1a688..cad4936aa 100644 --- a/build.sbt +++ b/build.sbt @@ -74,6 +74,10 @@ lazy val xml = crossProject(JSPlatform, JVMPlatform, NativePlatform) exclude[DirectMissingMethodProblem]("scala.xml.Utility.escapeText"), // New MiMa checks for generic signature changes exclude[IncompatibleSignatureProblem]("*"), + // afaict this is just a JDK 8 vs 15 difference, producing a false positive when + // we compare classes built on JDK 15 (which we only do on CI, not at release time) + // to previous-version artifacts that were built on 8. see scala/scala-xml#501 + exclude[DirectMissingMethodProblem]("scala.xml.include.sax.XIncluder.declaration"), ) }, From 5f6b6a0b9261f9b378281c3246ac0eec0f54a5b1 Mon Sep 17 00:00:00 2001 From: Seth Tisue Date: Sat, 13 Mar 2021 11:40:02 -0800 Subject: [PATCH 507/789] make CircleCI run versionPolicyCheck, too --- .circleci/config.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 10936d085..290ef709a 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -58,7 +58,7 @@ jobs: - run: java -version - sbt_cmd: scala_version: << parameters.scala_version >> - sbt_tasks: xml/update xml/compile xml/test:compile xml/test xml/doc xml/package xml/osgiBundle + sbt_tasks: xml/update xml/compile xml/Test/compile xml/test xml/doc xml/package xml/osgiBundle xml/versionPolicyCheck scalajs_job: executor: scala_jdk8_executor parameters: @@ -78,7 +78,7 @@ jobs: - run: node -v - sbt_cmd: scala_version: << parameters.scala_version >> - sbt_tasks: xmlJS/update xmlJS/compile xmlJS/test:compile xmlJS/test xmlJS/doc xmlJS/package + sbt_tasks: xmlJS/update xmlJS/compile xmlJS/Test/compile xmlJS/test xmlJS/doc xmlJS/package scalanative_job: executor: scala_native_executor parameters: From 3c4e47510a518b7e124f3b51a6deef95f5358e52 Mon Sep 17 00:00:00 2001 From: Seth Tisue Date: Mon, 29 Mar 2021 10:06:38 -0700 Subject: [PATCH 508/789] add Scala 3.0.0-RC2 and JDK 16, drop M3 and 15 --- .circleci/config.yml | 27 ++++++--------------------- .travis.yml | 8 ++++---- build.sbt | 42 ++++++++++++++++++------------------------ 3 files changed, 28 insertions(+), 49 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 290ef709a..bf3e3a69f 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -7,9 +7,6 @@ executors: scala_jdk11_executor: docker: - image: circleci/openjdk:11-jdk - scala_jdk15_executor: - docker: - - image: circleci/openjdk:15-buster scala_jdk16_executor: docker: - image: circleci/openjdk:16-buster @@ -119,13 +116,13 @@ workflows: java_version: jdk8 scala_version: 2.13.5 - scala_job: - name: 3.0.0-RC1 + name: 3.0.0-RC2 java_version: jdk8 - scala_version: 3.0.0-RC1 + scala_version: 3.0.0-RC2 - scala_job: - name: 3.0.0-M3 + name: 3.0.0-RC1 java_version: jdk8 - scala_version: 3.0.0-M3 + scala_version: 3.0.0-RC1 - scala_job: name: jdk11_2.12 java_version: jdk11 @@ -137,19 +134,7 @@ workflows: - scala_job: name: jdk11_3.0 java_version: jdk11 - scala_version: 3.0.0-RC1 - - scala_job: - name: jdk15_2.12 - java_version: jdk15 - scala_version: 2.12.13 - - scala_job: - name: jdk15_2.13 - java_version: jdk15 - scala_version: 2.13.5 - - scala_job: - name: jdk15_3.0 - java_version: jdk15 - scala_version: 3.0.0-RC1 + scala_version: 3.0.0-RC2 - scala_job: name: jdk16_2.12 java_version: jdk16 @@ -161,7 +146,7 @@ workflows: - scala_job: name: jdk16_3.0 java_version: jdk16 - scala_version: 3.0.0-RC1 + scala_version: 3.0.0-RC2 - scalajs_job: name: sjs1.0_2.12 scala_version: 2.12.13 diff --git a/.travis.yml b/.travis.yml index 79d410a72..656829aec 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,8 +5,8 @@ import: scala/scala-dev:travis/default.yml language: scala scala: + - 3.0.0-RC2 - 3.0.0-RC1 - - 3.0.0-M3 - 2.12.13 - 2.13.5 @@ -15,14 +15,14 @@ env: - SCALAJS_VERSION=1.5.0 ADOPTOPENJDK=8 - SCALANATIVE_VERSION=0.4.0 ADOPTOPENJDK=8 - SCALAJS_VERSION= ADOPTOPENJDK=11 - - SCALAJS_VERSION= ADOPTOPENJDK=15 + - SCALAJS_VERSION= ADOPTOPENJDK=16 jobs: exclude: - - scala: 3.0.0-M3 - env: SCALANATIVE_VERSION=0.4.0 ADOPTOPENJDK=8 - scala: 3.0.0-RC1 env: SCALANATIVE_VERSION=0.4.0 ADOPTOPENJDK=8 + - scala: 3.0.0-RC2 + env: SCALANATIVE_VERSION=0.4.0 ADOPTOPENJDK=8 install: - git fetch --tags # get all tags for sbt-dynver diff --git a/build.sbt b/build.sbt index cad4936aa..087e7b036 100644 --- a/build.sbt +++ b/build.sbt @@ -32,23 +32,17 @@ lazy val xml = crossProject(JSPlatform, JVMPlatform, NativePlatform) .jvmSettings(ScalaModulePlugin.scalaModuleOsgiSettings) .settings( name := "scala-xml", - scalacOptions ++= { - val opts = - if (isDotty.value) - "-language:Scala2" - else - // Compiler team advised avoiding the -Xsource:2.14 option for releases. - // The output with -Xsource should be periodically checked, though. - "-deprecation:false -feature -Xlint:-stars-align,-nullary-unit,_" - opts.split("\\s+").to[Seq] - }, + scalacOptions ++= (CrossVersion.partialVersion(scalaVersion.value) match { + case Some((3, _)) => + Seq("-language:Scala2") + case _ => + // Compiler team advised avoiding the -Xsource:2.14 option for releases. + // The output with -Xsource should be periodically checked, though. + Seq("-deprecation:false", "-feature", "-Xlint:-stars-align,-nullary-unit,_") + }), Test / scalacOptions += "-Xxml:coalescing", - // don't run Dottydoc, it errors and isn't needed anyway. - // but we leave `publishArtifact` set to true, otherwise Sonatype won't let us publish - Compile / doc / sources := (if (isDotty.value) Seq() else (Compile / doc/ sources).value), - headerLicense := Some(HeaderLicense.Custom( s"""|Scala (https://www.scala-lang.org) | @@ -61,11 +55,11 @@ lazy val xml = crossProject(JSPlatform, JVMPlatform, NativePlatform) |additional information regarding copyright ownership. |""".stripMargin)), - scalaModuleMimaPreviousVersion := { + scalaModuleMimaPreviousVersion := (CrossVersion.partialVersion(scalaVersion.value) match { // pending resolution of https://github.com/scalacenter/sbt-version-policy/issues/62 - if (isDotty.value) None - else Some("2.0.0-M5") - }, + case Some((3, _)) => None + case _ => Some("2.0.0-M5") + }), mimaBinaryIssueFilters ++= { import com.typesafe.tools.mima.core._ import com.typesafe.tools.mima.core.ProblemFilters._ @@ -74,8 +68,8 @@ lazy val xml = crossProject(JSPlatform, JVMPlatform, NativePlatform) exclude[DirectMissingMethodProblem]("scala.xml.Utility.escapeText"), // New MiMa checks for generic signature changes exclude[IncompatibleSignatureProblem]("*"), - // afaict this is just a JDK 8 vs 15 difference, producing a false positive when - // we compare classes built on JDK 15 (which we only do on CI, not at release time) + // afaict this is just a JDK 8 vs 16 difference, producing a false positive when + // we compare classes built on JDK 16 (which we only do on CI, not at release time) // to previous-version artifacts that were built on 8. see scala/scala-xml#501 exclude[DirectMissingMethodProblem]("scala.xml.include.sax.XIncluder.declaration"), ) @@ -115,12 +109,12 @@ lazy val xml = crossProject(JSPlatform, JVMPlatform, NativePlatform) libraryDependencies += "junit" % "junit" % "4.13.2" % Test, libraryDependencies += "com.novocode" % "junit-interface" % "0.11" % Test, libraryDependencies += "org.apache.commons" % "commons-lang3" % "3.12.0" % Test, - libraryDependencies ++= { - if (isDotty.value) + libraryDependencies ++= (CrossVersion.partialVersion(scalaVersion.value) match { + case Some((3, _)) => Seq() - else + case _ => Seq(("org.scala-lang" % "scala-compiler" % scalaVersion.value % Test).exclude("org.scala-lang.modules", s"scala-xml_${scalaBinaryVersion.value}")) - } + }), ) .jsSettings( // Scala.js cannot run forked tests From 987d686664dac96d91ad831ee9809b775f5fe921 Mon Sep 17 00:00:00 2001 From: Seth Tisue Date: Mon, 29 Mar 2021 10:10:11 -0700 Subject: [PATCH 509/789] sbt 1.5.0-RC2 (was 1.4.9) --- project/build.properties | 2 +- project/plugins.sbt | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/project/build.properties b/project/build.properties index dbae93bcf..af4ff6f29 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version=1.4.9 +sbt.version=1.5.0-RC2 diff --git a/project/plugins.sbt b/project/plugins.sbt index f3aa6c35e..d4186c1e7 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -9,6 +9,5 @@ addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.0.0") addSbtPlugin("org.portable-scala" % "sbt-scala-native-crossproject" % "1.0.0") addSbtPlugin("org.scala-js" % "sbt-scalajs" % scalaJSVersion) addSbtPlugin("org.scala-native" % "sbt-scala-native" % scalaNativeVersion) -addSbtPlugin("ch.epfl.lamp" % "sbt-dotty" % "0.5.3") addSbtPlugin("de.heikoseeberger" % "sbt-header" % "5.6.0") addSbtPlugin("ch.epfl.scala" % "sbt-version-policy" % "1.0.0-RC5") From 8729355b250dd86160e391f67d7624cf8a161713 Mon Sep 17 00:00:00 2001 From: Seth Tisue Date: Mon, 29 Mar 2021 13:12:11 -0700 Subject: [PATCH 510/789] update build and readme now that 2.0.0-RC1 is out --- README.md | 2 +- build.sbt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 462a20d77..684d7f4eb 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ How to documentation is available in the [wiki](https://github.com/scala/scala-x The latest stable release of Scala XML is 1.3.0. -Our experimental milestones in the 2.0.0-Mx series include support for Scala 3 prerelease versions. See also the changes for 2.0 in `CHANGELOG.md`. +The 2.0.0-RCx series supports Scala 3. See also the changes for 2.0 in `CHANGELOG.md`. ## Maintenance status diff --git a/build.sbt b/build.sbt index 087e7b036..6ddbeb97d 100644 --- a/build.sbt +++ b/build.sbt @@ -58,7 +58,7 @@ lazy val xml = crossProject(JSPlatform, JVMPlatform, NativePlatform) scalaModuleMimaPreviousVersion := (CrossVersion.partialVersion(scalaVersion.value) match { // pending resolution of https://github.com/scalacenter/sbt-version-policy/issues/62 case Some((3, _)) => None - case _ => Some("2.0.0-M5") + case _ => Some("2.0.0-RC1") }), mimaBinaryIssueFilters ++= { import com.typesafe.tools.mima.core._ From d56115f8fe3d4f5771c1cc64280ce32b2b1d7b6b Mon Sep 17 00:00:00 2001 From: Scala Steward <43047562+scala-steward@users.noreply.github.com> Date: Thu, 15 Apr 2021 16:39:48 +0200 Subject: [PATCH 511/789] Update sbt to 1.5.0 (#507) --- project/build.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/build.properties b/project/build.properties index af4ff6f29..e67343ae7 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version=1.5.0-RC2 +sbt.version=1.5.0 From ed8dc2816e188cd0e18e7d4a88b3d2baba9fd04e Mon Sep 17 00:00:00 2001 From: Scala Steward <43047562+scala-steward@users.noreply.github.com> Date: Thu, 15 Apr 2021 16:40:00 +0200 Subject: [PATCH 512/789] Update sbt-scalajs, scalajs-compiler, ... to 1.5.1 (#505) --- .circleci/config.yml | 4 ++-- .travis.yml | 2 +- project/plugins.sbt | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index bf3e3a69f..c6182bf73 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -150,11 +150,11 @@ workflows: - scalajs_job: name: sjs1.0_2.12 scala_version: 2.12.13 - scalajs_version: 1.5.0 + scalajs_version: 1.5.1 - scalajs_job: name: sjs1.0_2.13 scala_version: 2.13.5 - scalajs_version: 1.5.0 + scalajs_version: 1.5.1 - scalanative_job: name: native0.4_2.12 scala_version: 2.12.13 diff --git a/.travis.yml b/.travis.yml index 656829aec..2fdcf88a6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,7 +12,7 @@ scala: env: - SCALAJS_VERSION= ADOPTOPENJDK=8 - - SCALAJS_VERSION=1.5.0 ADOPTOPENJDK=8 + - SCALAJS_VERSION=1.5.1 ADOPTOPENJDK=8 - SCALANATIVE_VERSION=0.4.0 ADOPTOPENJDK=8 - SCALAJS_VERSION= ADOPTOPENJDK=11 - SCALAJS_VERSION= ADOPTOPENJDK=16 diff --git a/project/plugins.sbt b/project/plugins.sbt index d4186c1e7..2aaf3d131 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,5 +1,5 @@ val scalaJSVersion = - Option(System.getenv("SCALAJS_VERSION")).filter(_.nonEmpty).getOrElse("1.5.0") + Option(System.getenv("SCALAJS_VERSION")).filter(_.nonEmpty).getOrElse("1.5.1") val scalaNativeVersion = Option(System.getenv("SCALANATIVE_VERSION")).filter(_.nonEmpty).getOrElse("0.4.0") From 4015858b7519e4454145a81fb225199f7fda6edc Mon Sep 17 00:00:00 2001 From: Seth Tisue Date: Mon, 19 Apr 2021 10:48:39 -0700 Subject: [PATCH 513/789] add Scala 3.0.0-RC3 (and drop RC1) --- .circleci/config.yml | 12 ++++++------ .travis.yml | 6 +++--- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index c6182bf73..0a98cd1e3 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -116,13 +116,13 @@ workflows: java_version: jdk8 scala_version: 2.13.5 - scala_job: - name: 3.0.0-RC2 + name: 3.0.0-RC3 java_version: jdk8 - scala_version: 3.0.0-RC2 + scala_version: 3.0.0-RC3 - scala_job: - name: 3.0.0-RC1 + name: 3.0.0-RC2 java_version: jdk8 - scala_version: 3.0.0-RC1 + scala_version: 3.0.0-RC2 - scala_job: name: jdk11_2.12 java_version: jdk11 @@ -134,7 +134,7 @@ workflows: - scala_job: name: jdk11_3.0 java_version: jdk11 - scala_version: 3.0.0-RC2 + scala_version: 3.0.0-RC3 - scala_job: name: jdk16_2.12 java_version: jdk16 @@ -146,7 +146,7 @@ workflows: - scala_job: name: jdk16_3.0 java_version: jdk16 - scala_version: 3.0.0-RC2 + scala_version: 3.0.0-RC3 - scalajs_job: name: sjs1.0_2.12 scala_version: 2.12.13 diff --git a/.travis.yml b/.travis.yml index 2fdcf88a6..2a9889af0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,8 +5,8 @@ import: scala/scala-dev:travis/default.yml language: scala scala: + - 3.0.0-RC3 - 3.0.0-RC2 - - 3.0.0-RC1 - 2.12.13 - 2.13.5 @@ -19,10 +19,10 @@ env: jobs: exclude: - - scala: 3.0.0-RC1 - env: SCALANATIVE_VERSION=0.4.0 ADOPTOPENJDK=8 - scala: 3.0.0-RC2 env: SCALANATIVE_VERSION=0.4.0 ADOPTOPENJDK=8 + - scala: 3.0.0-RC3 + env: SCALANATIVE_VERSION=0.4.0 ADOPTOPENJDK=8 install: - git fetch --tags # get all tags for sbt-dynver From 9bd48bd2cd865f7cc6c98b6af7a371e3763afcd1 Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Mon, 19 Apr 2021 17:37:40 -0400 Subject: [PATCH 514/789] Enable signature check in Mima --- build.sbt | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/build.sbt b/build.sbt index 6ddbeb97d..fa135858a 100644 --- a/build.sbt +++ b/build.sbt @@ -60,14 +60,13 @@ lazy val xml = crossProject(JSPlatform, JVMPlatform, NativePlatform) case Some((3, _)) => None case _ => Some("2.0.0-RC1") }), + mimaReportSignatureProblems := true, mimaBinaryIssueFilters ++= { import com.typesafe.tools.mima.core._ import com.typesafe.tools.mima.core.ProblemFilters._ Seq( // because we reverted #279 exclude[DirectMissingMethodProblem]("scala.xml.Utility.escapeText"), - // New MiMa checks for generic signature changes - exclude[IncompatibleSignatureProblem]("*"), // afaict this is just a JDK 8 vs 16 difference, producing a false positive when // we compare classes built on JDK 16 (which we only do on CI, not at release time) // to previous-version artifacts that were built on 8. see scala/scala-xml#501 From 6840ae4765c202d5d3749c4dacbe26596123f911 Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Mon, 19 Apr 2021 18:18:27 -0400 Subject: [PATCH 515/789] Remove exclude rule from scala-compiler test dependency --- build.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index 6ddbeb97d..b77b05805 100644 --- a/build.sbt +++ b/build.sbt @@ -113,7 +113,7 @@ lazy val xml = crossProject(JSPlatform, JVMPlatform, NativePlatform) case Some((3, _)) => Seq() case _ => - Seq(("org.scala-lang" % "scala-compiler" % scalaVersion.value % Test).exclude("org.scala-lang.modules", s"scala-xml_${scalaBinaryVersion.value}")) + Seq("org.scala-lang" % "scala-compiler" % scalaVersion.value % Test) }), ) .jsSettings( From 655087fcee354783988a2ed753ac3710aa265b82 Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Tue, 20 Apr 2021 07:44:48 -0400 Subject: [PATCH 516/789] Drop the scala.xml.Properties --- build.sbt | 1 + .../scala-2.x/scala/xml/CompilerErrors.scala | 2 +- shared/src/main/scala/scala/xml/XML.scala | 5 ----- .../src/test/scala/scala/xml/Properties.scala | 19 +++++++++++++++++++ 4 files changed, 21 insertions(+), 6 deletions(-) create mode 100644 shared/src/test/scala/scala/xml/Properties.scala diff --git a/build.sbt b/build.sbt index 6ddbeb97d..0409697c1 100644 --- a/build.sbt +++ b/build.sbt @@ -66,6 +66,7 @@ lazy val xml = crossProject(JSPlatform, JVMPlatform, NativePlatform) Seq( // because we reverted #279 exclude[DirectMissingMethodProblem]("scala.xml.Utility.escapeText"), + exclude[MissingClassProblem]("scala.xml.Properties*"), // New MiMa checks for generic signature changes exclude[IncompatibleSignatureProblem]("*"), // afaict this is just a JDK 8 vs 16 difference, producing a false positive when diff --git a/jvm/src/test/scala-2.x/scala/xml/CompilerErrors.scala b/jvm/src/test/scala-2.x/scala/xml/CompilerErrors.scala index 995fd64ed..4d3197890 100644 --- a/jvm/src/test/scala-2.x/scala/xml/CompilerErrors.scala +++ b/jvm/src/test/scala-2.x/scala/xml/CompilerErrors.scala @@ -8,7 +8,7 @@ class CompilerErrors extends CompilerTesting { // the error message here differs a bit by Scala version import util.Properties.versionNumberString val thing = - if (versionNumberString.startsWith("2.11") || versionNumberString.startsWith("2.12")) "method value" + if (versionNumberString.startsWith("2.12")) "method value" else "method" expectXmlError(s"""|overloaded $thing apply with alternatives: | (f: scala.xml.Node => Boolean)scala.xml.NodeSeq diff --git a/shared/src/main/scala/scala/xml/XML.scala b/shared/src/main/scala/scala/xml/XML.scala index ed7ad8336..d93d2ce08 100755 --- a/shared/src/main/scala/scala/xml/XML.scala +++ b/shared/src/main/scala/scala/xml/XML.scala @@ -118,8 +118,3 @@ object XML extends XMLLoader[Elem] { w.write(Utility.serialize(node, minimizeTags = minimizeTags).toString) } } - -object Properties extends scala.util.PropertiesTrait { - protected def propCategory = "scala-xml" - protected def pickJarBasedOn = classOf[scala.xml.Node] -} diff --git a/shared/src/test/scala/scala/xml/Properties.scala b/shared/src/test/scala/scala/xml/Properties.scala new file mode 100644 index 000000000..9f4db208c --- /dev/null +++ b/shared/src/test/scala/scala/xml/Properties.scala @@ -0,0 +1,19 @@ +/* + * Scala (https://www.scala-lang.org) + * + * Copyright EPFL and Lightbend, Inc. + * + * Licensed under Apache License 2.0 + * (http://www.apache.org/licenses/LICENSE-2.0). + * + * See the NOTICE file distributed with this work for + * additional information regarding copyright ownership. + */ + +package scala +package xml + +object Properties extends util.PropertiesTrait { + protected def propCategory = "scala-xml" + protected def pickJarBasedOn = classOf[scala.xml.Node] +} From 74233b1f62f538e413776e99921719d135a161c0 Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Mon, 26 Apr 2021 15:59:37 +0200 Subject: [PATCH 517/789] Update sbt to 1.5.1 --- project/build.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/build.properties b/project/build.properties index e67343ae7..f0be67b9f 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version=1.5.0 +sbt.version=1.5.1 From 1fbb9ea1dbf14673fdf237acfcda4b6e0035848b Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Mon, 26 Apr 2021 21:46:15 -0400 Subject: [PATCH 518/789] Remove ubuntu executor from Circle --- .circleci/config.yml | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 0a98cd1e3..886f935ec 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -10,9 +10,6 @@ executors: scala_jdk16_executor: docker: - image: circleci/openjdk:16-buster - scala_native_executor: - machine: - image: ubuntu-1604:202004-01 commands: sbt_cmd: @@ -77,7 +74,7 @@ jobs: scala_version: << parameters.scala_version >> sbt_tasks: xmlJS/update xmlJS/compile xmlJS/Test/compile xmlJS/test xmlJS/doc xmlJS/package scalanative_job: - executor: scala_native_executor + executor: scala_jdk8_executor parameters: scala_version: description: "Scala version" @@ -94,12 +91,10 @@ jobs: - run: name: Install dependencies command: | - echo "deb https://dl.bintray.com/sbt/debian /" | sudo tee -a /etc/apt/sources.list.d/sbt.list - curl -sL "https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x2EE0EA64E40A89B84B2DF73499E82A75642AC823" | sudo apt-key add sudo apt-get update - sudo apt-get install -y sbt clang-8 openjdk-8-jdk - sudo ln -s /usr/lib/llvm-8/bin/clang /usr/bin/clang - sudo ln -s /usr/lib/llvm-8/bin/clang++ /usr/bin/clang++ + sudo apt-get install -y clang-7 + sudo ln -s /usr/lib/llvm-7/bin/clang /usr/local/bin/clang + sudo ln -s /usr/lib/llvm-7/bin/clang++ /usr/local/bin/clang++ - sbt_cmd: scala_version: << parameters.scala_version >> sbt_tasks: xmlNative/update xmlNative/compile xmlNative/test:compile xmlNative/test xmlNative/doc xmlNative/package From 4a9a9c8933207b5eb34d559b68bb88b50d72cf8e Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Tue, 27 Apr 2021 10:45:00 -0400 Subject: [PATCH 519/789] Remove deprecated logging --- build.sbt | 3 + .../scala/xml/factory/LoggedNodeFactory.scala | 95 ------------------- .../scala/xml/parsing/MarkupHandler.scala | 3 - 3 files changed, 3 insertions(+), 98 deletions(-) delete mode 100644 shared/src/main/scala/scala/xml/factory/LoggedNodeFactory.scala diff --git a/build.sbt b/build.sbt index 6ddbeb97d..5f7d12942 100644 --- a/build.sbt +++ b/build.sbt @@ -64,6 +64,9 @@ lazy val xml = crossProject(JSPlatform, JVMPlatform, NativePlatform) import com.typesafe.tools.mima.core._ import com.typesafe.tools.mima.core.ProblemFilters._ Seq( + // Deprecated in 2.0.0-RC2 + exclude[MissingClassProblem]("scala.xml.factory.LoggedNodeFactory"), + exclude[DirectMissingMethodProblem]("scala.xml.parsing.MarkupHandler.log"), // because we reverted #279 exclude[DirectMissingMethodProblem]("scala.xml.Utility.escapeText"), // New MiMa checks for generic signature changes diff --git a/shared/src/main/scala/scala/xml/factory/LoggedNodeFactory.scala b/shared/src/main/scala/scala/xml/factory/LoggedNodeFactory.scala deleted file mode 100644 index a1932cb92..000000000 --- a/shared/src/main/scala/scala/xml/factory/LoggedNodeFactory.scala +++ /dev/null @@ -1,95 +0,0 @@ -/* - * Scala (https://www.scala-lang.org) - * - * Copyright EPFL and Lightbend, Inc. - * - * Licensed under Apache License 2.0 - * (http://www.apache.org/licenses/LICENSE-2.0). - * - * See the NOTICE file distributed with this work for - * additional information regarding copyright ownership. - */ - -package scala -package xml -package factory - -import scala.collection.Seq - -/** - * This class logs what the nodefactory is actually doing. - * If you want to see what happens during loading, use it like this: - * {{{ - * object testLogged extends App { - * val x = new scala.xml.parsing.NoBindingFactoryAdapter - * with scala.xml.factory.LoggedNodeFactory[scala.xml.Elem] { - * override def log(s: String) = println(s) - * } - * - * Console.println("Start") - * val doc = x.load(new java.net.URL("http://example.com/file.xml")) - * Console.println("End") - * Console.println(doc) - * } - * }}} - * - * @author Burak Emir - */ -@deprecated("This trait will be removed.", "2.11") -trait LoggedNodeFactory[A <: Node] extends NodeFactory[A] { - // configuration values - val logNode = true - val logText = false - val logComment = false - val logProcInstr = false - - final val NONE = 0 - final val CACHE = 1 - final val FULL = 2 - /** 0 = no logging, 1 = cache hits, 2 = detail */ - val logCompressLevel = 1 - - // methods of NodeFactory - - /** logged version of makeNode method */ - override def makeNode(pre: String, label: String, attrSeq: MetaData, - scope: NamespaceBinding, children: Seq[Node]): A = { - if (logNode) - log("[makeNode for " + label + "]") - - val hash = Utility.hashCode(pre, label, attrSeq.##, scope.##, children) - - /* - if(logCompressLevel >= FULL) { - log("[hashcode total:"+hash); - log(" elem name "+uname+" hash "+ ? )); - log(" attrs "+attrSeq+" hash "+attrSeq.hashCode()); - log(" children :"+children+" hash "+children.hashCode()); - } - */ - if (!cache.get(hash).isEmpty && (logCompressLevel >= CACHE)) - log("[cache hit !]") - - super.makeNode(pre, label, attrSeq, scope, children) - } - - override def makeText(s: String) = { - if (logText) - log("[makeText:\"" + s + "\"]") - super.makeText(s) - } - - override def makeComment(s: String): Seq[Comment] = { - if (logComment) - log("[makeComment:\"" + s + "\"]") - super.makeComment(s) - } - - override def makeProcInstr(t: String, s: String): Seq[ProcInstr] = { - if (logProcInstr) - log("[makeProcInstr:\"" + t + " " + s + "\"]") - super.makeProcInstr(t, s) - } - - def log(msg: String): Unit = {} -} diff --git a/shared/src/main/scala/scala/xml/parsing/MarkupHandler.scala b/shared/src/main/scala/scala/xml/parsing/MarkupHandler.scala index bd4a2715d..886ee3499 100755 --- a/shared/src/main/scala/scala/xml/parsing/MarkupHandler.scala +++ b/shared/src/main/scala/scala/xml/parsing/MarkupHandler.scala @@ -129,7 +129,4 @@ abstract class MarkupHandler { def unparsedEntityDecl(name: String, extID: ExternalID, notat: String): Unit = () def notationDecl(notat: String, extID: ExternalID): Unit = () def reportSyntaxError(pos: Int, str: String): Unit - - @deprecated("This method and its usages will be removed. Use a debugger to debug code.", "2.11") - def log(msg: String): Unit = {} } From 0afc92ef9ae04bc26b63f25aae3e111521ae9c9e Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Tue, 27 Apr 2021 10:48:41 -0400 Subject: [PATCH 520/789] Enable Mima in native build --- build.sbt | 1 - 1 file changed, 1 deletion(-) diff --git a/build.sbt b/build.sbt index 6ddbeb97d..27cbfc03f 100644 --- a/build.sbt +++ b/build.sbt @@ -122,7 +122,6 @@ lazy val xml = crossProject(JSPlatform, JVMPlatform, NativePlatform) ) .jsConfigure(_.enablePlugins(ScalaJSJUnitPlugin)) .nativeSettings( - scalaModuleMimaPreviousVersion := None, // No such release yet // Scala Native cannot run forked tests Test / fork := false, libraryDependencies += "org.scala-native" %%% "junit-runtime" % nativeVersion % Test, From d3ea6ce3709b0a3d76599784fa6a8b435120b4ac Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Fri, 30 Apr 2021 09:56:29 -0400 Subject: [PATCH 521/789] Add ref to native Mima discussion --- build.sbt | 1 + 1 file changed, 1 insertion(+) diff --git a/build.sbt b/build.sbt index 27cbfc03f..d898f3539 100644 --- a/build.sbt +++ b/build.sbt @@ -55,6 +55,7 @@ lazy val xml = crossProject(JSPlatform, JVMPlatform, NativePlatform) |additional information regarding copyright ownership. |""".stripMargin)), + // Note: See discussion on Mima in https://github.com/scala/scala-xml/pull/517 scalaModuleMimaPreviousVersion := (CrossVersion.partialVersion(scalaVersion.value) match { // pending resolution of https://github.com/scalacenter/sbt-version-policy/issues/62 case Some((3, _)) => None From 2115b8906745474c528a666126018dfb43cef74e Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Wed, 5 May 2021 23:04:59 +0200 Subject: [PATCH 522/789] Update sbt-scala-module to 2.3.0 --- project/plugins.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/plugins.sbt b/project/plugins.sbt index 2aaf3d131..0c52dbfc3 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -4,7 +4,7 @@ val scalaJSVersion = val scalaNativeVersion = Option(System.getenv("SCALANATIVE_VERSION")).filter(_.nonEmpty).getOrElse("0.4.0") -addSbtPlugin("org.scala-lang.modules" % "sbt-scala-module" % "2.2.4") +addSbtPlugin("org.scala-lang.modules" % "sbt-scala-module" % "2.3.0") addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.0.0") addSbtPlugin("org.portable-scala" % "sbt-scala-native-crossproject" % "1.0.0") addSbtPlugin("org.scala-js" % "sbt-scalajs" % scalaJSVersion) From 5b9f14908c022318b32c428606e4d6a8c077c9cb Mon Sep 17 00:00:00 2001 From: Seth Tisue Date: Wed, 5 May 2021 14:26:52 -0700 Subject: [PATCH 523/789] add Automatic-Module-Name --- build.sbt | 1 + 1 file changed, 1 insertion(+) diff --git a/build.sbt b/build.sbt index 6ddbeb97d..632ec73ef 100644 --- a/build.sbt +++ b/build.sbt @@ -32,6 +32,7 @@ lazy val xml = crossProject(JSPlatform, JVMPlatform, NativePlatform) .jvmSettings(ScalaModulePlugin.scalaModuleOsgiSettings) .settings( name := "scala-xml", + scalaModuleAutomaticModuleName := Some("scala.xml"), scalacOptions ++= (CrossVersion.partialVersion(scalaVersion.value) match { case Some((3, _)) => Seq("-language:Scala2") From 4aa8117ddda8815e8d8617b4ce97803d26b166b3 Mon Sep 17 00:00:00 2001 From: Scala Steward <43047562+scala-steward@users.noreply.github.com> Date: Thu, 13 May 2021 20:04:01 +0200 Subject: [PATCH 524/789] Update sbt-version-policy to 1.0.0 (#520) --- project/plugins.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/plugins.sbt b/project/plugins.sbt index 0c52dbfc3..861e53bf6 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -10,4 +10,4 @@ addSbtPlugin("org.portable-scala" % "sbt-scala-native-crossproject" % "1.0.0") addSbtPlugin("org.scala-js" % "sbt-scalajs" % scalaJSVersion) addSbtPlugin("org.scala-native" % "sbt-scala-native" % scalaNativeVersion) addSbtPlugin("de.heikoseeberger" % "sbt-header" % "5.6.0") -addSbtPlugin("ch.epfl.scala" % "sbt-version-policy" % "1.0.0-RC5") +addSbtPlugin("ch.epfl.scala" % "sbt-version-policy" % "1.0.0") From 3f9e79e0b3a2af03b995e12094626506047d2020 Mon Sep 17 00:00:00 2001 From: Scala Steward <43047562+scala-steward@users.noreply.github.com> Date: Thu, 13 May 2021 20:04:12 +0200 Subject: [PATCH 525/789] Update sbt to 1.5.2 (#519) --- project/build.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/build.properties b/project/build.properties index f0be67b9f..19479ba46 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version=1.5.1 +sbt.version=1.5.2 From 8f200d70eb5c255349720777a246c37b82ce8232 Mon Sep 17 00:00:00 2001 From: Seth Tisue Date: Thu, 13 May 2021 14:02:31 -0700 Subject: [PATCH 526/789] add Scala 3.0.0 to crossbuild (and drop -RC2) (#522) --- .circleci/config.yml | 12 ++++++------ .travis.yml | 6 +++--- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 886f935ec..5ed9d75dc 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -111,13 +111,13 @@ workflows: java_version: jdk8 scala_version: 2.13.5 - scala_job: - name: 3.0.0-RC3 + name: 3.0.0 java_version: jdk8 - scala_version: 3.0.0-RC3 + scala_version: 3.0.0 - scala_job: - name: 3.0.0-RC2 + name: 3.0.0-RC3 java_version: jdk8 - scala_version: 3.0.0-RC2 + scala_version: 3.0.0-RC3 - scala_job: name: jdk11_2.12 java_version: jdk11 @@ -129,7 +129,7 @@ workflows: - scala_job: name: jdk11_3.0 java_version: jdk11 - scala_version: 3.0.0-RC3 + scala_version: 3.0.0 - scala_job: name: jdk16_2.12 java_version: jdk16 @@ -141,7 +141,7 @@ workflows: - scala_job: name: jdk16_3.0 java_version: jdk16 - scala_version: 3.0.0-RC3 + scala_version: 3.0.0 - scalajs_job: name: sjs1.0_2.12 scala_version: 2.12.13 diff --git a/.travis.yml b/.travis.yml index 2a9889af0..c59234188 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,8 +5,8 @@ import: scala/scala-dev:travis/default.yml language: scala scala: + - 3.0.0 - 3.0.0-RC3 - - 3.0.0-RC2 - 2.12.13 - 2.13.5 @@ -19,10 +19,10 @@ env: jobs: exclude: - - scala: 3.0.0-RC2 - env: SCALANATIVE_VERSION=0.4.0 ADOPTOPENJDK=8 - scala: 3.0.0-RC3 env: SCALANATIVE_VERSION=0.4.0 ADOPTOPENJDK=8 + - scala: 3.0.0 + env: SCALANATIVE_VERSION=0.4.0 ADOPTOPENJDK=8 install: - git fetch --tags # get all tags for sbt-dynver From 41140efcbe23bc388d6e91f1f7894dcd43936044 Mon Sep 17 00:00:00 2001 From: Scala Steward <43047562+scala-steward@users.noreply.github.com> Date: Fri, 14 May 2021 00:57:21 +0200 Subject: [PATCH 527/789] Update sbt-version-policy to 1.0.1 (#523) --- project/plugins.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/plugins.sbt b/project/plugins.sbt index 861e53bf6..fe4b6e494 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -10,4 +10,4 @@ addSbtPlugin("org.portable-scala" % "sbt-scala-native-crossproject" % "1.0.0") addSbtPlugin("org.scala-js" % "sbt-scalajs" % scalaJSVersion) addSbtPlugin("org.scala-native" % "sbt-scala-native" % scalaNativeVersion) addSbtPlugin("de.heikoseeberger" % "sbt-header" % "5.6.0") -addSbtPlugin("ch.epfl.scala" % "sbt-version-policy" % "1.0.0") +addSbtPlugin("ch.epfl.scala" % "sbt-version-policy" % "1.0.1") From 13500eaaabee8a4bd05388ad6a3a35b61e56c88f Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Thu, 13 May 2021 22:28:54 -0400 Subject: [PATCH 528/789] Add release notes to CHANGELOG.md --- CHANGELOG.md | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 401161374..16d76f627 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,38 @@ # Scala XML Changes +## 2.0.0 (2021-05-13) + +Published for Scala 2.12 and 2.13, Scala 3.0.0 (and -RC3), Scala.js 1.5, and Scala Native 0.4. + +- Support Scala 3.0.0 +- Drop `scala.xml.Properties +- Remove deprecated logging + +## 2.0.0-RC1 (2021-03-29) + +NOTICE: The safe-defaults change may be a breaking change for some users. Details on PR. + +- Set safe defaults for parser settings +- Use a `ThreadLocal` to allow reusing parser instances +- Declare version policy + +Published for Scala 2.12 and 2.13, Scala 3.0.0-RC2 and -RC1, Scala.js 1.5, and Scala Native 0.4. + +## 2.0.0-M4 (2021-02-16) + +Published for Scala 2.12 and 2.13, Scala 3.0.0-RC1 and -M3, Scala.js 1.5, and Scala Native 0.4. + +- Support Scala 3.0.0-RC1 (and drop 3.0.0-M2) +- Upgrade Scala.js to 1.5.0 + +## 2.0.0-M3 (2021-01-30) + +Published for Scala 2.12 and 2.13, Scala 3.0.0-M2 and -M3, Scala.js 1.4, and Scala Native 0.4. + +- Add support for Scala Native 0.4 +- Make RuleTransformer fully recursive +- Fix invalid comment edge case + ## 2.0.0-M2 (2020-09-15) Published for Scala 2.12 and 2.13, Scala.js 1.2.0, From 7f054515728ac6e55854f95b01392ebc04369d26 Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Thu, 13 May 2021 23:43:43 -0400 Subject: [PATCH 529/789] Combine the 2.0 release notes --- CHANGELOG.md | 73 +++++++++++++++++++--------------------------------- 1 file changed, 26 insertions(+), 47 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 16d76f627..d1243123b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,63 +2,39 @@ ## 2.0.0 (2021-05-13) -Published for Scala 2.12 and 2.13, Scala 3.0.0 (and -RC3), Scala.js 1.5, and Scala Native 0.4. +Not binary compatible with Scala XML 1.3.0. -- Support Scala 3.0.0 -- Drop `scala.xml.Properties -- Remove deprecated logging +Published for Scala 2.12, 2.13, and 3.0 (and 3.0.0-RC3), Scala.js 1.5, +and Scala Native 0.4. -## 2.0.0-RC1 (2021-03-29) +Artifacts are no longer published for Scala 2.11 and Scala.js 0.6. -NOTICE: The safe-defaults change may be a breaking change for some users. Details on PR. - -- Set safe defaults for parser settings -- Use a `ThreadLocal` to allow reusing parser instances -- Declare version policy - -Published for Scala 2.12 and 2.13, Scala 3.0.0-RC2 and -RC1, Scala.js 1.5, and Scala Native 0.4. - -## 2.0.0-M4 (2021-02-16) - -Published for Scala 2.12 and 2.13, Scala 3.0.0-RC1 and -M3, Scala.js 1.5, and Scala Native 0.4. - -- Support Scala 3.0.0-RC1 (and drop 3.0.0-M2) -- Upgrade Scala.js to 1.5.0 - -## 2.0.0-M3 (2021-01-30) - -Published for Scala 2.12 and 2.13, Scala 3.0.0-M2 and -M3, Scala.js 1.4, and Scala Native 0.4. - -- Add support for Scala Native 0.4 -- Make RuleTransformer fully recursive -- Fix invalid comment edge case - -## 2.0.0-M2 (2020-09-15) - -Published for Scala 2.12 and 2.13, Scala.js 1.2.0, -and Dotty 0.27.0-RC1. - -### Removed - -- Removed `scala.xml.dtd.ElementValidator` - -## 2.0.0-M1 (2019-10-21) - -Not binary compatible with Scala XML 1.2.0. - -Published for Scala 2.12, 2.13 and Scala.js 0.6, 1.0.0-M8. -Artifacts are no longer published for Scala 2.11. - -Some deprecated elements have been removed; see the "[Removed](#Removed)" section below. +A number of deprecated elements have been removed from the library; +see the "[Removed](#Removed)" section below. The library's JAR byte +size is about 15% smaller. ### Added +- Add `scala.xml.transform.NestingTransformer`, to apply a single rule + recursively, to give the original behavior of `RuleTransformer`, see + below. - The `apiURL` is now published in ivy metadata so that hyperlinks exist in downstream projects that reference Scala XML in their Scaladocs. +- Declare version policy of with early-semver in Mima with + sbt-version-policy plugin ### Changed +- Changes to the default parser settings for the JDK SAXParser, see + [Safe parser defaults](https://github.com/scala/scala-xml/wiki/Safer-parser-defaults) + page on the wiki. +- The parser used by the load methods from `scala.xml.XML` and from + `scala.xml.factory.XMLLoader` is now a `ThreadLocal` instance of + SAXParser to reuse the parser instance and avoid repeatedly + allocating one on every file load. +- Improve `scala.xml.transform.RuleTransformer` to apply all rules recursively. +- Reject invalid comment text that ends in a dash (-) in `scala.xml.Comment`. - Changed use of `scala.collection.mutable.Stack` in `FactoryAdapter` to a `scala.collection.immutable.List`. These members were affected. - `attribStack` @@ -82,8 +58,8 @@ Most of these deletions are of vestigial code that is either unused, of poor quality or both. Very few users of Scala XML will even notice the removed parts. Most users will not be affected. -The deletions represent about one thousand lines of code (sloc). By -comparison Scala XML is 10,000 sloc, so this is about 10% reduction in +The deletions represent about 1500 lines of code (sloc). By +comparison Scala XML is 10,000 sloc, so this is about 15% reduction in sloc. The code that supports XML literals is maintained upstream in the Scala compiler, not in the Scala XML library. @@ -101,3 +77,6 @@ the Scala compiler, not in the Scala XML library. - Remove `scala.xml.dtd.ElementValidator` - Remove `scala.xml.factory.Binder` - Remove `scala.xml.parsing.ValidatingMarkupHandler` +- Remove `scala.xml.Properties` +- Remove `scala.xml.factory.LoggedNodeFactory` +- Remove `scala.xml.parsing.MarkupHandler.log` From 2651dfe829dff51e5daf3c80d21ca4c7e140d0cd Mon Sep 17 00:00:00 2001 From: Seth Tisue Date: Thu, 13 May 2021 22:43:38 -0700 Subject: [PATCH 530/789] update build and readme, post-2.0.0 (#525) --- README.md | 6 ++---- build.sbt | 18 ++++-------------- 2 files changed, 6 insertions(+), 18 deletions(-) diff --git a/README.md b/README.md index 684d7f4eb..4418c95ba 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ scala-xml [![Travis](https://img.shields.io/travis/scala/scala-xml.svg)](https://travis-ci.org/scala/scala-xml) -[![latest release for 2.11](https://img.shields.io/maven-central/v/org.scala-lang.modules/scala-xml_2.11.svg?label=scala+2.11)](http://mvnrepository.com/artifact/org.scala-lang.modules/scala-xml_2.11) [![latest release for 2.12](https://img.shields.io/maven-central/v/org.scala-lang.modules/scala-xml_2.12.svg?label=scala+2.12)](http://mvnrepository.com/artifact/org.scala-lang.modules/scala-xml_2.12) [![latest release for 2.13](https://img.shields.io/maven-central/v/org.scala-lang.modules/scala-xml_2.13.svg?label=scala+2.13)](http://mvnrepository.com/artifact/org.scala-lang.modules/scala-xml_2.13) +[![latest release for 3.0](https://img.shields.io/maven-central/v/org.scala-lang.modules/scala-xml_3.svg?label=scala+3)](http://mvnrepository.com/artifact/org.scala-lang.modules/scala-xml_3) [![Gitter](https://badges.gitter.im/Join+Chat.svg)](https://gitter.im/scala/scala-xml) ========= @@ -14,9 +14,7 @@ API documentation is available [here](https://javadoc.io/doc/org.scala-lang.modu How to documentation is available in the [wiki](https://github.com/scala/scala-xml/wiki) -The latest stable release of Scala XML is 1.3.0. - -The 2.0.0-RCx series supports Scala 3. See also the changes for 2.0 in `CHANGELOG.md`. +The latest stable release of Scala XML is 2.0.0. ## Maintenance status diff --git a/build.sbt b/build.sbt index dde62c42d..52982f8fb 100644 --- a/build.sbt +++ b/build.sbt @@ -37,8 +37,8 @@ lazy val xml = crossProject(JSPlatform, JVMPlatform, NativePlatform) case Some((3, _)) => Seq("-language:Scala2") case _ => - // Compiler team advised avoiding the -Xsource:2.14 option for releases. - // The output with -Xsource should be periodically checked, though. + // Compiler team advised avoiding the -Xsource:3 option for releases. + // The output with -Xsource:3 should be periodically checked, though. Seq("-deprecation:false", "-feature", "-Xlint:-stars-align,-nullary-unit,_") }), @@ -56,23 +56,13 @@ lazy val xml = crossProject(JSPlatform, JVMPlatform, NativePlatform) |additional information regarding copyright ownership. |""".stripMargin)), - // Note: See discussion on Mima in https://github.com/scala/scala-xml/pull/517 - scalaModuleMimaPreviousVersion := (CrossVersion.partialVersion(scalaVersion.value) match { - // pending resolution of https://github.com/scalacenter/sbt-version-policy/issues/62 - case Some((3, _)) => None - case _ => Some("2.0.0-RC1") - }), + // Note: See discussion on non-JVM Mima in https://github.com/scala/scala-xml/pull/517 + scalaModuleMimaPreviousVersion := Some("2.0.0"), mimaReportSignatureProblems := true, mimaBinaryIssueFilters ++= { import com.typesafe.tools.mima.core._ import com.typesafe.tools.mima.core.ProblemFilters._ Seq( - // Deprecated in 2.0.0-RC2 - exclude[MissingClassProblem]("scala.xml.factory.LoggedNodeFactory"), - exclude[DirectMissingMethodProblem]("scala.xml.parsing.MarkupHandler.log"), - // because we reverted #279 - exclude[DirectMissingMethodProblem]("scala.xml.Utility.escapeText"), - exclude[MissingClassProblem]("scala.xml.Properties*"), // afaict this is just a JDK 8 vs 16 difference, producing a false positive when // we compare classes built on JDK 16 (which we only do on CI, not at release time) // to previous-version artifacts that were built on 8. see scala/scala-xml#501 From 0d6b30725eaff2bbe0ecd4a088539c6de946a73a Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Mon, 17 May 2021 14:08:51 +0200 Subject: [PATCH 531/789] Update scala-compiler, scala-library to 2.13.6 --- .circleci/config.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 5ed9d75dc..38a0d990c 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -109,7 +109,7 @@ workflows: - scala_job: name: 2.13.5 java_version: jdk8 - scala_version: 2.13.5 + scala_version: 2.13.6 - scala_job: name: 3.0.0 java_version: jdk8 @@ -125,7 +125,7 @@ workflows: - scala_job: name: jdk11_2.13 java_version: jdk11 - scala_version: 2.13.5 + scala_version: 2.13.6 - scala_job: name: jdk11_3.0 java_version: jdk11 @@ -137,7 +137,7 @@ workflows: - scala_job: name: jdk16_2.13 java_version: jdk16 - scala_version: 2.13.5 + scala_version: 2.13.6 - scala_job: name: jdk16_3.0 java_version: jdk16 @@ -148,7 +148,7 @@ workflows: scalajs_version: 1.5.1 - scalajs_job: name: sjs1.0_2.13 - scala_version: 2.13.5 + scala_version: 2.13.6 scalajs_version: 1.5.1 - scalanative_job: name: native0.4_2.12 @@ -156,5 +156,5 @@ workflows: scalanative_version: 0.4.0 - scalanative_job: name: native0.4_2.13 - scala_version: 2.13.5 + scala_version: 2.13.6 scalanative_version: 0.4.0 From 99411e575d2e76350a6e43d850fb35cb01694dce Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Mon, 17 May 2021 08:18:16 -0400 Subject: [PATCH 532/789] Update travis to Scala 2.13.6 --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index c59234188..acd6ffc18 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,7 +8,7 @@ scala: - 3.0.0 - 3.0.0-RC3 - 2.12.13 - - 2.13.5 + - 2.13.6 env: - SCALAJS_VERSION= ADOPTOPENJDK=8 From 6337f131a0c887965cab23da5dae98f70214774b Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Mon, 17 May 2021 10:19:04 -0400 Subject: [PATCH 533/789] Update .circleci/config.yml Co-authored-by: Philippus Baalman --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 38a0d990c..ac1f1d08b 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -107,7 +107,7 @@ workflows: java_version: jdk8 scala_version: 2.12.13 - scala_job: - name: 2.13.5 + name: 2.13.6 java_version: jdk8 scala_version: 2.13.6 - scala_job: From 8e0647e7305fc2af47900247aa3605fed015d84c Mon Sep 17 00:00:00 2001 From: Scala Steward <43047562+scala-steward@users.noreply.github.com> Date: Fri, 28 May 2021 15:47:25 +0200 Subject: [PATCH 534/789] Update sbt-scala-module to 2.3.1 (#529) --- project/plugins.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/plugins.sbt b/project/plugins.sbt index fe4b6e494..6b10d076c 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -4,7 +4,7 @@ val scalaJSVersion = val scalaNativeVersion = Option(System.getenv("SCALANATIVE_VERSION")).filter(_.nonEmpty).getOrElse("0.4.0") -addSbtPlugin("org.scala-lang.modules" % "sbt-scala-module" % "2.3.0") +addSbtPlugin("org.scala-lang.modules" % "sbt-scala-module" % "2.3.1") addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.0.0") addSbtPlugin("org.portable-scala" % "sbt-scala-native-crossproject" % "1.0.0") addSbtPlugin("org.scala-js" % "sbt-scalajs" % scalaJSVersion) From d8bd513871d177882200eb2337239232d431cbae Mon Sep 17 00:00:00 2001 From: Scala Steward <43047562+scala-steward@users.noreply.github.com> Date: Tue, 1 Jun 2021 16:58:48 +0200 Subject: [PATCH 535/789] Update sbt to 1.5.3 (#531) --- project/build.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/build.properties b/project/build.properties index 19479ba46..67d27a1df 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version=1.5.2 +sbt.version=1.5.3 From 62c41d1003589545edfebbb2cfa4145d1ee564eb Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Tue, 8 Jun 2021 19:20:27 +0200 Subject: [PATCH 536/789] Update sbt-scalajs, ... to 1.6.0 --- .circleci/config.yml | 4 ++-- .travis.yml | 2 +- project/plugins.sbt | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index ac1f1d08b..538a62ca1 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -145,11 +145,11 @@ workflows: - scalajs_job: name: sjs1.0_2.12 scala_version: 2.12.13 - scalajs_version: 1.5.1 + scalajs_version: 1.6.0 - scalajs_job: name: sjs1.0_2.13 scala_version: 2.13.6 - scalajs_version: 1.5.1 + scalajs_version: 1.6.0 - scalanative_job: name: native0.4_2.12 scala_version: 2.12.13 diff --git a/.travis.yml b/.travis.yml index acd6ffc18..170cb7f36 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,7 +12,7 @@ scala: env: - SCALAJS_VERSION= ADOPTOPENJDK=8 - - SCALAJS_VERSION=1.5.1 ADOPTOPENJDK=8 + - SCALAJS_VERSION=1.6.0 ADOPTOPENJDK=8 - SCALANATIVE_VERSION=0.4.0 ADOPTOPENJDK=8 - SCALAJS_VERSION= ADOPTOPENJDK=11 - SCALAJS_VERSION= ADOPTOPENJDK=16 diff --git a/project/plugins.sbt b/project/plugins.sbt index 6b10d076c..ae66d2c65 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,5 +1,5 @@ val scalaJSVersion = - Option(System.getenv("SCALAJS_VERSION")).filter(_.nonEmpty).getOrElse("1.5.1") + Option(System.getenv("SCALAJS_VERSION")).filter(_.nonEmpty).getOrElse("1.6.0") val scalaNativeVersion = Option(System.getenv("SCALANATIVE_VERSION")).filter(_.nonEmpty).getOrElse("0.4.0") From 0cdc727bfe5adb198a454df3817e131324f5cf99 Mon Sep 17 00:00:00 2001 From: Scala Steward <43047562+scala-steward@users.noreply.github.com> Date: Wed, 9 Jun 2021 06:43:32 +0200 Subject: [PATCH 537/789] Update scala-compiler, scala-library to 2.12.14 (#530) Co-authored-by: Seth Tisue --- .circleci/config.yml | 20 ++++++++++---------- .travis.yml | 2 +- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index ac1f1d08b..6afaabd2d 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -17,7 +17,7 @@ commands: parameters: scala_version: type: string - default: 2.12.13 + default: 2.12.14 sbt_tasks: type: string default: update compile test:compile test doc package osgiBundle @@ -41,7 +41,7 @@ jobs: parameters: scala_version: description: "Scala version" - default: 2.12.13 + default: 2.12.14 type: string java_version: description: "Java version" @@ -58,7 +58,7 @@ jobs: parameters: scala_version: description: "Scala version" - default: 2.12.13 + default: 2.12.14 type: string scalajs_version: description: "ScalaJS version" @@ -78,7 +78,7 @@ jobs: parameters: scala_version: description: "Scala version" - default: 2.12.13 + default: 2.12.14 type: string scalanative_version: description: "Scala Native version" @@ -103,9 +103,9 @@ workflows: build: jobs: - scala_job: - name: 2.12.13 + name: 2.12.14 java_version: jdk8 - scala_version: 2.12.13 + scala_version: 2.12.14 - scala_job: name: 2.13.6 java_version: jdk8 @@ -121,7 +121,7 @@ workflows: - scala_job: name: jdk11_2.12 java_version: jdk11 - scala_version: 2.12.13 + scala_version: 2.12.14 - scala_job: name: jdk11_2.13 java_version: jdk11 @@ -133,7 +133,7 @@ workflows: - scala_job: name: jdk16_2.12 java_version: jdk16 - scala_version: 2.12.13 + scala_version: 2.12.14 - scala_job: name: jdk16_2.13 java_version: jdk16 @@ -144,7 +144,7 @@ workflows: scala_version: 3.0.0 - scalajs_job: name: sjs1.0_2.12 - scala_version: 2.12.13 + scala_version: 2.12.14 scalajs_version: 1.5.1 - scalajs_job: name: sjs1.0_2.13 @@ -152,7 +152,7 @@ workflows: scalajs_version: 1.5.1 - scalanative_job: name: native0.4_2.12 - scala_version: 2.12.13 + scala_version: 2.12.14 scalanative_version: 0.4.0 - scalanative_job: name: native0.4_2.13 diff --git a/.travis.yml b/.travis.yml index acd6ffc18..06184e64a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,7 +7,7 @@ language: scala scala: - 3.0.0 - 3.0.0-RC3 - - 2.12.13 + - 2.12.14 - 2.13.6 env: From 1459cb44567832914830a7076b69668d1e94c799 Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Wed, 9 Jun 2021 08:51:54 +0200 Subject: [PATCH 538/789] Update sbt-scalajs, scalajs-compiler, ... to 1.6.0 --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 196b263f2..cbb8974ad 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -145,7 +145,7 @@ workflows: - scalajs_job: name: sjs1.0_2.12 scala_version: 2.12.14 - scalajs_version: 1.5.1 + scalajs_version: 1.6.0 - scalajs_job: name: sjs1.0_2.13 scala_version: 2.13.6 From bf2a258d59788e0f749e708919e1051b48880b0e Mon Sep 17 00:00:00 2001 From: Scala Steward <43047562+scala-steward@users.noreply.github.com> Date: Mon, 14 Jun 2021 17:54:06 +0200 Subject: [PATCH 539/789] Update sbt to 1.5.4 (#535) --- project/build.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/build.properties b/project/build.properties index 67d27a1df..9edb75b77 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version=1.5.3 +sbt.version=1.5.4 From 0c11f44c2029fd6d2c47c7d92c4c160cc3adc228 Mon Sep 17 00:00:00 2001 From: Seth Tisue Date: Thu, 24 Jun 2021 10:06:27 -0700 Subject: [PATCH 540/789] relax version policy to allow Scala.js 1.6 upgrade --- build.sbt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index 52982f8fb..38f6b1460 100644 --- a/build.sbt +++ b/build.sbt @@ -4,7 +4,9 @@ ThisBuild / startYear := Some(2002) ThisBuild / licenses += (("Apache-2.0", url("https://www.apache.org/licenses/LICENSE-2.0"))) ThisBuild / versionScheme := Some("early-semver") -ThisBuild / versionPolicyIntention := Compatibility.BinaryAndSourceCompatible +ThisBuild / versionPolicyIntention := Compatibility.BinaryCompatible +// because it doesn't declare it itself +ThisBuild / versionPolicyDependencySchemes += "org.scala-js" %% "scalajs-library" % "semver-spec" lazy val configSettings: Seq[Setting[_]] = Seq( unmanagedSourceDirectories ++= { From f93cd3b811bf4de9bc82093168e10b4cadf7bd24 Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Sat, 3 Jul 2021 05:06:03 +0200 Subject: [PATCH 541/789] Update sbt-scala-native-crossproject, ... to 1.1.0 --- project/plugins.sbt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/project/plugins.sbt b/project/plugins.sbt index ae66d2c65..e916c9c6a 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -5,8 +5,8 @@ val scalaNativeVersion = Option(System.getenv("SCALANATIVE_VERSION")).filter(_.nonEmpty).getOrElse("0.4.0") addSbtPlugin("org.scala-lang.modules" % "sbt-scala-module" % "2.3.1") -addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.0.0") -addSbtPlugin("org.portable-scala" % "sbt-scala-native-crossproject" % "1.0.0") +addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.1.0") +addSbtPlugin("org.portable-scala" % "sbt-scala-native-crossproject" % "1.1.0") addSbtPlugin("org.scala-js" % "sbt-scalajs" % scalaJSVersion) addSbtPlugin("org.scala-native" % "sbt-scala-native" % scalaNativeVersion) addSbtPlugin("de.heikoseeberger" % "sbt-header" % "5.6.0") From 9f25ed76fd68cc827d4ac31a3cdfb327dd8f3fff Mon Sep 17 00:00:00 2001 From: Philippus Baalman Date: Sat, 3 Jul 2021 10:05:35 +0200 Subject: [PATCH 542/789] Use jsEnablePlugins-method --- build.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index 38f6b1460..b560cdaa0 100644 --- a/build.sbt +++ b/build.sbt @@ -117,7 +117,7 @@ lazy val xml = crossProject(JSPlatform, JVMPlatform, NativePlatform) // Scala.js cannot run forked tests Test / fork := false ) - .jsConfigure(_.enablePlugins(ScalaJSJUnitPlugin)) + .jsEnablePlugins(ScalaJSJUnitPlugin) .nativeSettings( // Scala Native cannot run forked tests Test / fork := false, From 80afaf2581430441f7848d994bece436420501e5 Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Fri, 9 Jul 2021 15:54:39 +0200 Subject: [PATCH 543/789] Update scala3-library, ... to 3.0.1 --- .circleci/config.yml | 8 ++++---- .travis.yml | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index cbb8974ad..42288fe78 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -113,11 +113,11 @@ workflows: - scala_job: name: 3.0.0 java_version: jdk8 - scala_version: 3.0.0 + scala_version: 3.0.1 - scala_job: name: 3.0.0-RC3 java_version: jdk8 - scala_version: 3.0.0-RC3 + scala_version: 3.0.1-RC3 - scala_job: name: jdk11_2.12 java_version: jdk11 @@ -129,7 +129,7 @@ workflows: - scala_job: name: jdk11_3.0 java_version: jdk11 - scala_version: 3.0.0 + scala_version: 3.0.1 - scala_job: name: jdk16_2.12 java_version: jdk16 @@ -141,7 +141,7 @@ workflows: - scala_job: name: jdk16_3.0 java_version: jdk16 - scala_version: 3.0.0 + scala_version: 3.0.1 - scalajs_job: name: sjs1.0_2.12 scala_version: 2.12.14 diff --git a/.travis.yml b/.travis.yml index f31e3471e..dda5330f7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -19,9 +19,9 @@ env: jobs: exclude: - - scala: 3.0.0-RC3 + - scala: 3.0.1-RC3 env: SCALANATIVE_VERSION=0.4.0 ADOPTOPENJDK=8 - - scala: 3.0.0 + - scala: 3.0.1 env: SCALANATIVE_VERSION=0.4.0 ADOPTOPENJDK=8 install: From 98127e0afbf1df71e95030b54306c3c4107c6ee1 Mon Sep 17 00:00:00 2001 From: Seth Tisue Date: Fri, 9 Jul 2021 07:50:11 -0700 Subject: [PATCH 544/789] drop Scala 3.0.0-RC3 from crossbuild --- .circleci/config.yml | 6 +----- .travis.yml | 5 +---- CHANGELOG.md | 2 +- 3 files changed, 3 insertions(+), 10 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 42288fe78..1759491bd 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -111,13 +111,9 @@ workflows: java_version: jdk8 scala_version: 2.13.6 - scala_job: - name: 3.0.0 + name: 3.0.1 java_version: jdk8 scala_version: 3.0.1 - - scala_job: - name: 3.0.0-RC3 - java_version: jdk8 - scala_version: 3.0.1-RC3 - scala_job: name: jdk11_2.12 java_version: jdk11 diff --git a/.travis.yml b/.travis.yml index dda5330f7..cbddb8f23 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,8 +5,7 @@ import: scala/scala-dev:travis/default.yml language: scala scala: - - 3.0.0 - - 3.0.0-RC3 + - 3.0.1 - 2.12.14 - 2.13.6 @@ -19,8 +18,6 @@ env: jobs: exclude: - - scala: 3.0.1-RC3 - env: SCALANATIVE_VERSION=0.4.0 ADOPTOPENJDK=8 - scala: 3.0.1 env: SCALANATIVE_VERSION=0.4.0 ADOPTOPENJDK=8 diff --git a/CHANGELOG.md b/CHANGELOG.md index d1243123b..47db07d2c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,7 @@ Not binary compatible with Scala XML 1.3.0. -Published for Scala 2.12, 2.13, and 3.0 (and 3.0.0-RC3), Scala.js 1.5, +Published for Scala 2.12, 2.13, and 3.0, Scala.js 1.5, and Scala Native 0.4. Artifacts are no longer published for Scala 2.11 and Scala.js 0.6. From dc9dda6649d960736869c2d20a58980e24f4d054 Mon Sep 17 00:00:00 2001 From: Scala Steward <43047562+scala-steward@users.noreply.github.com> Date: Mon, 12 Jul 2021 16:52:39 +0200 Subject: [PATCH 545/789] Update sbt to 1.5.5 (#539) --- project/build.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/build.properties b/project/build.properties index 9edb75b77..10fd9eee0 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version=1.5.4 +sbt.version=1.5.5 From 272b5733b07559d863de056b31d0d680a7b94074 Mon Sep 17 00:00:00 2001 From: Seth Tisue Date: Thu, 15 Jul 2021 16:05:27 -0400 Subject: [PATCH 546/789] CI: JDK 17 (was 16) (#540) --- .circleci/config.yml | 16 ++++++++-------- .jvmopts | 0 .travis.yml | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) create mode 100644 .jvmopts diff --git a/.circleci/config.yml b/.circleci/config.yml index 1759491bd..51dfb564c 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -7,9 +7,9 @@ executors: scala_jdk11_executor: docker: - image: circleci/openjdk:11-jdk - scala_jdk16_executor: + scala_jdk17_executor: docker: - - image: circleci/openjdk:16-buster + - image: circleci/openjdk:17-buster commands: sbt_cmd: @@ -127,16 +127,16 @@ workflows: java_version: jdk11 scala_version: 3.0.1 - scala_job: - name: jdk16_2.12 - java_version: jdk16 + name: jdk17_2.12 + java_version: jdk17 scala_version: 2.12.14 - scala_job: - name: jdk16_2.13 - java_version: jdk16 + name: jdk17_2.13 + java_version: jdk17 scala_version: 2.13.6 - scala_job: - name: jdk16_3.0 - java_version: jdk16 + name: jdk17_3.0 + java_version: jdk17 scala_version: 3.0.1 - scalajs_job: name: sjs1.0_2.12 diff --git a/.jvmopts b/.jvmopts new file mode 100644 index 000000000..e69de29bb diff --git a/.travis.yml b/.travis.yml index cbddb8f23..9385cc935 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,7 +14,7 @@ env: - SCALAJS_VERSION=1.6.0 ADOPTOPENJDK=8 - SCALANATIVE_VERSION=0.4.0 ADOPTOPENJDK=8 - SCALAJS_VERSION= ADOPTOPENJDK=11 - - SCALAJS_VERSION= ADOPTOPENJDK=16 + - SCALAJS_VERSION= ADOPTOPENJDK=17 jobs: exclude: From e826be8e2bd5e13788a4261cecba82fd86da862c Mon Sep 17 00:00:00 2001 From: Seth Tisue Date: Fri, 16 Jul 2021 18:28:13 -0400 Subject: [PATCH 547/789] fix #541 by working around Scala 3 compiler bug --- .../scala/xml/parsing/ConstructingParserTest.scala | 14 +++++++++++++- .../scala/scala/xml/parsing/MarkupParser.scala | 5 ++++- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/jvm/src/test/scala/scala/xml/parsing/ConstructingParserTest.scala b/jvm/src/test/scala/scala/xml/parsing/ConstructingParserTest.scala index 413cd9a74..fb8590d00 100644 --- a/jvm/src/test/scala/scala/xml/parsing/ConstructingParserTest.scala +++ b/jvm/src/test/scala/scala/xml/parsing/ConstructingParserTest.scala @@ -75,10 +75,22 @@ class ConstructingParserTest { @Test def SI6341issue65: Unit = { val str = """""" - val cpa = ConstructingParser.fromSource(io.Source.fromString(str), preserveWS = true) + val cpa = ConstructingParser.fromSource(Source.fromString(str), preserveWS = true) val cpadoc = cpa.document() val ppr = new PrettyPrinter(80,5) val out = ppr.format(cpadoc.docElem) assertEquals(str, out) } + + // https://github.com/scala/scala-xml/issues/541 + @Test + def issue541: Unit = { + val xml = + """|""".stripMargin + val parser = ConstructingParser.fromSource(Source.fromString(xml), preserveWS = true) + parser.document().docElem // shouldn't crash + } + } diff --git a/shared/src/main/scala/scala/xml/parsing/MarkupParser.scala b/shared/src/main/scala/scala/xml/parsing/MarkupParser.scala index 95ec2ec55..acd19485e 100755 --- a/shared/src/main/scala/scala/xml/parsing/MarkupParser.scala +++ b/shared/src/main/scala/scala/xml/parsing/MarkupParser.scala @@ -58,7 +58,10 @@ trait MarkupParser extends MarkupParserCommon with TokenTests { protected var curInput: Source = input // See ticket #3720 for motivations. - private class WithLookAhead(underlying: Source) extends Source { + // As for why it's `private[parsing]` rather than merely `private`, see + // https://github.com/scala/scala-xml/issues/541 ; the broader access is necessary, + // for now anyway, to work around https://github.com/lampepfl/dotty/issues/13096 + private[parsing] class WithLookAhead(underlying: Source) extends Source { private val queue = scala.collection.mutable.Queue[Char]() def lookahead(): BufferedIterator[Char] = { val iter = queue.iterator ++ new Iterator[Char] { From 09d527abf5fa42f66dbceb6d133fbdebdecd0337 Mon Sep 17 00:00:00 2001 From: Seth Tisue Date: Tue, 20 Jul 2021 16:43:47 -0700 Subject: [PATCH 548/789] bump version in readme --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 4418c95ba..4502ef918 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ API documentation is available [here](https://javadoc.io/doc/org.scala-lang.modu How to documentation is available in the [wiki](https://github.com/scala/scala-xml/wiki) -The latest stable release of Scala XML is 2.0.0. +The latest stable release of Scala XML is 2.0.1. ## Maintenance status From db2208105116feb7ea795787250777d8d9a8f71f Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Tue, 27 Jul 2021 17:06:52 +0200 Subject: [PATCH 549/789] Update sbt-version-policy to 1.2.1 --- project/plugins.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/plugins.sbt b/project/plugins.sbt index e916c9c6a..9f7ba7a2f 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -10,4 +10,4 @@ addSbtPlugin("org.portable-scala" % "sbt-scala-native-crossproject" % "1.1.0") addSbtPlugin("org.scala-js" % "sbt-scalajs" % scalaJSVersion) addSbtPlugin("org.scala-native" % "sbt-scala-native" % scalaNativeVersion) addSbtPlugin("de.heikoseeberger" % "sbt-header" % "5.6.0") -addSbtPlugin("ch.epfl.scala" % "sbt-version-policy" % "1.0.1") +addSbtPlugin("ch.epfl.scala" % "sbt-version-policy" % "1.2.1") From ba30ac6439c0de58a1109c1b99a90ec449f63830 Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Tue, 3 Aug 2021 23:24:11 +0200 Subject: [PATCH 550/789] Update sbt-scala-module to 2.4.0 --- project/plugins.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/plugins.sbt b/project/plugins.sbt index 9f7ba7a2f..e591fd3d9 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -4,7 +4,7 @@ val scalaJSVersion = val scalaNativeVersion = Option(System.getenv("SCALANATIVE_VERSION")).filter(_.nonEmpty).getOrElse("0.4.0") -addSbtPlugin("org.scala-lang.modules" % "sbt-scala-module" % "2.3.1") +addSbtPlugin("org.scala-lang.modules" % "sbt-scala-module" % "2.4.0") addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.1.0") addSbtPlugin("org.portable-scala" % "sbt-scala-native-crossproject" % "1.1.0") addSbtPlugin("org.scala-js" % "sbt-scalajs" % scalaJSVersion) From f34cca230c3d4e81c30d18b5f5d582c111487f71 Mon Sep 17 00:00:00 2001 From: Julien Richard-Foy Date: Wed, 4 Aug 2021 10:04:35 +0200 Subject: [PATCH 551/789] Adjust build definition and CI process - remove `versionScheme` (already set by sbt-version-policy) - scope `versionPolicyIntention` to projects, instead of to `ThisBuild` - replace `versionPolicyDependencySchemes` with `libraryDependencySchemes` - remove `scalaModuleMimaPreviousVersion` (already set by sbt-version-policy) - remove invocation of `versionPolicyCheck` from CI (already invoked by `test`) - add invocation of `versionCheck` before publishing a release --- build.sbt | 6 ++---- build.sh | 3 ++- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/build.sbt b/build.sbt index b560cdaa0..6c1e3e934 100644 --- a/build.sbt +++ b/build.sbt @@ -3,10 +3,8 @@ import sbtcrossproject.CrossPlugin.autoImport.{crossProject, CrossType} ThisBuild / startYear := Some(2002) ThisBuild / licenses += (("Apache-2.0", url("https://www.apache.org/licenses/LICENSE-2.0"))) -ThisBuild / versionScheme := Some("early-semver") -ThisBuild / versionPolicyIntention := Compatibility.BinaryCompatible // because it doesn't declare it itself -ThisBuild / versionPolicyDependencySchemes += "org.scala-js" %% "scalajs-library" % "semver-spec" +ThisBuild / libraryDependencySchemes += "org.scala-js" %% "scalajs-library" % "semver-spec" lazy val configSettings: Seq[Setting[_]] = Seq( unmanagedSourceDirectories ++= { @@ -59,7 +57,7 @@ lazy val xml = crossProject(JSPlatform, JVMPlatform, NativePlatform) |""".stripMargin)), // Note: See discussion on non-JVM Mima in https://github.com/scala/scala-xml/pull/517 - scalaModuleMimaPreviousVersion := Some("2.0.0"), + versionPolicyIntention := Compatibility.BinaryAndSourceCompatible, mimaReportSignatureProblems := true, mimaBinaryIssueFilters ++= { import com.typesafe.tools.mima.core._ diff --git a/build.sh b/build.sh index 373cc1eca..ab4af6963 100755 --- a/build.sh +++ b/build.sh @@ -37,6 +37,7 @@ verPat="[0-9]+\.[0-9]+\.[0-9]+(-[A-Za-z0-9-]+)?" tagPat="^v$verPat(#.*)?$" if [[ "$TRAVIS_TAG" =~ $tagPat ]]; then + versionCheckTask="versionCheck" releaseTask="ci-release" if ! isReleaseJob; then echo "Not releasing on Java $ADOPTOPENJDK with Scala $TRAVIS_SCALA_VERSION" @@ -53,4 +54,4 @@ export CI_SNAPSHOT_RELEASE="${projectPrefix}publish" # for now, until we're confident in the new release scripts, just close the staging repo. export CI_SONATYPE_RELEASE="; sonatypePrepare; sonatypeBundleUpload; sonatypeClose" -sbt clean ${projectPrefix}test ${projectPrefix}versionPolicyCheck ${projectPrefix}publishLocal $releaseTask +sbt clean ${projectPrefix}test ${projectPrefix}publishLocal $versionCheckTask $releaseTask From 9f46905eeb4e0e901ac697bdaa9718062f52192a Mon Sep 17 00:00:00 2001 From: Julien Richard-Foy Date: Wed, 4 Aug 2021 10:11:47 +0200 Subject: [PATCH 552/789] Adjust CI process - remove invocation of `versionPolicyCheck` from CI (already invoked by `test`) - add invocation of `versionCheck` before publishing a release --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 51dfb564c..157191e79 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -52,7 +52,7 @@ jobs: - run: java -version - sbt_cmd: scala_version: << parameters.scala_version >> - sbt_tasks: xml/update xml/compile xml/Test/compile xml/test xml/doc xml/package xml/osgiBundle xml/versionPolicyCheck + sbt_tasks: xml/update xml/compile xml/Test/compile xml/test xml/doc xml/package xml/osgiBundle scalajs_job: executor: scala_jdk8_executor parameters: From 5c746cb6a7dd986dbd08c06aa05eb35351f2f650 Mon Sep 17 00:00:00 2001 From: Julien Richard-Foy Date: Wed, 4 Aug 2021 10:13:51 +0200 Subject: [PATCH 553/789] Remove sbt-version-policy --- project/plugins.sbt | 1 - 1 file changed, 1 deletion(-) diff --git a/project/plugins.sbt b/project/plugins.sbt index e591fd3d9..1df3b784d 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -10,4 +10,3 @@ addSbtPlugin("org.portable-scala" % "sbt-scala-native-crossproject" % "1.1.0") addSbtPlugin("org.scala-js" % "sbt-scalajs" % scalaJSVersion) addSbtPlugin("org.scala-native" % "sbt-scala-native" % scalaNativeVersion) addSbtPlugin("de.heikoseeberger" % "sbt-header" % "5.6.0") -addSbtPlugin("ch.epfl.scala" % "sbt-version-policy" % "1.2.1") From 06e8a208e302b8c491c92a5a8158666ce0066ba3 Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Tue, 3 Aug 2021 23:24:08 +0200 Subject: [PATCH 554/789] Update sbt-scalajs, scalajs-compiler, ... to 1.7.0 --- .circleci/config.yml | 4 ++-- .travis.yml | 2 +- project/plugins.sbt | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 51dfb564c..6144e8424 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -141,11 +141,11 @@ workflows: - scalajs_job: name: sjs1.0_2.12 scala_version: 2.12.14 - scalajs_version: 1.6.0 + scalajs_version: 1.7.0 - scalajs_job: name: sjs1.0_2.13 scala_version: 2.13.6 - scalajs_version: 1.6.0 + scalajs_version: 1.7.0 - scalanative_job: name: native0.4_2.12 scala_version: 2.12.14 diff --git a/.travis.yml b/.travis.yml index 9385cc935..ac00ec9b8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,7 +11,7 @@ scala: env: - SCALAJS_VERSION= ADOPTOPENJDK=8 - - SCALAJS_VERSION=1.6.0 ADOPTOPENJDK=8 + - SCALAJS_VERSION=1.7.0 ADOPTOPENJDK=8 - SCALANATIVE_VERSION=0.4.0 ADOPTOPENJDK=8 - SCALAJS_VERSION= ADOPTOPENJDK=11 - SCALAJS_VERSION= ADOPTOPENJDK=17 diff --git a/project/plugins.sbt b/project/plugins.sbt index 9f7ba7a2f..cf1d6ece8 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,5 +1,5 @@ val scalaJSVersion = - Option(System.getenv("SCALAJS_VERSION")).filter(_.nonEmpty).getOrElse("1.6.0") + Option(System.getenv("SCALAJS_VERSION")).filter(_.nonEmpty).getOrElse("1.7.0") val scalaNativeVersion = Option(System.getenv("SCALANATIVE_VERSION")).filter(_.nonEmpty).getOrElse("0.4.0") From cac2aa2c8ef840d9f1a23a02b3f65a447e606581 Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Sun, 29 Aug 2021 20:09:37 -0400 Subject: [PATCH 555/789] Add Scala.js on 3.0.1 to Circle --- .circleci/config.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index 7cc60eb1e..fe952eb9c 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -146,6 +146,10 @@ workflows: name: sjs1.0_2.13 scala_version: 2.13.6 scalajs_version: 1.7.0 + - scalajs_job: + name: sjs1.0_3 + scala_version: 3.0.1 + scalajs_version: 1.7.0 - scalanative_job: name: native0.4_2.12 scala_version: 2.12.14 From 0f2e26bc9afb493776957483245f1b79c80472e8 Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Tue, 31 Aug 2021 16:59:09 -0400 Subject: [PATCH 556/789] Relax versionPolicyIntention to BinaryCompatible --- build.sbt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index 6c1e3e934..7b86182df 100644 --- a/build.sbt +++ b/build.sbt @@ -56,8 +56,9 @@ lazy val xml = crossProject(JSPlatform, JVMPlatform, NativePlatform) |additional information regarding copyright ownership. |""".stripMargin)), + // Note: Change back to BinaryAndSourceCompatible after 2.1.0 release + versionPolicyIntention := Compatibility.BinaryCompatible, // Note: See discussion on non-JVM Mima in https://github.com/scala/scala-xml/pull/517 - versionPolicyIntention := Compatibility.BinaryAndSourceCompatible, mimaReportSignatureProblems := true, mimaBinaryIssueFilters ++= { import com.typesafe.tools.mima.core._ From 2b96e29b8643c35985e8588f25959ad76156864d Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Tue, 31 Aug 2021 17:11:57 -0400 Subject: [PATCH 557/789] Fix Circle 'clang-7' has no installation candidate --- .circleci/config.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 7cc60eb1e..f55722507 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -92,9 +92,7 @@ jobs: name: Install dependencies command: | sudo apt-get update - sudo apt-get install -y clang-7 - sudo ln -s /usr/lib/llvm-7/bin/clang /usr/local/bin/clang - sudo ln -s /usr/lib/llvm-7/bin/clang++ /usr/local/bin/clang++ + sudo apt-get install -y clang - sbt_cmd: scala_version: << parameters.scala_version >> sbt_tasks: xmlNative/update xmlNative/compile xmlNative/test:compile xmlNative/test xmlNative/doc xmlNative/package From f92ae49181989764d591f5b2b6d843ce9d12bfa8 Mon Sep 17 00:00:00 2001 From: Leonid Dubinsky Date: Wed, 18 Aug 2021 13:04:36 -0400 Subject: [PATCH 558/789] Do not ignore XML comments when parsing: fixes #508 - set `org.xml.sax.ext.LexicalHandler` on the `SAXParser` that `XMLLoader` uses; - override `LexicalHandler.comment()` in `FactoryAdapter` so that comments are added to the element content; - add unit tests; - add excludes for the binary compatibility checks. --- build.sbt | 9 +++++++ jvm/src/test/scala/scala/xml/XMLTest.scala | 17 ++++++++++-- .../scala/scala/xml/factory/NodeFactory.scala | 4 +-- .../scala/scala/xml/factory/XMLLoader.scala | 13 ++++++--- .../scala/xml/parsing/FactoryAdapter.scala | 27 +++++++++++++------ .../xml/parsing/NoBindingFactoryAdapter.scala | 13 +++++---- 6 files changed, 63 insertions(+), 20 deletions(-) diff --git a/build.sbt b/build.sbt index 7b86182df..eb8ab9b69 100644 --- a/build.sbt +++ b/build.sbt @@ -68,6 +68,15 @@ lazy val xml = crossProject(JSPlatform, JVMPlatform, NativePlatform) // we compare classes built on JDK 16 (which we only do on CI, not at release time) // to previous-version artifacts that were built on 8. see scala/scala-xml#501 exclude[DirectMissingMethodProblem]("scala.xml.include.sax.XIncluder.declaration"), + + // caused by the switch from DefaultHandler to DefaultHandler2: + exclude[MissingTypesProblem]("scala.xml.parsing.FactoryAdapter"), + exclude[MissingTypesProblem]("scala.xml.parsing.NoBindingFactoryAdapter"), + + exclude[DirectMissingMethodProblem]("scala.xml.parsing.FactoryAdapter.comment"), + exclude[ReversedMissingMethodProblem]("scala.xml.parsing.FactoryAdapter.createComment"), + exclude[DirectMissingMethodProblem]("scala.xml.parsing.FactoryAdapter.createComment"), + exclude[DirectMissingMethodProblem]("scala.xml.parsing.NoBindingFactoryAdapter.createComment") ) }, diff --git a/jvm/src/test/scala/scala/xml/XMLTest.scala b/jvm/src/test/scala/scala/xml/XMLTest.scala index e4321aa62..70b59a925 100644 --- a/jvm/src/test/scala/scala/xml/XMLTest.scala +++ b/jvm/src/test/scala/scala/xml/XMLTest.scala @@ -6,7 +6,6 @@ import org.junit.{Test => UnitTest} import org.junit.Assert.assertTrue import org.junit.Assert.assertFalse import org.junit.Assert.assertEquals -import scala.xml.parsing.ConstructingParser import java.io.StringWriter import java.io.ByteArrayOutputStream import java.io.StringReader @@ -581,6 +580,21 @@ class XMLTestJVM { XML.loadString(broken) } + @UnitTest + def issue508: Unit = { + def check(xml: String): Unit = assertEquals(xml, XML.loadString(xml).toString) + + check(" suffix") + check("prefix suffix") + check("prefix suffix") + + // TODO since XMLLoader retrieves FactoryAdapter.rootNode, + // capturing comments before and after the root element is not currently possible + // (by the way, the same applies to processing instructions). + //check("text") + //check("text") + } + @UnitTest def nodeSeqNs: Unit = { val x = { @@ -746,5 +760,4 @@ class XMLTestJVM { assertEquals("", x.xEntityValue()) } - } diff --git a/shared/src/main/scala/scala/xml/factory/NodeFactory.scala b/shared/src/main/scala/scala/xml/factory/NodeFactory.scala index ad70d8885..7ae0fd7e5 100644 --- a/shared/src/main/scala/scala/xml/factory/NodeFactory.scala +++ b/shared/src/main/scala/scala/xml/factory/NodeFactory.scala @@ -34,7 +34,7 @@ trait NodeFactory[A <: Node] { def eqElements(ch1: Seq[Node], ch2: Seq[Node]): Boolean = ch1.view.zipAll(ch2.view, null, null) forall { case (x, y) => x eq y } - def nodeEquals(n: Node, pre: String, name: String, attrSeq: MetaData, scope: NamespaceBinding, children: Seq[Node]) = + def nodeEquals(n: Node, pre: String, name: String, attrSeq: MetaData, scope: NamespaceBinding, children: Seq[Node]): Boolean = n.prefix == pre && n.label == name && n.attributes == attrSeq && @@ -55,7 +55,7 @@ trait NodeFactory[A <: Node] { } } - def makeText(s: String) = Text(s) + def makeText(s: String): Text = Text(s) def makeComment(s: String): Seq[Comment] = if (ignoreComments) Nil else List(Comment(s)) def makeProcInstr(t: String, s: String): Seq[ProcInstr] = diff --git a/shared/src/main/scala/scala/xml/factory/XMLLoader.scala b/shared/src/main/scala/scala/xml/factory/XMLLoader.scala index 00f43074f..7562c0c1a 100644 --- a/shared/src/main/scala/scala/xml/factory/XMLLoader.scala +++ b/shared/src/main/scala/scala/xml/factory/XMLLoader.scala @@ -14,9 +14,10 @@ package scala package xml package factory +import org.xml.sax.SAXNotRecognizedException import javax.xml.parsers.SAXParserFactory -import parsing.{ FactoryAdapter, NoBindingFactoryAdapter } -import java.io.{ InputStream, Reader, File, FileDescriptor } +import parsing.{FactoryAdapter, NoBindingFactoryAdapter} +import java.io.{File, FileDescriptor, InputStream, Reader} import java.net.URL /** @@ -28,7 +29,7 @@ trait XMLLoader[T <: Node] { def adapter: FactoryAdapter = new NoBindingFactoryAdapter() private lazy val parserInstance = new ThreadLocal[SAXParser] { - override def initialValue = { + override def initialValue: SAXParser = { val parser = SAXParserFactory.newInstance() parser.setFeature("http://javax.xml.XMLConstants/feature/secure-processing", true) parser.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false) @@ -52,6 +53,12 @@ trait XMLLoader[T <: Node] { def loadXML(source: InputSource, parser: SAXParser): T = { val newAdapter = adapter + try { + parser.setProperty("http://xml.org/sax/properties/lexical-handler", newAdapter) + } catch { + case _: SAXNotRecognizedException => + } + newAdapter.scopeStack = TopScope :: newAdapter.scopeStack parser.parse(source, newAdapter) newAdapter.scopeStack = newAdapter.scopeStack.tail diff --git a/shared/src/main/scala/scala/xml/parsing/FactoryAdapter.scala b/shared/src/main/scala/scala/xml/parsing/FactoryAdapter.scala index accc9a68e..c6c8849d2 100644 --- a/shared/src/main/scala/scala/xml/parsing/FactoryAdapter.scala +++ b/shared/src/main/scala/scala/xml/parsing/FactoryAdapter.scala @@ -16,10 +16,10 @@ package parsing import scala.collection.Seq import org.xml.sax.Attributes -import org.xml.sax.helpers.DefaultHandler +import org.xml.sax.ext.DefaultHandler2 // can be mixed into FactoryAdapter if desired -trait ConsoleErrorHandler extends DefaultHandler { +trait ConsoleErrorHandler extends DefaultHandler2 { // ignore warning, crimson warns even for entity resolution! override def warning(ex: SAXParseException): Unit = {} override def error(ex: SAXParseException): Unit = printError("Error", ex) @@ -39,8 +39,8 @@ trait ConsoleErrorHandler extends DefaultHandler { * namespace bindings, without relying on namespace handling of the * underlying SAX parser. */ -abstract class FactoryAdapter extends DefaultHandler with factory.XMLLoader[Node] { - var rootElem: Node = null +abstract class FactoryAdapter extends DefaultHandler2 with factory.XMLLoader[Node] { + var rootElem: Node = _ val buffer = new StringBuilder() /** List of attributes @@ -72,7 +72,7 @@ abstract class FactoryAdapter extends DefaultHandler with factory.XMLLoader[Node */ var scopeStack = List.empty[NamespaceBinding] - var curTag: String = null + var curTag: String = _ var capture: Boolean = false // abstract methods @@ -105,6 +105,11 @@ abstract class FactoryAdapter extends DefaultHandler with factory.XMLLoader[Node */ def createProcInstr(target: String, data: String): Seq[ProcInstr] + /** + * creates a new comment node. + */ + def createComment(characters: String): Seq[Comment] + // // ContentHandler methods // @@ -118,7 +123,7 @@ abstract class FactoryAdapter extends DefaultHandler with factory.XMLLoader[Node * @param length */ override def characters(ch: Array[Char], offset: Int, length: Int): Unit = { - if (!capture) return + if (!capture) () // compliant: report every character else if (!normalizeWhitespace) buffer.appendAll(ch, offset, length) // normalizing whitespace is not compliant, but useful @@ -170,7 +175,7 @@ abstract class FactoryAdapter extends DefaultHandler with factory.XMLLoader[Node if (pre == "xmlns" || (pre == null && qname == "xmlns")) { val arg = if (pre == null) null else key - scpe = new NamespaceBinding(arg, nullIfEmpty(value), scpe) + scpe = NamespaceBinding(arg, nullIfEmpty(value), scpe) } else m = Attribute(Option(pre), key, Text(value), m) } @@ -183,7 +188,7 @@ abstract class FactoryAdapter extends DefaultHandler with factory.XMLLoader[Node * captures text, possibly normalizing whitespace */ def captureText(): Unit = { - if (capture && buffer.length > 0) + if (capture && buffer.nonEmpty) hStack = createText(buffer.toString) :: hStack buffer.clear() @@ -226,4 +231,10 @@ abstract class FactoryAdapter extends DefaultHandler with factory.XMLLoader[Node captureText() hStack = hStack.reverse_:::(createProcInstr(target, data).toList) } + + override def comment(ch: Array[Char], start: Int, length: Int): Unit = { + captureText() + val commentText: String = String.valueOf(ch.slice(start, start + length)) + hStack = hStack.reverse_:::(createComment(commentText).toList) + } } diff --git a/shared/src/main/scala/scala/xml/parsing/NoBindingFactoryAdapter.scala b/shared/src/main/scala/scala/xml/parsing/NoBindingFactoryAdapter.scala index 819d8ca30..6f1384fcc 100644 --- a/shared/src/main/scala/scala/xml/parsing/NoBindingFactoryAdapter.scala +++ b/shared/src/main/scala/scala/xml/parsing/NoBindingFactoryAdapter.scala @@ -23,20 +23,23 @@ import factory.NodeFactory */ class NoBindingFactoryAdapter extends FactoryAdapter with NodeFactory[Elem] { /** True. Every XML node may contain text that the application needs */ - def nodeContainsText(label: String) = true + override def nodeContainsText(label: String) = true /** From NodeFactory. Constructs an instance of scala.xml.Elem -- TODO: deprecate as in Elem */ - protected def create(pre: String, label: String, attrs: MetaData, scope: NamespaceBinding, children: Seq[Node]): Elem = + override protected def create(pre: String, label: String, attrs: MetaData, scope: NamespaceBinding, children: Seq[Node]): Elem = Elem(pre, label, attrs, scope, children.isEmpty, children: _*) /** From FactoryAdapter. Creates a node. never creates the same node twice, using hash-consing. TODO: deprecate as in Elem, or forward to create?? */ - def createNode(pre: String, label: String, attrs: MetaData, scope: NamespaceBinding, children: List[Node]): Elem = + override def createNode(pre: String, label: String, attrs: MetaData, scope: NamespaceBinding, children: List[Node]): Elem = Elem(pre, label, attrs, scope, children.isEmpty, children: _*) /** Creates a text node. */ - def createText(text: String) = Text(text) + override def createText(text: String): Text = makeText(text) /** Creates a processing instruction. */ - def createProcInstr(target: String, data: String) = makeProcInstr(target, data) + override def createProcInstr(target: String, data: String): Seq[ProcInstr] = makeProcInstr(target, data) + + /** Creates a comment. */ + override def createComment(characters: String): Seq[Comment] = makeComment(characters) } From 3bc9bd682fd86032e16b8df376e22f6e9c80f8dc Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Wed, 1 Sep 2021 13:29:22 +0200 Subject: [PATCH 559/789] Update scala3-library, ... to 3.0.2 --- .circleci/config.yml | 8 ++++---- .travis.yml | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index f3168d6c8..744a58858 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -111,7 +111,7 @@ workflows: - scala_job: name: 3.0.1 java_version: jdk8 - scala_version: 3.0.1 + scala_version: 3.0.2 - scala_job: name: jdk11_2.12 java_version: jdk11 @@ -123,7 +123,7 @@ workflows: - scala_job: name: jdk11_3.0 java_version: jdk11 - scala_version: 3.0.1 + scala_version: 3.0.2 - scala_job: name: jdk17_2.12 java_version: jdk17 @@ -135,7 +135,7 @@ workflows: - scala_job: name: jdk17_3.0 java_version: jdk17 - scala_version: 3.0.1 + scala_version: 3.0.2 - scalajs_job: name: sjs1.0_2.12 scala_version: 2.12.14 @@ -146,7 +146,7 @@ workflows: scalajs_version: 1.7.0 - scalajs_job: name: sjs1.0_3 - scala_version: 3.0.1 + scala_version: 3.0.2 scalajs_version: 1.7.0 - scalanative_job: name: native0.4_2.12 diff --git a/.travis.yml b/.travis.yml index ac00ec9b8..f781ceb86 100644 --- a/.travis.yml +++ b/.travis.yml @@ -18,7 +18,7 @@ env: jobs: exclude: - - scala: 3.0.1 + - scala: 3.0.2 env: SCALANATIVE_VERSION=0.4.0 ADOPTOPENJDK=8 install: From 52f5e9ed6531fc1d29fdcaff87c5b79ade39a81f Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Wed, 1 Sep 2021 07:49:11 -0400 Subject: [PATCH 560/789] Fix job name to 3.0.2 in Circle --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 744a58858..4901a30ae 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -109,7 +109,7 @@ workflows: java_version: jdk8 scala_version: 2.13.6 - scala_job: - name: 3.0.1 + name: 3.0.2 java_version: jdk8 scala_version: 3.0.2 - scala_job: From 5f3042410eaab8aaa2de4a2405a91e313b973d7e Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Wed, 1 Sep 2021 07:49:46 -0400 Subject: [PATCH 561/789] Update 3.0.2 in Travis matrix --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index f781ceb86..9f47674ba 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,7 +5,7 @@ import: scala/scala-dev:travis/default.yml language: scala scala: - - 3.0.1 + - 3.0.2 - 2.12.14 - 2.13.6 From 5e8aba5d0820c8aa854b98b65ad966feed57c894 Mon Sep 17 00:00:00 2001 From: Leonid Dubinsky Date: Wed, 1 Sep 2021 14:33:56 -0400 Subject: [PATCH 562/789] Do not ignore XML CDATA sections when parsing: - handle startCDATA/endCDATA lexical events; - keep track of the `inCDATA` state; - capture text into appropriate Node subtype depending on that state; - add createPCData()/makePCData() helpers; - add unit tests. --- build.sbt | 12 +++--- jvm/src/test/scala/scala/xml/XMLTest.scala | 31 ++++++++++++--- .../scala/scala/xml/factory/NodeFactory.scala | 2 + .../scala/xml/parsing/FactoryAdapter.scala | 39 ++++++++++++++++--- .../xml/parsing/NoBindingFactoryAdapter.scala | 3 ++ .../test/scala/scala/xml/CommentTest.scala | 1 - 6 files changed, 70 insertions(+), 18 deletions(-) diff --git a/build.sbt b/build.sbt index eb8ab9b69..9bc3a3099 100644 --- a/build.sbt +++ b/build.sbt @@ -69,14 +69,12 @@ lazy val xml = crossProject(JSPlatform, JVMPlatform, NativePlatform) // to previous-version artifacts that were built on 8. see scala/scala-xml#501 exclude[DirectMissingMethodProblem]("scala.xml.include.sax.XIncluder.declaration"), - // caused by the switch from DefaultHandler to DefaultHandler2: - exclude[MissingTypesProblem]("scala.xml.parsing.FactoryAdapter"), - exclude[MissingTypesProblem]("scala.xml.parsing.NoBindingFactoryAdapter"), + // necessitated by the switch from DefaultHandler to DefaultHandler2 in FactoryAdapter: + exclude[MissingTypesProblem]("scala.xml.parsing.FactoryAdapter"), // see #549 - exclude[DirectMissingMethodProblem]("scala.xml.parsing.FactoryAdapter.comment"), - exclude[ReversedMissingMethodProblem]("scala.xml.parsing.FactoryAdapter.createComment"), - exclude[DirectMissingMethodProblem]("scala.xml.parsing.FactoryAdapter.createComment"), - exclude[DirectMissingMethodProblem]("scala.xml.parsing.NoBindingFactoryAdapter.createComment") + // necessitated by the introduction of new abstract methods in FactoryAdapter: + exclude[ReversedMissingMethodProblem]("scala.xml.parsing.FactoryAdapter.createComment"), // see #549 + exclude[ReversedMissingMethodProblem]("scala.xml.parsing.FactoryAdapter.createPCData") // see #558 ) }, diff --git a/jvm/src/test/scala/scala/xml/XMLTest.scala b/jvm/src/test/scala/scala/xml/XMLTest.scala index 70b59a925..23dae29a9 100644 --- a/jvm/src/test/scala/scala/xml/XMLTest.scala +++ b/jvm/src/test/scala/scala/xml/XMLTest.scala @@ -580,13 +580,23 @@ class XMLTestJVM { XML.loadString(broken) } + def roundtrip(xml: String): Unit = assertEquals(xml, XML.loadString(xml).toString) + @UnitTest - def issue508: Unit = { - def check(xml: String): Unit = assertEquals(xml, XML.loadString(xml).toString) + def issue508commentParsing: Unit = { + // confirm that comments are processed correctly now + roundtrip(" suffix") + roundtrip("prefix suffix") + roundtrip("prefix suffix") + roundtrip("prefix suffix") + roundtrip("""prefix suffix""".stripMargin) - check(" suffix") - check("prefix suffix") - check("prefix suffix") + // confirm that processing instructions were always processed correctly + roundtrip(" suffix") + roundtrip("prefix suffix") + roundtrip("prefix suffix") // TODO since XMLLoader retrieves FactoryAdapter.rootNode, // capturing comments before and after the root element is not currently possible @@ -595,6 +605,17 @@ class XMLTestJVM { //check("text") } + @UnitTest + def cdataParsing: Unit = { + roundtrip(" suffix") + roundtrip("prefix suffix") + roundtrip("prefix suffix") + roundtrip("""prefix suffix""".stripMargin) + } + @UnitTest def nodeSeqNs: Unit = { val x = { diff --git a/shared/src/main/scala/scala/xml/factory/NodeFactory.scala b/shared/src/main/scala/scala/xml/factory/NodeFactory.scala index 7ae0fd7e5..c6b1704ba 100644 --- a/shared/src/main/scala/scala/xml/factory/NodeFactory.scala +++ b/shared/src/main/scala/scala/xml/factory/NodeFactory.scala @@ -56,6 +56,8 @@ trait NodeFactory[A <: Node] { } def makeText(s: String): Text = Text(s) + def makePCData(s: String): PCData = + PCData(s) def makeComment(s: String): Seq[Comment] = if (ignoreComments) Nil else List(Comment(s)) def makeProcInstr(t: String, s: String): Seq[ProcInstr] = diff --git a/shared/src/main/scala/scala/xml/parsing/FactoryAdapter.scala b/shared/src/main/scala/scala/xml/parsing/FactoryAdapter.scala index c6c8849d2..1ac7e9f04 100644 --- a/shared/src/main/scala/scala/xml/parsing/FactoryAdapter.scala +++ b/shared/src/main/scala/scala/xml/parsing/FactoryAdapter.scala @@ -43,6 +43,8 @@ abstract class FactoryAdapter extends DefaultHandler2 with factory.XMLLoader[Nod var rootElem: Node = _ val buffer = new StringBuilder() + private var inCDATA: Boolean = false + /** List of attributes * * Previously was a mutable [[scala.collection.mutable.Stack Stack]], but is now a mutable reference to an immutable [[scala.collection.immutable.List List]]. @@ -100,6 +102,13 @@ abstract class FactoryAdapter extends DefaultHandler2 with factory.XMLLoader[Nod */ def createText(text: String): Text // abstract + /** + * creates a PCData node. + * @param text + * @return a new PCData node. + */ + def createPCData(text: String): PCData // abstract + /** * creates a new processing instruction node. */ @@ -117,7 +126,7 @@ abstract class FactoryAdapter extends DefaultHandler2 with factory.XMLLoader[Nod val normalizeWhitespace = false /** - * Characters. + * Capture characters, possibly normalizing whitespace. * @param ch * @param offset * @param length @@ -139,7 +148,20 @@ abstract class FactoryAdapter extends DefaultHandler2 with factory.XMLLoader[Nod } } - private def splitName(s: String) = { + /** + * Start of a CDATA section. + */ + override def startCDATA(): Unit = { + captureText() + inCDATA = true + } + + /** + * End of a CDATA section. + */ + override def endCDATA(): Unit = captureText() + + private def splitName(s: String): (String, String) = { val idx = s indexOf ':' if (idx < 0) (null, s) else (s take idx, s drop (idx + 1)) @@ -185,13 +207,17 @@ abstract class FactoryAdapter extends DefaultHandler2 with factory.XMLLoader[Nod } /** - * captures text, possibly normalizing whitespace + * Captures text or cdata. */ def captureText(): Unit = { - if (capture && buffer.nonEmpty) - hStack = createText(buffer.toString) :: hStack + if (capture && buffer.nonEmpty) { + val text: String = buffer.toString + val newNode: Node = if (inCDATA) createPCData(text) else createText(text) + hStack = newNode :: hStack + } buffer.clear() + inCDATA = false } /** @@ -232,6 +258,9 @@ abstract class FactoryAdapter extends DefaultHandler2 with factory.XMLLoader[Nod hStack = hStack.reverse_:::(createProcInstr(target, data).toList) } + /** + * Comment. + */ override def comment(ch: Array[Char], start: Int, length: Int): Unit = { captureText() val commentText: String = String.valueOf(ch.slice(start, start + length)) diff --git a/shared/src/main/scala/scala/xml/parsing/NoBindingFactoryAdapter.scala b/shared/src/main/scala/scala/xml/parsing/NoBindingFactoryAdapter.scala index 6f1384fcc..9e5e0a5c0 100644 --- a/shared/src/main/scala/scala/xml/parsing/NoBindingFactoryAdapter.scala +++ b/shared/src/main/scala/scala/xml/parsing/NoBindingFactoryAdapter.scala @@ -42,4 +42,7 @@ class NoBindingFactoryAdapter extends FactoryAdapter with NodeFactory[Elem] { /** Creates a comment. */ override def createComment(characters: String): Seq[Comment] = makeComment(characters) + + /** Creates a cdata. */ + override def createPCData(characters: String): PCData = makePCData(characters) } diff --git a/shared/src/test/scala/scala/xml/CommentTest.scala b/shared/src/test/scala/scala/xml/CommentTest.scala index 3e7d11470..0e077a969 100644 --- a/shared/src/test/scala/scala/xml/CommentTest.scala +++ b/shared/src/test/scala/scala/xml/CommentTest.scala @@ -1,7 +1,6 @@ package scala.xml import org.junit.Assert.assertEquals -import org.junit.Assert.assertTrue import org.junit.Test final class CommentTest { From fe2b547765258b9e9fb9f696010ad96c012aa4de Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Wed, 1 Sep 2021 17:16:19 -0400 Subject: [PATCH 563/789] Disable Mima signature check on Scala 3.0.2 --- build.sbt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index 7b86182df..65e5677ed 100644 --- a/build.sbt +++ b/build.sbt @@ -59,7 +59,6 @@ lazy val xml = crossProject(JSPlatform, JVMPlatform, NativePlatform) // Note: Change back to BinaryAndSourceCompatible after 2.1.0 release versionPolicyIntention := Compatibility.BinaryCompatible, // Note: See discussion on non-JVM Mima in https://github.com/scala/scala-xml/pull/517 - mimaReportSignatureProblems := true, mimaBinaryIssueFilters ++= { import com.typesafe.tools.mima.core._ import com.typesafe.tools.mima.core.ProblemFilters._ @@ -70,6 +69,11 @@ lazy val xml = crossProject(JSPlatform, JVMPlatform, NativePlatform) exclude[DirectMissingMethodProblem]("scala.xml.include.sax.XIncluder.declaration"), ) }, + // Mima signature checking stopped working after 3.0.2 upgrade, see #557 + mimaReportSignatureProblems := (CrossVersion.partialVersion(scalaVersion.value) match { + case Some((3, _)) => false + case _ => true + }), apiMappings ++= scalaInstance.value.libraryJars.filter { file => file.getName.startsWith("scala-library") && file.getName.endsWith(".jar") From 800817392b3cdad3acbb32e3d8b732fc30dd8ea6 Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Thu, 9 Sep 2021 09:59:34 -0400 Subject: [PATCH 564/789] Add 2.0.1 entry in CHANGELOG --- CHANGELOG.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 47db07d2c..4cb529118 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,21 @@ # Scala XML Changes +## 2.0.1 (2021-07-21) + +Binary compatible with Scala XML 2.0.0. + +Published for Scala 2.12 and 2.13, Scala 3, Scala.js 1.6, and Scala +Native 0.4. + +### Added + +- No new functionality. + +### Fixed + +- Fixed runtime error for `MarkupParser` on Scala 3 by changing the + access modifier of internal class, `WithLookAhead` (#542) + ## 2.0.0 (2021-05-13) Not binary compatible with Scala XML 1.3.0. From a6e211bf7f0a72c861c498d8f008e522fb0cd510 Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Wed, 15 Sep 2021 02:20:27 +0200 Subject: [PATCH 565/789] Update scala-compiler, scala-library to 2.12.15 --- .circleci/config.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 4901a30ae..3f2bdfc06 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -103,7 +103,7 @@ workflows: - scala_job: name: 2.12.14 java_version: jdk8 - scala_version: 2.12.14 + scala_version: 2.12.15 - scala_job: name: 2.13.6 java_version: jdk8 @@ -115,7 +115,7 @@ workflows: - scala_job: name: jdk11_2.12 java_version: jdk11 - scala_version: 2.12.14 + scala_version: 2.12.15 - scala_job: name: jdk11_2.13 java_version: jdk11 @@ -127,7 +127,7 @@ workflows: - scala_job: name: jdk17_2.12 java_version: jdk17 - scala_version: 2.12.14 + scala_version: 2.12.15 - scala_job: name: jdk17_2.13 java_version: jdk17 @@ -138,7 +138,7 @@ workflows: scala_version: 3.0.2 - scalajs_job: name: sjs1.0_2.12 - scala_version: 2.12.14 + scala_version: 2.12.15 scalajs_version: 1.7.0 - scalajs_job: name: sjs1.0_2.13 @@ -150,7 +150,7 @@ workflows: scalajs_version: 1.7.0 - scalanative_job: name: native0.4_2.12 - scala_version: 2.12.14 + scala_version: 2.12.15 scalanative_version: 0.4.0 - scalanative_job: name: native0.4_2.13 From bb2ec1d4ae8d1ac1a1764e862710428e2b4a6e62 Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Tue, 14 Sep 2021 22:50:20 -0400 Subject: [PATCH 566/789] Update Travis to Scala 2.12.15 --- .circleci/config.yml | 10 +++++----- .travis.yml | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 3f2bdfc06..c924784cc 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -17,7 +17,7 @@ commands: parameters: scala_version: type: string - default: 2.12.14 + default: 2.12.15 sbt_tasks: type: string default: update compile test:compile test doc package osgiBundle @@ -41,7 +41,7 @@ jobs: parameters: scala_version: description: "Scala version" - default: 2.12.14 + default: 2.12.15 type: string java_version: description: "Java version" @@ -58,7 +58,7 @@ jobs: parameters: scala_version: description: "Scala version" - default: 2.12.14 + default: 2.12.15 type: string scalajs_version: description: "ScalaJS version" @@ -78,7 +78,7 @@ jobs: parameters: scala_version: description: "Scala version" - default: 2.12.14 + default: 2.12.15 type: string scalanative_version: description: "Scala Native version" @@ -101,7 +101,7 @@ workflows: build: jobs: - scala_job: - name: 2.12.14 + name: 2.12.15 java_version: jdk8 scala_version: 2.12.15 - scala_job: diff --git a/.travis.yml b/.travis.yml index 9f47674ba..670b12f96 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,7 +6,7 @@ language: scala scala: - 3.0.2 - - 2.12.14 + - 2.12.15 - 2.13.6 env: From b289ffcc9538da746c5a83baa11fb9a1c3b0ebc9 Mon Sep 17 00:00:00 2001 From: Seth Tisue Date: Wed, 29 Sep 2021 15:35:28 -0600 Subject: [PATCH 567/789] in with GitHub Actions, out with Travis-CI --- .github/workflows/ci.yml | 25 ++++++++ .github/workflows/release.yml | 21 +++++++ .travis.yml | 27 --------- README.md | 1 - build.sbt | 5 ++ build.sh | 57 ------------------- project/plugins.sbt | 12 +--- .../scala/xml/ScalaVersionSpecific.scala | 12 ++++ 8 files changed, 66 insertions(+), 94 deletions(-) create mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/release.yml delete mode 100644 .travis.yml delete mode 100755 build.sh diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 000000000..3aa63aa3c --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,25 @@ +name: test +on: + push: + branches: + - main + pull_request: +jobs: + test: + strategy: + fail-fast: false + matrix: + java: [8, 11, 17] + scala: [2.12.15, 2.13.6, 3.0.2] + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 0 + - uses: coursier/cache-action@v6 + - uses: actions/setup-java@v2 + with: + distribution: adopt + java-version: ${{matrix.java}} + - name: Test + run: sbt ++${{matrix.scala}} test headerCheck versionPolicyCheck package diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 000000000..dc3371112 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,21 @@ +name: Release +on: + push: + tags: ["*"] +jobs: + publish: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 0 + - uses: actions/setup-java@v2 + with: + distribution: adopt + java-version: 8 + - run: sbt versionCheck ci-release + env: + PGP_PASSPHRASE: ${{secrets.PGP_PASSPHRASE}} + PGP_SECRET: ${{secrets.PGP_SECRET}} + SONATYPE_PASSWORD: ${{secrets.SONATYPE_PASSWORD}} + SONATYPE_USERNAME: ${{secrets.SONATYPE_USERNAME}} diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 670b12f96..000000000 --- a/.travis.yml +++ /dev/null @@ -1,27 +0,0 @@ -version: ~> 1.0 # needed for imports - -import: scala/scala-dev:travis/default.yml - -language: scala - -scala: - - 3.0.2 - - 2.12.15 - - 2.13.6 - -env: - - SCALAJS_VERSION= ADOPTOPENJDK=8 - - SCALAJS_VERSION=1.7.0 ADOPTOPENJDK=8 - - SCALANATIVE_VERSION=0.4.0 ADOPTOPENJDK=8 - - SCALAJS_VERSION= ADOPTOPENJDK=11 - - SCALAJS_VERSION= ADOPTOPENJDK=17 - -jobs: - exclude: - - scala: 3.0.2 - env: SCALANATIVE_VERSION=0.4.0 ADOPTOPENJDK=8 - -install: - - git fetch --tags # get all tags for sbt-dynver - -script: ./build.sh diff --git a/README.md b/README.md index 4502ef918..535484a24 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,4 @@ scala-xml -[![Travis](https://img.shields.io/travis/scala/scala-xml.svg)](https://travis-ci.org/scala/scala-xml) [![latest release for 2.12](https://img.shields.io/maven-central/v/org.scala-lang.modules/scala-xml_2.12.svg?label=scala+2.12)](http://mvnrepository.com/artifact/org.scala-lang.modules/scala-xml_2.12) [![latest release for 2.13](https://img.shields.io/maven-central/v/org.scala-lang.modules/scala-xml_2.13.svg?label=scala+2.13)](http://mvnrepository.com/artifact/org.scala-lang.modules/scala-xml_2.13) [![latest release for 3.0](https://img.shields.io/maven-central/v/org.scala-lang.modules/scala-xml_3.svg?label=scala+3)](http://mvnrepository.com/artifact/org.scala-lang.modules/scala-xml_3) diff --git a/build.sbt b/build.sbt index 674a474cd..fc3906c03 100644 --- a/build.sbt +++ b/build.sbt @@ -1,5 +1,7 @@ import sbtcrossproject.CrossPlugin.autoImport.{crossProject, CrossType} +publish / skip := true // root project + ThisBuild / startYear := Some(2002) ThisBuild / licenses += (("Apache-2.0", url("https://www.apache.org/licenses/LICENSE-2.0"))) @@ -33,6 +35,8 @@ lazy val xml = crossProject(JSPlatform, JVMPlatform, NativePlatform) .settings( name := "scala-xml", scalaModuleAutomaticModuleName := Some("scala.xml"), + crossScalaVersions := Seq("2.13.6", "2.12.15", "3.0.2"), + scalacOptions ++= (CrossVersion.partialVersion(scalaVersion.value) match { case Some((3, _)) => Seq("-language:Scala2") @@ -129,6 +133,7 @@ lazy val xml = crossProject(JSPlatform, JVMPlatform, NativePlatform) ) .jsEnablePlugins(ScalaJSJUnitPlugin) .nativeSettings( + crossScalaVersions := Seq("2.13.6", "2.12.15"), // Scala Native cannot run forked tests Test / fork := false, libraryDependencies += "org.scala-native" %%% "junit-runtime" % nativeVersion % Test, diff --git a/build.sh b/build.sh deleted file mode 100755 index ab4af6963..000000000 --- a/build.sh +++ /dev/null @@ -1,57 +0,0 @@ -#!/bin/bash - -set -e - -# Builds of tagged revisions are published to sonatype staging. - -# Travis runs a build on new revisions and on new tags, so a tagged revision is built twice. -# Builds for a tag have TRAVIS_TAG defined, which we use for identifying tagged builds. - -# sbt-dynver sets the version number from the tag -# sbt-travisci sets the Scala version from the travis job matrix - -# To back-publish an existing release for a new Scala / Scala.js / Scala Native version: -# - check out the tag for the version that needs to be published -# - change `.travis.yml` to adjust the version numbers and trim down the build matrix as necessary -# - commit the changes and tag this new revision with an arbitrary suffix after a hash, e.g., -# `v1.2.3#dotty-0.27` (the suffix is ignored, the version will be `1.2.3`) - -# We release on JDK 8 (for Scala 2.x and Dotty 0.x) -isReleaseJob() { - if [[ "$ADOPTOPENJDK" == "8" ]]; then - true - else - false - fi -} - -if [[ "$SCALAJS_VERSION" == "" ]] && [[ "$SCALANATIVE_VERSION" == "" ]]; then - projectPrefix="xml/" -elif [[ "$SCALAJS_VERSION" == "" ]]; then - projectPrefix="xmlNative/" -else - projectPrefix="xmlJS/" -fi - -verPat="[0-9]+\.[0-9]+\.[0-9]+(-[A-Za-z0-9-]+)?" -tagPat="^v$verPat(#.*)?$" - -if [[ "$TRAVIS_TAG" =~ $tagPat ]]; then - versionCheckTask="versionCheck" - releaseTask="ci-release" - if ! isReleaseJob; then - echo "Not releasing on Java $ADOPTOPENJDK with Scala $TRAVIS_SCALA_VERSION" - exit 0 - fi -fi - -# default is +publishSigned; we cross-build with travis jobs, not sbt's crossScalaVersions -export CI_RELEASE="${projectPrefix}publishSigned" -export CI_SNAPSHOT_RELEASE="${projectPrefix}publish" - -# default is sonatypeBundleRelease, which closes and releases the staging repo -# see https://github.com/xerial/sbt-sonatype#commands -# for now, until we're confident in the new release scripts, just close the staging repo. -export CI_SONATYPE_RELEASE="; sonatypePrepare; sonatypeBundleUpload; sonatypeClose" - -sbt clean ${projectPrefix}test ${projectPrefix}publishLocal $versionCheckTask $releaseTask diff --git a/project/plugins.sbt b/project/plugins.sbt index e82b291f2..32c1365e3 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,12 +1,6 @@ -val scalaJSVersion = - Option(System.getenv("SCALAJS_VERSION")).filter(_.nonEmpty).getOrElse("1.7.0") - -val scalaNativeVersion = - Option(System.getenv("SCALANATIVE_VERSION")).filter(_.nonEmpty).getOrElse("0.4.0") - -addSbtPlugin("org.scala-lang.modules" % "sbt-scala-module" % "2.4.0") +addSbtPlugin("org.scala-lang.modules" % "sbt-scala-module" % "3.0.0") addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.1.0") addSbtPlugin("org.portable-scala" % "sbt-scala-native-crossproject" % "1.1.0") -addSbtPlugin("org.scala-js" % "sbt-scalajs" % scalaJSVersion) -addSbtPlugin("org.scala-native" % "sbt-scala-native" % scalaNativeVersion) +addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.7.0") +addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.4.0") addSbtPlugin("de.heikoseeberger" % "sbt-header" % "5.6.0") diff --git a/shared/src/main/scala-2.13-/scala/xml/ScalaVersionSpecific.scala b/shared/src/main/scala-2.13-/scala/xml/ScalaVersionSpecific.scala index 417a3bcc6..af7daf769 100644 --- a/shared/src/main/scala-2.13-/scala/xml/ScalaVersionSpecific.scala +++ b/shared/src/main/scala-2.13-/scala/xml/ScalaVersionSpecific.scala @@ -1,3 +1,15 @@ +/* + * Scala (https://www.scala-lang.org) + * + * Copyright EPFL and Lightbend, Inc. + * + * Licensed under Apache License 2.0 + * (http://www.apache.org/licenses/LICENSE-2.0). + * + * See the NOTICE file distributed with this work for + * additional information regarding copyright ownership. + */ + package scala.xml import scala.collection.SeqLike From 156f2eae94e290192bc75b412a05952bea9d0895 Mon Sep 17 00:00:00 2001 From: Leonid Dubinsky Date: Fri, 10 Sep 2021 14:50:32 -0400 Subject: [PATCH 568/789] XML allows for comments and processing instructions to be present before the start and after the end of the root element. Currently, `FactoryAdapter` does not capture those nodes, and `XMLLoader.loadXML` does not provide access to anything other than the root element anyway. This pull request addresses the issue. Note: at least with the JDK's Xerces, whitespace in the prolog and epilogue gets lost in parsing: the parser does not fire any white-space related events. --- jvm/src/test/scala/scala/xml/XMLTest.scala | 31 +++++++++++----- .../scala/scala/xml/factory/XMLLoader.scala | 35 +++++++++++++++---- .../scala/xml/parsing/FactoryAdapter.scala | 31 +++++++++++----- .../scala/xml/parsing/MarkupParser.scala | 2 ++ 4 files changed, 75 insertions(+), 24 deletions(-) diff --git a/jvm/src/test/scala/scala/xml/XMLTest.scala b/jvm/src/test/scala/scala/xml/XMLTest.scala index 23dae29a9..e7f3624f9 100644 --- a/jvm/src/test/scala/scala/xml/XMLTest.scala +++ b/jvm/src/test/scala/scala/xml/XMLTest.scala @@ -586,7 +586,7 @@ class XMLTestJVM { def issue508commentParsing: Unit = { // confirm that comments are processed correctly now roundtrip(" suffix") - roundtrip("prefix suffix") + roundtrip("prefix suffix") roundtrip("prefix suffix") roundtrip("prefix suffix") roundtrip("""prefix text") - //check("text") + roundtrip("prefix suffix") } @UnitTest @@ -613,7 +607,26 @@ class XMLTestJVM { roundtrip("""prefix suffix""".stripMargin) + | section]]> suffix""".stripMargin) + } + + def roundtripNodes(xml: String): Unit = assertEquals(xml, XML.loadStringNodes(xml).map(_.toString).mkString("")) + + @UnitTest + def xmlLoaderLoadNodes: Unit = { + roundtripNodes("text") + roundtripNodes("text") + roundtripNodes("""text""".stripMargin) + + roundtripNodes("text") + roundtripNodes("text") + + // Note: at least with the JDK's Xerces, whitespace in the prolog and epilogue gets lost in parsing: + // the parser does not fire any white-space related events, so: + // does not work: roundtripNodes(" ") + // does not work: roundtripNodes(" ") } @UnitTest diff --git a/shared/src/main/scala/scala/xml/factory/XMLLoader.scala b/shared/src/main/scala/scala/xml/factory/XMLLoader.scala index 7562c0c1a..620e1b6e0 100644 --- a/shared/src/main/scala/scala/xml/factory/XMLLoader.scala +++ b/shared/src/main/scala/scala/xml/factory/XMLLoader.scala @@ -51,19 +51,29 @@ trait XMLLoader[T <: Node] { * The methods available in scala.xml.XML use the XML parser in the JDK. */ def loadXML(source: InputSource, parser: SAXParser): T = { - val newAdapter = adapter + val result: FactoryAdapter = parse(source, parser) + result.rootElem.asInstanceOf[T] + } + + def loadXMLNodes(source: InputSource, parser: SAXParser): Seq[Node] = { + val result: FactoryAdapter = parse(source, parser) + result.prolog ++ (result.rootElem :: result.epilogue) + } + + private def parse(source: InputSource, parser: SAXParser): FactoryAdapter = { + val result: FactoryAdapter = adapter try { - parser.setProperty("http://xml.org/sax/properties/lexical-handler", newAdapter) + parser.setProperty("http://xml.org/sax/properties/lexical-handler", result) } catch { case _: SAXNotRecognizedException => } - newAdapter.scopeStack = TopScope :: newAdapter.scopeStack - parser.parse(source, newAdapter) - newAdapter.scopeStack = newAdapter.scopeStack.tail + result.scopeStack = TopScope :: result.scopeStack + parser.parse(source, result) + result.scopeStack = result.scopeStack.tail - newAdapter.rootElem.asInstanceOf[T] + result } /** Loads XML from the given file, file descriptor, or filename. */ @@ -80,4 +90,15 @@ trait XMLLoader[T <: Node] { /** Loads XML from the given String. */ def loadString(string: String): T = loadXML(fromString(string), parser) -} \ No newline at end of file + + /** Load XML nodes, including comments and processing instructions that precede and follow the root element. */ + def loadFileNodes(file: File): Seq[Node] = loadXMLNodes(fromFile(file), parser) + def loadFileNodes(fd: FileDescriptor): Seq[Node] = loadXMLNodes(fromFile(fd), parser) + def loadFileNodes(name: String): Seq[Node] = loadXMLNodes(fromFile(name), parser) + def loadNodes(is: InputStream): Seq[Node] = loadXMLNodes(fromInputStream(is), parser) + def loadNodes(reader: Reader): Seq[Node] = loadXMLNodes(fromReader(reader), parser) + def loadNodes(sysID: String): Seq[Node] = loadXMLNodes(fromSysId(sysID), parser) + def loadNodes(source: InputSource): Seq[Node] = loadXMLNodes(source, parser) + def loadNodes(url: URL): Seq[Node] = loadXMLNodes(fromInputStream(url.openStream()), parser) + def loadStringNodes(string: String): Seq[Node] = loadXMLNodes(fromString(string), parser) +} diff --git a/shared/src/main/scala/scala/xml/parsing/FactoryAdapter.scala b/shared/src/main/scala/scala/xml/parsing/FactoryAdapter.scala index 1ac7e9f04..18d326332 100644 --- a/shared/src/main/scala/scala/xml/parsing/FactoryAdapter.scala +++ b/shared/src/main/scala/scala/xml/parsing/FactoryAdapter.scala @@ -40,9 +40,11 @@ trait ConsoleErrorHandler extends DefaultHandler2 { * underlying SAX parser. */ abstract class FactoryAdapter extends DefaultHandler2 with factory.XMLLoader[Node] { + var prolog: List[Node] = List.empty var rootElem: Node = _ + var epilogue: List[Node] = List.empty - val buffer = new StringBuilder() + val buffer: StringBuilder = new StringBuilder() private var inCDATA: Boolean = false /** List of attributes @@ -51,28 +53,28 @@ abstract class FactoryAdapter extends DefaultHandler2 with factory.XMLLoader[Nod * * @since 2.0.0 */ - var attribStack = List.empty[MetaData] + var attribStack: List[MetaData] = List.empty /** List of elements * * Previously was a mutable [[scala.collection.mutable.Stack Stack]], but is now a mutable reference to an immutable [[scala.collection.immutable.List List]]. * * @since 2.0.0 */ - var hStack = List.empty[Node] // [ element ] contains siblings + var hStack: List[Node] = List.empty // [ element ] contains siblings /** List of element names * * Previously was a mutable [[scala.collection.mutable.Stack Stack]], but is now a mutable reference to an immutable [[scala.collection.immutable.List List]]. * * @since 2.0.0 */ - var tagStack = List.empty[String] + var tagStack: List[String] = List.empty /** List of namespaces * * Previously was a mutable [[scala.collection.mutable.Stack Stack]], but is now a mutable reference to an immutable [[scala.collection.immutable.List List]]. * * @since 2.0.0 */ - var scopeStack = List.empty[NamespaceBinding] + var scopeStack: List[NamespaceBinding] = List.empty var curTag: String = _ var capture: Boolean = false @@ -123,7 +125,7 @@ abstract class FactoryAdapter extends DefaultHandler2 with factory.XMLLoader[Nod // ContentHandler methods // - val normalizeWhitespace = false + val normalizeWhitespace: Boolean = false /** * Capture characters, possibly normalizing whitespace. @@ -177,13 +179,20 @@ abstract class FactoryAdapter extends DefaultHandler2 with factory.XMLLoader[Nod attributes: Attributes): Unit = { captureText() + + // capture the prolog at the start of the root element + if (tagStack.isEmpty) { + prolog = hStack.reverse + hStack = List.empty + } + tagStack = curTag :: tagStack curTag = qname val localName = splitName(qname)._2 capture = nodeContainsText(localName) - hStack = null :: hStack + hStack = null :: hStack var m: MetaData = Null var scpe: NamespaceBinding = if (scopeStack.isEmpty) TopScope @@ -193,7 +202,7 @@ abstract class FactoryAdapter extends DefaultHandler2 with factory.XMLLoader[Nod val qname = attributes getQName i val value = attributes getValue i val (pre, key) = splitName(qname) - def nullIfEmpty(s: String) = if (s == "") null else s + def nullIfEmpty(s: String): String = if (s == "") null else s if (pre == "xmlns" || (pre == null && qname == "xmlns")) { val arg = if (pre == null) null else key @@ -250,6 +259,12 @@ abstract class FactoryAdapter extends DefaultHandler2 with factory.XMLLoader[Nod capture = curTag != null && nodeContainsText(curTag) // root level } + override def endDocument(): Unit = { + // capture the epilogue at the end of the document + epilogue = hStack.init.reverse + hStack = hStack.last :: Nil + } + /** * Processing instruction. */ diff --git a/shared/src/main/scala/scala/xml/parsing/MarkupParser.scala b/shared/src/main/scala/scala/xml/parsing/MarkupParser.scala index acd19485e..60b7b5a4b 100755 --- a/shared/src/main/scala/scala/xml/parsing/MarkupParser.scala +++ b/shared/src/main/scala/scala/xml/parsing/MarkupParser.scala @@ -98,6 +98,8 @@ trait MarkupParser extends MarkupParserCommon with TokenTests { var extIndex = -1 /** holds temporary values of pos */ + // Note: this is clearly an override, but if marked as such it causes a "...cannot override a mutable variable" + // error with Scala 3; does it work with Scala 3 if not explicitly marked as an override remains to be seen... var tmppos: Int = _ /** holds the next character */ From 9243de64344e2a60b6468eb8e82041b242d06cbd Mon Sep 17 00:00:00 2001 From: Seth Tisue Date: Mon, 4 Oct 2021 16:14:17 -0600 Subject: [PATCH 569/789] AdoptOpenJDK is now Temurin --- .github/workflows/ci.yml | 2 +- .github/workflows/release.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3aa63aa3c..a06efc269 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -19,7 +19,7 @@ jobs: - uses: coursier/cache-action@v6 - uses: actions/setup-java@v2 with: - distribution: adopt + distribution: temurin java-version: ${{matrix.java}} - name: Test run: sbt ++${{matrix.scala}} test headerCheck versionPolicyCheck package diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index dc3371112..d69ab7208 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -11,7 +11,7 @@ jobs: fetch-depth: 0 - uses: actions/setup-java@v2 with: - distribution: adopt + distribution: temurin java-version: 8 - run: sbt versionCheck ci-release env: From 95b72279d1d6732ecc4e5481eaa68b5853417975 Mon Sep 17 00:00:00 2001 From: Scala Steward <43047562+scala-steward@users.noreply.github.com> Date: Sun, 10 Oct 2021 01:15:41 +0200 Subject: [PATCH 570/789] Update sbt-scalajs, scalajs-compiler, ... to 1.7.1 (#566) Co-authored-by: kenji yoshida <6b656e6a69@gmail.com> --- .circleci/config.yml | 6 +++--- project/plugins.sbt | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index c924784cc..213a70174 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -139,15 +139,15 @@ workflows: - scalajs_job: name: sjs1.0_2.12 scala_version: 2.12.15 - scalajs_version: 1.7.0 + scalajs_version: 1.7.1 - scalajs_job: name: sjs1.0_2.13 scala_version: 2.13.6 - scalajs_version: 1.7.0 + scalajs_version: 1.7.1 - scalajs_job: name: sjs1.0_3 scala_version: 3.0.2 - scalajs_version: 1.7.0 + scalajs_version: 1.7.1 - scalanative_job: name: native0.4_2.12 scala_version: 2.12.15 diff --git a/project/plugins.sbt b/project/plugins.sbt index 32c1365e3..e9e50e506 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,6 +1,6 @@ addSbtPlugin("org.scala-lang.modules" % "sbt-scala-module" % "3.0.0") addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.1.0") addSbtPlugin("org.portable-scala" % "sbt-scala-native-crossproject" % "1.1.0") -addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.7.0") +addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.7.1") addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.4.0") addSbtPlugin("de.heikoseeberger" % "sbt-header" % "5.6.0") From 4304f69325f9e93681b3927d01cd59ab1493821f Mon Sep 17 00:00:00 2001 From: kenji yoshida <6b656e6a69@gmail.com> Date: Fri, 22 Oct 2021 12:24:56 +0900 Subject: [PATCH 571/789] remove unused settings in CircleCI config --- .circleci/config.yml | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 213a70174..b6a7658be 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -60,12 +60,6 @@ jobs: description: "Scala version" default: 2.12.15 type: string - scalajs_version: - description: "ScalaJS version" - default: 1.1.1 - type: string - environment: - SCALAJS_VERSION: << parameters.scalajs_version >> steps: - checkout - run: java -version @@ -80,12 +74,6 @@ jobs: description: "Scala version" default: 2.12.15 type: string - scalanative_version: - description: "Scala Native version" - default: 0.4.0 - type: string - environment: - SCALANATIVE_VERSION: << parameters.scalanative_version >> steps: - checkout - run: @@ -139,20 +127,15 @@ workflows: - scalajs_job: name: sjs1.0_2.12 scala_version: 2.12.15 - scalajs_version: 1.7.1 - scalajs_job: name: sjs1.0_2.13 scala_version: 2.13.6 - scalajs_version: 1.7.1 - scalajs_job: name: sjs1.0_3 scala_version: 3.0.2 - scalajs_version: 1.7.1 - scalanative_job: name: native0.4_2.12 scala_version: 2.12.15 - scalanative_version: 0.4.0 - scalanative_job: name: native0.4_2.13 scala_version: 2.13.6 - scalanative_version: 0.4.0 From a89e8b2029d3dea0c81536c851f6371d2ed49773 Mon Sep 17 00:00:00 2001 From: Scala Steward <43047562+scala-steward@users.noreply.github.com> Date: Fri, 22 Oct 2021 15:45:55 +0200 Subject: [PATCH 572/789] Update auxlib, javalib, junit-runtime, ... to 0.4.1 (#569) Co-authored-by: kenji yoshida <6b656e6a69@gmail.com> --- build.sbt | 1 + project/plugins.sbt | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index fc3906c03..20855a5be 100644 --- a/build.sbt +++ b/build.sbt @@ -36,6 +36,7 @@ lazy val xml = crossProject(JSPlatform, JVMPlatform, NativePlatform) name := "scala-xml", scalaModuleAutomaticModuleName := Some("scala.xml"), crossScalaVersions := Seq("2.13.6", "2.12.15", "3.0.2"), + scalaVersion := "2.12.15", scalacOptions ++= (CrossVersion.partialVersion(scalaVersion.value) match { case Some((3, _)) => diff --git a/project/plugins.sbt b/project/plugins.sbt index e9e50e506..a366dbc8f 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -2,5 +2,5 @@ addSbtPlugin("org.scala-lang.modules" % "sbt-scala-module" % "3.0.0") addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.1.0") addSbtPlugin("org.portable-scala" % "sbt-scala-native-crossproject" % "1.1.0") addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.7.1") -addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.4.0") +addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.4.1") addSbtPlugin("de.heikoseeberger" % "sbt-header" % "5.6.0") From 806d3e7f1958c92a86d337a25e473175b19dcb42 Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Tue, 26 Oct 2021 07:00:48 +0200 Subject: [PATCH 573/789] Update junit-interface to 0.13.2 --- build.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index 20855a5be..a0212a325 100644 --- a/build.sbt +++ b/build.sbt @@ -119,7 +119,7 @@ lazy val xml = crossProject(JSPlatform, JVMPlatform, NativePlatform) OsgiKeys.exportPackage := Seq(s"scala.xml.*;version=${version.value}"), libraryDependencies += "junit" % "junit" % "4.13.2" % Test, - libraryDependencies += "com.novocode" % "junit-interface" % "0.11" % Test, + libraryDependencies += "com.github.sbt" % "junit-interface" % "0.13.2" % Test, libraryDependencies += "org.apache.commons" % "commons-lang3" % "3.12.0" % Test, libraryDependencies ++= (CrossVersion.partialVersion(scalaVersion.value) match { case Some((3, _)) => From fed7f6a309fea76d7cbefe47aac2821534d14589 Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Mon, 18 Oct 2021 15:10:54 +0200 Subject: [PATCH 574/789] Update scala3-library, ... to 3.1.0 --- .circleci/config.yml | 8 ++++---- .github/workflows/ci.yml | 2 +- build.sbt | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index b6a7658be..98d4999aa 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -99,7 +99,7 @@ workflows: - scala_job: name: 3.0.2 java_version: jdk8 - scala_version: 3.0.2 + scala_version: 3.1.0 - scala_job: name: jdk11_2.12 java_version: jdk11 @@ -111,7 +111,7 @@ workflows: - scala_job: name: jdk11_3.0 java_version: jdk11 - scala_version: 3.0.2 + scala_version: 3.1.0 - scala_job: name: jdk17_2.12 java_version: jdk17 @@ -123,7 +123,7 @@ workflows: - scala_job: name: jdk17_3.0 java_version: jdk17 - scala_version: 3.0.2 + scala_version: 3.1.0 - scalajs_job: name: sjs1.0_2.12 scala_version: 2.12.15 @@ -132,7 +132,7 @@ workflows: scala_version: 2.13.6 - scalajs_job: name: sjs1.0_3 - scala_version: 3.0.2 + scala_version: 3.1.0 - scalanative_job: name: native0.4_2.12 scala_version: 2.12.15 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a06efc269..1e53757ee 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,7 +10,7 @@ jobs: fail-fast: false matrix: java: [8, 11, 17] - scala: [2.12.15, 2.13.6, 3.0.2] + scala: [2.12.15, 2.13.6, 3.1.0] runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 diff --git a/build.sbt b/build.sbt index a0212a325..5880d1a08 100644 --- a/build.sbt +++ b/build.sbt @@ -35,7 +35,7 @@ lazy val xml = crossProject(JSPlatform, JVMPlatform, NativePlatform) .settings( name := "scala-xml", scalaModuleAutomaticModuleName := Some("scala.xml"), - crossScalaVersions := Seq("2.13.6", "2.12.15", "3.0.2"), + crossScalaVersions := Seq("2.13.6", "2.12.15", "3.0.2", "3.1.0"), scalaVersion := "2.12.15", scalacOptions ++= (CrossVersion.partialVersion(scalaVersion.value) match { From c8aca30855f934d66aa0ab1dcd7d5ffbf58e89c5 Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Tue, 2 Nov 2021 21:32:23 -0400 Subject: [PATCH 575/789] Add 3.1.0 to build but disable publish --- .circleci/config.yml | 15 +++++++++++++++ .github/workflows/ci.yml | 2 +- build.sbt | 6 ++++++ 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 98d4999aa..b490dc56a 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -99,6 +99,10 @@ workflows: - scala_job: name: 3.0.2 java_version: jdk8 + scala_version: 3.0.2 + - scala_job: + name: 3.1.0 + java_version: jdk8 scala_version: 3.1.0 - scala_job: name: jdk11_2.12 @@ -111,6 +115,10 @@ workflows: - scala_job: name: jdk11_3.0 java_version: jdk11 + scala_version: 3.0.2 + - scala_job: + name: jdk11_3.1 + java_version: jdk11 scala_version: 3.1.0 - scala_job: name: jdk17_2.12 @@ -123,6 +131,10 @@ workflows: - scala_job: name: jdk17_3.0 java_version: jdk17 + scala_version: 3.0.2 + - scala_job: + name: jdk17_3.1 + java_version: jdk17 scala_version: 3.1.0 - scalajs_job: name: sjs1.0_2.12 @@ -132,6 +144,9 @@ workflows: scala_version: 2.13.6 - scalajs_job: name: sjs1.0_3 + scala_version: 3.0.2 + - scalajs_job: + name: sjs1.0_3.1 scala_version: 3.1.0 - scalanative_job: name: native0.4_2.12 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1e53757ee..b12acfcb8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,7 +10,7 @@ jobs: fail-fast: false matrix: java: [8, 11, 17] - scala: [2.12.15, 2.13.6, 3.1.0] + scala: [2.12.15, 2.13.6, 3.0.2, 3.1.0] runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 diff --git a/build.sbt b/build.sbt index 5880d1a08..8c019f4b8 100644 --- a/build.sbt +++ b/build.sbt @@ -38,6 +38,12 @@ lazy val xml = crossProject(JSPlatform, JVMPlatform, NativePlatform) crossScalaVersions := Seq("2.13.6", "2.12.15", "3.0.2", "3.1.0"), scalaVersion := "2.12.15", + // Don't publish for Scala 3.1 or later, only from 3.0 + publish / skip := (CrossVersion.partialVersion(scalaVersion.value) match { + case Some((3, x)) if x > 0 => true + case _ => false + }), + scalacOptions ++= (CrossVersion.partialVersion(scalaVersion.value) match { case Some((3, _)) => Seq("-language:Scala2") From 1bcd9a1ecce959249a2b84caf78b8416ba420ad1 Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Wed, 17 Nov 2021 06:44:58 -0800 Subject: [PATCH 576/789] Update scala-compiler, scala-library to 2.13.7 --- .circleci/config.yml | 12 ++++++------ .github/workflows/ci.yml | 2 +- build.sbt | 4 ++-- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index b490dc56a..692ba727d 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -93,9 +93,9 @@ workflows: java_version: jdk8 scala_version: 2.12.15 - scala_job: - name: 2.13.6 + name: 2.13.7 java_version: jdk8 - scala_version: 2.13.6 + scala_version: 2.13.7 - scala_job: name: 3.0.2 java_version: jdk8 @@ -111,7 +111,7 @@ workflows: - scala_job: name: jdk11_2.13 java_version: jdk11 - scala_version: 2.13.6 + scala_version: 2.13.7 - scala_job: name: jdk11_3.0 java_version: jdk11 @@ -127,7 +127,7 @@ workflows: - scala_job: name: jdk17_2.13 java_version: jdk17 - scala_version: 2.13.6 + scala_version: 2.13.7 - scala_job: name: jdk17_3.0 java_version: jdk17 @@ -141,7 +141,7 @@ workflows: scala_version: 2.12.15 - scalajs_job: name: sjs1.0_2.13 - scala_version: 2.13.6 + scala_version: 2.13.7 - scalajs_job: name: sjs1.0_3 scala_version: 3.0.2 @@ -153,4 +153,4 @@ workflows: scala_version: 2.12.15 - scalanative_job: name: native0.4_2.13 - scala_version: 2.13.6 + scala_version: 2.13.7 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b12acfcb8..c273e5f91 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,7 +10,7 @@ jobs: fail-fast: false matrix: java: [8, 11, 17] - scala: [2.12.15, 2.13.6, 3.0.2, 3.1.0] + scala: [2.12.15, 2.13.7, 3.0.2, 3.1.0] runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 diff --git a/build.sbt b/build.sbt index 8c019f4b8..c89e56653 100644 --- a/build.sbt +++ b/build.sbt @@ -35,7 +35,7 @@ lazy val xml = crossProject(JSPlatform, JVMPlatform, NativePlatform) .settings( name := "scala-xml", scalaModuleAutomaticModuleName := Some("scala.xml"), - crossScalaVersions := Seq("2.13.6", "2.12.15", "3.0.2", "3.1.0"), + crossScalaVersions := Seq("2.13.7", "2.12.15", "3.0.2", "3.1.0"), scalaVersion := "2.12.15", // Don't publish for Scala 3.1 or later, only from 3.0 @@ -140,7 +140,7 @@ lazy val xml = crossProject(JSPlatform, JVMPlatform, NativePlatform) ) .jsEnablePlugins(ScalaJSJUnitPlugin) .nativeSettings( - crossScalaVersions := Seq("2.13.6", "2.12.15"), + crossScalaVersions := Seq("2.13.7", "2.12.15"), // Scala Native cannot run forked tests Test / fork := false, libraryDependencies += "org.scala-native" %%% "junit-runtime" % nativeVersion % Test, From 08a688a284cdd668f882e7049ada428e1108817d Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Wed, 17 Nov 2021 13:13:02 -0500 Subject: [PATCH 577/789] Set the Circle instance size to small --- .circleci/config.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index 692ba727d..8efb8dffb 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -4,12 +4,15 @@ executors: scala_jdk8_executor: docker: - image: circleci/openjdk:8-jdk-node + resource_class: small scala_jdk11_executor: docker: - image: circleci/openjdk:11-jdk + resource_class: small scala_jdk17_executor: docker: - image: circleci/openjdk:17-buster + resource_class: small commands: sbt_cmd: From 1be3ad113a09a49dd68221dc4b7672649ddc89ea Mon Sep 17 00:00:00 2001 From: Scala Steward <43047562+scala-steward@users.noreply.github.com> Date: Wed, 8 Dec 2021 03:28:04 +0100 Subject: [PATCH 578/789] Update scala-native to 0.4.2 --- project/plugins.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/plugins.sbt b/project/plugins.sbt index a366dbc8f..1d78d5c82 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -2,5 +2,5 @@ addSbtPlugin("org.scala-lang.modules" % "sbt-scala-module" % "3.0.0") addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.1.0") addSbtPlugin("org.portable-scala" % "sbt-scala-native-crossproject" % "1.1.0") addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.7.1") -addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.4.1") +addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.4.2") addSbtPlugin("de.heikoseeberger" % "sbt-header" % "5.6.0") From 0c6b20ccd279deb0d68369c8f05753304cd466a5 Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Sat, 11 Dec 2021 04:00:27 +0100 Subject: [PATCH 579/789] Update sbt to 1.5.6 --- project/build.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/build.properties b/project/build.properties index 10fd9eee0..bb3a9b7dc 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version=1.5.5 +sbt.version=1.5.6 From 441678d23c79cf36723ab1fd8c57d3fb7ca0ea06 Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Sat, 11 Dec 2021 04:00:18 +0100 Subject: [PATCH 580/789] Update sbt-scalajs, scalajs-compiler, ... to 1.8.0 --- project/plugins.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/plugins.sbt b/project/plugins.sbt index 1d78d5c82..c99c6bc19 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,6 +1,6 @@ addSbtPlugin("org.scala-lang.modules" % "sbt-scala-module" % "3.0.0") addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.1.0") addSbtPlugin("org.portable-scala" % "sbt-scala-native-crossproject" % "1.1.0") -addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.7.1") +addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.8.0") addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.4.2") addSbtPlugin("de.heikoseeberger" % "sbt-header" % "5.6.0") From d0bc150a087af6d9bb8e85d3aec180318429778f Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Thu, 16 Dec 2021 11:14:22 +0100 Subject: [PATCH 581/789] Update sbt to 1.5.7 --- project/build.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/build.properties b/project/build.properties index bb3a9b7dc..baf5ff3ec 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version=1.5.6 +sbt.version=1.5.7 From 03e78086f19b8f20bd793bedf3d324aca05d7ccd Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Wed, 22 Dec 2021 03:45:50 +0100 Subject: [PATCH 582/789] Update sbt to 1.5.8 --- project/build.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/build.properties b/project/build.properties index baf5ff3ec..e64c208ff 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version=1.5.7 +sbt.version=1.5.8 From e56a3af29e16cad7e61808918af6cab6b7073bcc Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Mon, 27 Dec 2021 08:35:38 +0100 Subject: [PATCH 583/789] Update sbt to 1.6.0 --- project/build.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/build.properties b/project/build.properties index e64c208ff..1e70b0c1c 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version=1.5.8 +sbt.version=1.6.0 From 92f4d42f74a875f9f5f8ba1b347a0fafd2073cb1 Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Thu, 30 Dec 2021 02:19:31 +0100 Subject: [PATCH 584/789] Update sbt to 1.6.1 --- project/build.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/build.properties b/project/build.properties index 1e70b0c1c..3161d2146 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version=1.6.0 +sbt.version=1.6.1 From a2e83c1719566606c0dc0a0160ad8d08f890e92e Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Wed, 5 Jan 2022 13:58:02 -0500 Subject: [PATCH 585/789] Drop .conf file for Scalafmt --- .scalafmt.conf | 1 - 1 file changed, 1 deletion(-) delete mode 100644 .scalafmt.conf diff --git a/.scalafmt.conf b/.scalafmt.conf deleted file mode 100644 index ffbdff9fd..000000000 --- a/.scalafmt.conf +++ /dev/null @@ -1 +0,0 @@ -version = "2.7.4" From b680f3ce095cdf23cb5ddc6fe8a2365a2df1aca0 Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Thu, 30 Dec 2021 02:19:24 +0100 Subject: [PATCH 586/789] Update junit-interface to 0.13.3 Co-authored-by: Aaron S. Hawley --- build.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index c89e56653..8062669fa 100644 --- a/build.sbt +++ b/build.sbt @@ -125,7 +125,7 @@ lazy val xml = crossProject(JSPlatform, JVMPlatform, NativePlatform) OsgiKeys.exportPackage := Seq(s"scala.xml.*;version=${version.value}"), libraryDependencies += "junit" % "junit" % "4.13.2" % Test, - libraryDependencies += "com.github.sbt" % "junit-interface" % "0.13.2" % Test, + libraryDependencies += "com.github.sbt" % "junit-interface" % "0.13.3" % Test, libraryDependencies += "org.apache.commons" % "commons-lang3" % "3.12.0" % Test, libraryDependencies ++= (CrossVersion.partialVersion(scalaVersion.value) match { case Some((3, _)) => From 61f888ce6f3891ff55ca1a15c5a913e46ac2ae07 Mon Sep 17 00:00:00 2001 From: Seth Tisue Date: Wed, 5 Jan 2022 16:08:58 -0800 Subject: [PATCH 587/789] copyright 2022 --- NOTICE | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/NOTICE b/NOTICE index 006f16089..2d345d83a 100644 --- a/NOTICE +++ b/NOTICE @@ -1,6 +1,6 @@ scala-xml -Copyright (c) 2002-2021 EPFL -Copyright (c) 2011-2021 Lightbend, Inc. +Copyright (c) 2002-2022 EPFL +Copyright (c) 2011-2022 Lightbend, Inc. scala-xml includes software developed at LAMP/EPFL (https://lamp.epfl.ch/) and From 363ac3131c24465bd2ea9aceac813c47835b7c1e Mon Sep 17 00:00:00 2001 From: Leonid Dubinsky Date: Fri, 7 Jan 2022 00:02:12 -0500 Subject: [PATCH 588/789] Handle XML namespace declarations even when the underlying parser is namespace-aware. fixes #506 --- jvm/src/test/scala/scala/xml/XMLTest.scala | 29 +++++++++++++++++++ .../scala/xml/parsing/FactoryAdapter.scala | 15 ++++++++++ 2 files changed, 44 insertions(+) diff --git a/jvm/src/test/scala/scala/xml/XMLTest.scala b/jvm/src/test/scala/scala/xml/XMLTest.scala index e7f3624f9..3f6eb62ed 100644 --- a/jvm/src/test/scala/scala/xml/XMLTest.scala +++ b/jvm/src/test/scala/scala/xml/XMLTest.scala @@ -629,6 +629,35 @@ class XMLTestJVM { // does not work: roundtripNodes(" ") } + // using non-namespace-aware parser, this always worked; + // using namespace-aware parser, this works with FactoryAdapter enhanced to handle startPrefixMapping() events; + // see https://github.com/scala/scala-xml/issues/506 + def roundtrip(namespaceAware: Boolean, xml: String): Unit = { + val parserFactory: javax.xml.parsers.SAXParserFactory = javax.xml.parsers.SAXParserFactory.newInstance() + parserFactory.setFeature("http://javax.xml.XMLConstants/feature/secure-processing", true) + parserFactory.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false) + parserFactory.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true) + parserFactory.setFeature("http://xml.org/sax/features/external-parameter-entities", false) + parserFactory.setFeature("http://xml.org/sax/features/external-general-entities", false) + parserFactory.setFeature("http://xml.org/sax/features/resolve-dtd-uris", false) + parserFactory.setNamespaceAware(namespaceAware) + parserFactory.setXIncludeAware(namespaceAware) + + assertEquals(xml, XML.withSAXParser(parserFactory.newSAXParser()).loadString(xml).toString()) + } + + @UnitTest + def namespaceUnaware: Unit = + roundtrip(namespaceAware = false, """""") + + @UnitTest + def namespaceAware: Unit = + roundtrip(namespaceAware = true, """""") + + @UnitTest + def namespaceAware2: Unit = + roundtrip(namespaceAware = true, """""") + @UnitTest def nodeSeqNs: Unit = { val x = { diff --git a/shared/src/main/scala/scala/xml/parsing/FactoryAdapter.scala b/shared/src/main/scala/scala/xml/parsing/FactoryAdapter.scala index 18d326332..eaa43afd0 100644 --- a/shared/src/main/scala/scala/xml/parsing/FactoryAdapter.scala +++ b/shared/src/main/scala/scala/xml/parsing/FactoryAdapter.scala @@ -211,10 +211,25 @@ abstract class FactoryAdapter extends DefaultHandler2 with factory.XMLLoader[Nod m = Attribute(Option(pre), key, Text(value), m) } + // Add namespace bindings for the prefix mappings declared by this element + // (if there are any, the parser is namespace-aware, and no namespace bindings were delivered as attributes). + // All `startPrefixMapping()` events will occur immediately before the corresponding `startElement()` event. + for ((prefix: String, uri: String) <- prefixMappings) + scpe = NamespaceBinding(if (prefix.isEmpty) null else prefix, uri, scpe) + + // Once the `prefixMappings` are processed into `scpe`, the list is emptied out + // so that already-declared namespaces are not re-declared on the nested elements. + prefixMappings = List.empty + scopeStack = scpe :: scopeStack attribStack = m :: attribStack } + private var prefixMappings: List[(String, String)] = List.empty + + override def startPrefixMapping(prefix: String, uri: String): Unit = + prefixMappings = (prefix, uri) :: prefixMappings + /** * Captures text or cdata. */ From 44f7478186ed22c2659362054c1c4d1c31816db6 Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Thu, 6 Jan 2022 09:09:42 +0100 Subject: [PATCH 589/789] Update sbt-scala-module to 3.0.1 --- project/plugins.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/plugins.sbt b/project/plugins.sbt index c99c6bc19..4f781072d 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,4 +1,4 @@ -addSbtPlugin("org.scala-lang.modules" % "sbt-scala-module" % "3.0.0") +addSbtPlugin("org.scala-lang.modules" % "sbt-scala-module" % "3.0.1") addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.1.0") addSbtPlugin("org.portable-scala" % "sbt-scala-native-crossproject" % "1.1.0") addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.8.0") From cb59e9946473d2fb4b55db0b345edd1c4d0f4952 Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Thu, 13 Jan 2022 11:23:10 +0100 Subject: [PATCH 590/789] Update scala-compiler, scala-library to 2.13.8 --- .circleci/config.yml | 12 ++++++------ .github/workflows/ci.yml | 2 +- build.sbt | 4 ++-- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 8efb8dffb..ea99f3441 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -96,9 +96,9 @@ workflows: java_version: jdk8 scala_version: 2.12.15 - scala_job: - name: 2.13.7 + name: 2.13.8 java_version: jdk8 - scala_version: 2.13.7 + scala_version: 2.13.8 - scala_job: name: 3.0.2 java_version: jdk8 @@ -114,7 +114,7 @@ workflows: - scala_job: name: jdk11_2.13 java_version: jdk11 - scala_version: 2.13.7 + scala_version: 2.13.8 - scala_job: name: jdk11_3.0 java_version: jdk11 @@ -130,7 +130,7 @@ workflows: - scala_job: name: jdk17_2.13 java_version: jdk17 - scala_version: 2.13.7 + scala_version: 2.13.8 - scala_job: name: jdk17_3.0 java_version: jdk17 @@ -144,7 +144,7 @@ workflows: scala_version: 2.12.15 - scalajs_job: name: sjs1.0_2.13 - scala_version: 2.13.7 + scala_version: 2.13.8 - scalajs_job: name: sjs1.0_3 scala_version: 3.0.2 @@ -156,4 +156,4 @@ workflows: scala_version: 2.12.15 - scalanative_job: name: native0.4_2.13 - scala_version: 2.13.7 + scala_version: 2.13.8 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c273e5f91..205a47f05 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,7 +10,7 @@ jobs: fail-fast: false matrix: java: [8, 11, 17] - scala: [2.12.15, 2.13.7, 3.0.2, 3.1.0] + scala: [2.12.15, 2.13.8, 3.0.2, 3.1.0] runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 diff --git a/build.sbt b/build.sbt index 8062669fa..e7113a38c 100644 --- a/build.sbt +++ b/build.sbt @@ -35,7 +35,7 @@ lazy val xml = crossProject(JSPlatform, JVMPlatform, NativePlatform) .settings( name := "scala-xml", scalaModuleAutomaticModuleName := Some("scala.xml"), - crossScalaVersions := Seq("2.13.7", "2.12.15", "3.0.2", "3.1.0"), + crossScalaVersions := Seq("2.13.8", "2.12.15", "3.0.2", "3.1.0"), scalaVersion := "2.12.15", // Don't publish for Scala 3.1 or later, only from 3.0 @@ -140,7 +140,7 @@ lazy val xml = crossProject(JSPlatform, JVMPlatform, NativePlatform) ) .jsEnablePlugins(ScalaJSJUnitPlugin) .nativeSettings( - crossScalaVersions := Seq("2.13.7", "2.12.15"), + crossScalaVersions := Seq("2.13.8", "2.12.15"), // Scala Native cannot run forked tests Test / fork := false, libraryDependencies += "org.scala-native" %%% "junit-runtime" % nativeVersion % Test, From 302309d11c22c34e4182ddda8e15962d9f07747d Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Sat, 22 Jan 2022 14:45:40 +0100 Subject: [PATCH 591/789] Update auxlib, javalib, junit-runtime, ... to 0.4.3 --- project/plugins.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/plugins.sbt b/project/plugins.sbt index 4f781072d..0950c6008 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -2,5 +2,5 @@ addSbtPlugin("org.scala-lang.modules" % "sbt-scala-module" % "3.0.1") addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.1.0") addSbtPlugin("org.portable-scala" % "sbt-scala-native-crossproject" % "1.1.0") addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.8.0") -addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.4.2") +addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.4.3") addSbtPlugin("de.heikoseeberger" % "sbt-header" % "5.6.0") From a41c06bc7c6cfd89c26dd5d6de8f55422bf7d595 Mon Sep 17 00:00:00 2001 From: xuwei-k <6b656e6a69@gmail.com> Date: Wed, 5 Jan 2022 15:00:09 +0900 Subject: [PATCH 592/789] support scala-native Scala 3 build --- .circleci/config.yml | 3 ++ build.sbt | 76 +++++++++++++++++++++++++++++++++----------- 2 files changed, 61 insertions(+), 18 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index ea99f3441..27d9cb30f 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -157,3 +157,6 @@ workflows: - scalanative_job: name: native0.4_2.13 scala_version: 2.13.8 + - scalanative_job: + name: native0.4_3 + scala_version: 3.1.0 diff --git a/build.sbt b/build.sbt index e7113a38c..ae66be955 100644 --- a/build.sbt +++ b/build.sbt @@ -140,26 +140,66 @@ lazy val xml = crossProject(JSPlatform, JVMPlatform, NativePlatform) ) .jsEnablePlugins(ScalaJSJUnitPlugin) .nativeSettings( - crossScalaVersions := Seq("2.13.8", "2.12.15"), + crossScalaVersions := Seq("2.13.8", "2.12.15", "3.1.0"), + mimaPreviousArtifacts := { + // TODO remove this setting whien 2.0.2 released + if (scalaBinaryVersion.value == "3") { + mimaPreviousArtifacts.value.filterNot(_.revision == "2.0.1") + } else { + mimaPreviousArtifacts.value + } + }, // Scala Native cannot run forked tests Test / fork := false, - libraryDependencies += "org.scala-native" %%% "junit-runtime" % nativeVersion % Test, - Test / scalacOptions += { - val log = streams.value.log - val retrieveDir = baseDirectory.value / "scala-native-junit-plugin-jars" - val lm = dependencyResolution.value - val cp = lm - .retrieve( - "org.scala-native" % s"junit-plugin_${scalaVersion.value}" % nativeVersion, - scalaModuleInfo = None, - retrieveDir, - log - ) - .fold(w => throw w.resolveException, identity(_)) - val jarPath = cp - .find(_.toString.contains("junit-plugin")) - .getOrElse(throw new Exception("Can't find Scala Native junit-plugin jar")) - s"-Xplugin:$jarPath" + Seq(Compile, Test).map { s => + s / sources := { + CrossVersion.partialVersion(scalaVersion.value) match { + case Some((3, 0)) => + Nil + case _ => + (s / sources).value + } + } + }, + libraryDependencies := { + CrossVersion.partialVersion(scalaVersion.value) match { + case Some((3, 0)) => + // scala-native does not support Scala 3.0.x + Nil + case _ => + libraryDependencies.value ++ Seq("org.scala-native" %%% "junit-runtime" % nativeVersion % Test) + } + }, + Compile / doc / scalacOptions --= { + // TODO remove this workaround + // https://github.com/scala-native/scala-native/issues/2503 + if (scalaBinaryVersion.value == "3") { + (Compile / doc / scalacOptions).value.filter(_.contains("-Xplugin")) + } else { + Nil + } + }, + publish / skip := CrossVersion.partialVersion(scalaVersion.value) == Some((3, 0)), + Test / scalacOptions ++= { + if (CrossVersion.partialVersion(scalaVersion.value) != Some((3, 0))) { + val log = streams.value.log + val retrieveDir = baseDirectory.value / "scala-native-junit-plugin-jars" + val lm = dependencyResolution.value + val cp = lm + .retrieve( + "org.scala-native" % s"junit-plugin_${scalaVersion.value}" % nativeVersion, + scalaModuleInfo = None, + retrieveDir, + log + ) + .fold(w => throw w.resolveException, identity(_)) + val jarPath = cp + .find(_.toString.contains("junit-plugin")) + .getOrElse(throw new Exception("Can't find Scala Native junit-plugin jar")) + Seq(s"-Xplugin:$jarPath") + } else { + Nil + } }, Test / testOptions += Tests.Argument(TestFrameworks.JUnit, "-a", "-s", "-v") ) From 6ca657798b164b2da5d3ab0a3e7e2b927c9a7761 Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Wed, 2 Feb 2022 07:54:41 +0100 Subject: [PATCH 593/789] Update scala3-library, ... to 3.1.1 --- .circleci/config.yml | 8 ++++---- .github/workflows/ci.yml | 2 +- build.sbt | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index ea99f3441..728211ad9 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -106,7 +106,7 @@ workflows: - scala_job: name: 3.1.0 java_version: jdk8 - scala_version: 3.1.0 + scala_version: 3.1.1 - scala_job: name: jdk11_2.12 java_version: jdk11 @@ -122,7 +122,7 @@ workflows: - scala_job: name: jdk11_3.1 java_version: jdk11 - scala_version: 3.1.0 + scala_version: 3.1.1 - scala_job: name: jdk17_2.12 java_version: jdk17 @@ -138,7 +138,7 @@ workflows: - scala_job: name: jdk17_3.1 java_version: jdk17 - scala_version: 3.1.0 + scala_version: 3.1.1 - scalajs_job: name: sjs1.0_2.12 scala_version: 2.12.15 @@ -150,7 +150,7 @@ workflows: scala_version: 3.0.2 - scalajs_job: name: sjs1.0_3.1 - scala_version: 3.1.0 + scala_version: 3.1.1 - scalanative_job: name: native0.4_2.12 scala_version: 2.12.15 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 205a47f05..7ce10f238 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,7 +10,7 @@ jobs: fail-fast: false matrix: java: [8, 11, 17] - scala: [2.12.15, 2.13.8, 3.0.2, 3.1.0] + scala: [2.12.15, 2.13.8, 3.0.2, 3.1.1] runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 diff --git a/build.sbt b/build.sbt index e7113a38c..37bfb95e7 100644 --- a/build.sbt +++ b/build.sbt @@ -35,7 +35,7 @@ lazy val xml = crossProject(JSPlatform, JVMPlatform, NativePlatform) .settings( name := "scala-xml", scalaModuleAutomaticModuleName := Some("scala.xml"), - crossScalaVersions := Seq("2.13.8", "2.12.15", "3.0.2", "3.1.0"), + crossScalaVersions := Seq("2.13.8", "2.12.15", "3.0.2", "3.1.1"), scalaVersion := "2.12.15", // Don't publish for Scala 3.1 or later, only from 3.0 From 719bd3172d6669b65a9895ec01b3a880d64467e8 Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Wed, 2 Feb 2022 07:54:44 +0100 Subject: [PATCH 594/789] Update sbt to 1.6.2 --- project/build.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/build.properties b/project/build.properties index 3161d2146..c8fcab543 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version=1.6.1 +sbt.version=1.6.2 From 3378b026cbffa6416ea7fc43ec5fc254cd145045 Mon Sep 17 00:00:00 2001 From: Lorenzo Gabriele Date: Thu, 3 Feb 2022 14:15:11 +0100 Subject: [PATCH 595/789] Skip tasks with Scala Native / Scala 3.0 - Update Scala Native Scala 3 version to 3.1.1 --- .circleci/config.yml | 2 +- build.sbt | 86 ++++++++++++++++++-------------------------- 2 files changed, 36 insertions(+), 52 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 27d9cb30f..34b80553b 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -159,4 +159,4 @@ workflows: scala_version: 2.13.8 - scalanative_job: name: native0.4_3 - scala_version: 3.1.0 + scala_version: 3.1.1 diff --git a/build.sbt b/build.sbt index ae66be955..74f5d5b5b 100644 --- a/build.sbt +++ b/build.sbt @@ -140,7 +140,7 @@ lazy val xml = crossProject(JSPlatform, JVMPlatform, NativePlatform) ) .jsEnablePlugins(ScalaJSJUnitPlugin) .nativeSettings( - crossScalaVersions := Seq("2.13.8", "2.12.15", "3.1.0"), + crossScalaVersions := Seq("2.13.8", "2.12.15", "3.1.1"), mimaPreviousArtifacts := { // TODO remove this setting whien 2.0.2 released if (scalaBinaryVersion.value == "3") { @@ -151,55 +151,39 @@ lazy val xml = crossProject(JSPlatform, JVMPlatform, NativePlatform) }, // Scala Native cannot run forked tests Test / fork := false, - Seq(Compile, Test).map { s => - s / sources := { - CrossVersion.partialVersion(scalaVersion.value) match { - case Some((3, 0)) => - Nil - case _ => - (s / sources).value - } - } - }, - libraryDependencies := { - CrossVersion.partialVersion(scalaVersion.value) match { - case Some((3, 0)) => - // scala-native does not support Scala 3.0.x - Nil - case _ => - libraryDependencies.value ++ Seq("org.scala-native" %%% "junit-runtime" % nativeVersion % Test) - } - }, - Compile / doc / scalacOptions --= { - // TODO remove this workaround - // https://github.com/scala-native/scala-native/issues/2503 - if (scalaBinaryVersion.value == "3") { - (Compile / doc / scalacOptions).value.filter(_.contains("-Xplugin")) - } else { - Nil - } - }, - publish / skip := CrossVersion.partialVersion(scalaVersion.value) == Some((3, 0)), - Test / scalacOptions ++= { - if (CrossVersion.partialVersion(scalaVersion.value) != Some((3, 0))) { - val log = streams.value.log - val retrieveDir = baseDirectory.value / "scala-native-junit-plugin-jars" - val lm = dependencyResolution.value - val cp = lm - .retrieve( - "org.scala-native" % s"junit-plugin_${scalaVersion.value}" % nativeVersion, - scalaModuleInfo = None, - retrieveDir, - log - ) - .fold(w => throw w.resolveException, identity(_)) - val jarPath = cp - .find(_.toString.contains("junit-plugin")) - .getOrElse(throw new Exception("Can't find Scala Native junit-plugin jar")) - Seq(s"-Xplugin:$jarPath") - } else { - Nil - } + libraryDependencies += "org.scala-native" %%% "junit-runtime" % nativeVersion % Test, + Test / scalacOptions += { + val log = streams.value.log + val retrieveDir = baseDirectory.value / "scala-native-junit-plugin-jars" + val lm = dependencyResolution.value + val cp = lm + .retrieve( + "org.scala-native" % s"junit-plugin_${scalaVersion.value}" % nativeVersion, + scalaModuleInfo = None, + retrieveDir, + log + ) + .fold(w => throw w.resolveException, identity(_)) + val jarPath = cp + .find(_.toString.contains("junit-plugin")) + .getOrElse(throw new Exception("Can't find Scala Native junit-plugin jar")) + s"-Xplugin:$jarPath" }, - Test / testOptions += Tests.Argument(TestFrameworks.JUnit, "-a", "-s", "-v") + Test / testOptions += Tests.Argument(TestFrameworks.JUnit, "-a", "-s", "-v"), + // Scala Native doesn't support Scala 3.0 + Compile / nativeLink := { if(isScala30(scalaVersion.value)) null else (Compile / nativeLink).value }, + Test / nativeLink := { if(isScala30(scalaVersion.value)) null else (Test / nativeLink).value }, + Test / test := { if(isScala30(scalaVersion.value)) {} else (Test / test).value }, + Compile / sources := { if(isScala30(scalaVersion.value)) Nil else (Compile / sources).value }, + Test / sources := { if(isScala30(scalaVersion.value)) Nil else (Test / sources).value }, + libraryDependencies := { if(isScala30(scalaVersion.value)) Nil else libraryDependencies.value }, + Test / scalacOptions := { if(isScala30(scalaVersion.value)) Nil else (Test / scalacOptions).value }, + publish / skip := { isScala30(scalaVersion.value) }, ) + +def isScala30(scalaVersion: String) = { + CrossVersion.partialVersion(scalaVersion) match { + case Some((3, 0)) => true + case _ => false + } +} From 114b22e2e491c534f8bfac9d06d13014a434bbfa Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Mon, 7 Feb 2022 10:53:14 +0100 Subject: [PATCH 596/789] Update sbt-header to 5.6.5 --- project/plugins.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/plugins.sbt b/project/plugins.sbt index 0950c6008..42de67464 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -3,4 +3,4 @@ addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.1.0") addSbtPlugin("org.portable-scala" % "sbt-scala-native-crossproject" % "1.1.0") addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.8.0") addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.4.3") -addSbtPlugin("de.heikoseeberger" % "sbt-header" % "5.6.0") +addSbtPlugin("de.heikoseeberger" % "sbt-header" % "5.6.5") From 29c758cc6c58b6d558632e2cc5e2bc237dfa98a7 Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Tue, 15 Feb 2022 05:34:32 +0100 Subject: [PATCH 597/789] Update sbt-scalajs, scalajs-compiler, ... to 1.9.0 --- project/plugins.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/plugins.sbt b/project/plugins.sbt index 0950c6008..a50e20ae7 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,6 +1,6 @@ addSbtPlugin("org.scala-lang.modules" % "sbt-scala-module" % "3.0.1") addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.1.0") addSbtPlugin("org.portable-scala" % "sbt-scala-native-crossproject" % "1.1.0") -addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.8.0") +addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.9.0") addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.4.3") addSbtPlugin("de.heikoseeberger" % "sbt-header" % "5.6.0") From 21f5a61ea3d7d8e81aa0f2fbc8674cb5f3c0e665 Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Thu, 3 Mar 2022 19:10:58 +0100 Subject: [PATCH 598/789] Update auxlib, javalib, junit-runtime, ... to 0.4.4 --- project/plugins.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/plugins.sbt b/project/plugins.sbt index 2c511a0c5..177cea082 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -2,5 +2,5 @@ addSbtPlugin("org.scala-lang.modules" % "sbt-scala-module" % "3.0.1") addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.1.0") addSbtPlugin("org.portable-scala" % "sbt-scala-native-crossproject" % "1.1.0") addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.9.0") -addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.4.3") +addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.4.4") addSbtPlugin("de.heikoseeberger" % "sbt-header" % "5.6.5") From 5bee75b7f40a7272716858f3d8e5585c4c9a29ee Mon Sep 17 00:00:00 2001 From: Lorenzo Gabriele Date: Mon, 14 Mar 2022 17:31:23 +0100 Subject: [PATCH 599/789] Fix typo in build.sbt Co-authored-by: Eric K Richardson --- build.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index 74f5d5b5b..41a77e839 100644 --- a/build.sbt +++ b/build.sbt @@ -142,7 +142,7 @@ lazy val xml = crossProject(JSPlatform, JVMPlatform, NativePlatform) .nativeSettings( crossScalaVersions := Seq("2.13.8", "2.12.15", "3.1.1"), mimaPreviousArtifacts := { - // TODO remove this setting whien 2.0.2 released + // TODO remove this setting when 2.0.2 released if (scalaBinaryVersion.value == "3") { mimaPreviousArtifacts.value.filterNot(_.revision == "2.0.1") } else { From f553bee67027fbd1a366262cf5b864fe1567aebb Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Tue, 22 Mar 2022 19:22:32 +0100 Subject: [PATCH 600/789] Update sbt-scala-native-crossproject, ... to 1.2.0 --- project/plugins.sbt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/project/plugins.sbt b/project/plugins.sbt index 177cea082..1f04c724c 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,6 +1,6 @@ addSbtPlugin("org.scala-lang.modules" % "sbt-scala-module" % "3.0.1") -addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.1.0") -addSbtPlugin("org.portable-scala" % "sbt-scala-native-crossproject" % "1.1.0") +addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.2.0") +addSbtPlugin("org.portable-scala" % "sbt-scala-native-crossproject" % "1.2.0") addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.9.0") addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.4.4") addSbtPlugin("de.heikoseeberger" % "sbt-header" % "5.6.5") From 86636e524a81a956a174d4324a6fd4e04ad157b4 Mon Sep 17 00:00:00 2001 From: "Kirill A. Korinsky" Date: Sun, 3 Apr 2022 02:56:22 +0200 Subject: [PATCH 601/789] Cleanup hack for 2.0.2 release --- build.sbt | 8 -------- 1 file changed, 8 deletions(-) diff --git a/build.sbt b/build.sbt index e72ac9297..a7a1e85c2 100644 --- a/build.sbt +++ b/build.sbt @@ -141,14 +141,6 @@ lazy val xml = crossProject(JSPlatform, JVMPlatform, NativePlatform) .jsEnablePlugins(ScalaJSJUnitPlugin) .nativeSettings( crossScalaVersions := Seq("2.13.8", "2.12.15", "3.1.1"), - mimaPreviousArtifacts := { - // TODO remove this setting when 2.0.2 released - if (scalaBinaryVersion.value == "3") { - mimaPreviousArtifacts.value.filterNot(_.revision == "2.0.1") - } else { - mimaPreviousArtifacts.value - } - }, // Scala Native cannot run forked tests Test / fork := false, libraryDependencies += "org.scala-native" %%% "junit-runtime" % nativeVersion % Test, From 636708acf2995510b712e252a6223b21d2ad9b93 Mon Sep 17 00:00:00 2001 From: "Kirill A. Korinsky" Date: Mon, 4 Apr 2022 12:19:08 +0200 Subject: [PATCH 602/789] Switch back to BinaryAndSourceCompatible --- build.sbt | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/build.sbt b/build.sbt index a7a1e85c2..6a938d802 100644 --- a/build.sbt +++ b/build.sbt @@ -67,8 +67,7 @@ lazy val xml = crossProject(JSPlatform, JVMPlatform, NativePlatform) |additional information regarding copyright ownership. |""".stripMargin)), - // Note: Change back to BinaryAndSourceCompatible after 2.1.0 release - versionPolicyIntention := Compatibility.BinaryCompatible, + versionPolicyIntention := Compatibility.BinaryAndSourceCompatible, // Note: See discussion on non-JVM Mima in https://github.com/scala/scala-xml/pull/517 mimaBinaryIssueFilters ++= { import com.typesafe.tools.mima.core._ From a0544db9f45ae9f1a4f8ac4475ae01344ae1bf4b Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Thu, 21 Apr 2022 19:38:38 +0200 Subject: [PATCH 603/789] Update sbt-header to 5.7.0 --- project/plugins.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/plugins.sbt b/project/plugins.sbt index 1f04c724c..a46079462 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -3,4 +3,4 @@ addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.2.0") addSbtPlugin("org.portable-scala" % "sbt-scala-native-crossproject" % "1.2.0") addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.9.0") addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.4.4") -addSbtPlugin("de.heikoseeberger" % "sbt-header" % "5.6.5") +addSbtPlugin("de.heikoseeberger" % "sbt-header" % "5.7.0") From 882ad932456932fcc7329aa2a93da3f01f0f9dda Mon Sep 17 00:00:00 2001 From: "Kirill A. Korinsky" Date: Thu, 28 Apr 2022 17:33:56 +0200 Subject: [PATCH 604/789] Disable custom scala versions for scala-native --- build.sbt | 1 - 1 file changed, 1 deletion(-) diff --git a/build.sbt b/build.sbt index 6a938d802..38ff4a4cd 100644 --- a/build.sbt +++ b/build.sbt @@ -139,7 +139,6 @@ lazy val xml = crossProject(JSPlatform, JVMPlatform, NativePlatform) ) .jsEnablePlugins(ScalaJSJUnitPlugin) .nativeSettings( - crossScalaVersions := Seq("2.13.8", "2.12.15", "3.1.1"), // Scala Native cannot run forked tests Test / fork := false, libraryDependencies += "org.scala-native" %%% "junit-runtime" % nativeVersion % Test, From b58dd0467307f017a8f53cd5c31522791706538d Mon Sep 17 00:00:00 2001 From: Seth Tisue Date: Thu, 28 Apr 2022 08:46:34 -0700 Subject: [PATCH 605/789] Update scala3-library, ... to 3.1.2 --- .circleci/config.yml | 18 +++++++++--------- .github/workflows/ci.yml | 2 +- build.sbt | 2 +- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 520b63d16..0f90879e1 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -92,21 +92,21 @@ workflows: build: jobs: - scala_job: - name: 2.12.15 + name: 2.12 java_version: jdk8 scala_version: 2.12.15 - scala_job: - name: 2.13.8 + name: 2.13 java_version: jdk8 scala_version: 2.13.8 - scala_job: - name: 3.0.2 + name: 3.0 java_version: jdk8 scala_version: 3.0.2 - scala_job: - name: 3.1.0 + name: 3.1 java_version: jdk8 - scala_version: 3.1.1 + scala_version: 3.1.2 - scala_job: name: jdk11_2.12 java_version: jdk11 @@ -122,7 +122,7 @@ workflows: - scala_job: name: jdk11_3.1 java_version: jdk11 - scala_version: 3.1.1 + scala_version: 3.1.2 - scala_job: name: jdk17_2.12 java_version: jdk17 @@ -138,7 +138,7 @@ workflows: - scala_job: name: jdk17_3.1 java_version: jdk17 - scala_version: 3.1.1 + scala_version: 3.1.2 - scalajs_job: name: sjs1.0_2.12 scala_version: 2.12.15 @@ -150,7 +150,7 @@ workflows: scala_version: 3.0.2 - scalajs_job: name: sjs1.0_3.1 - scala_version: 3.1.1 + scala_version: 3.1.2 - scalanative_job: name: native0.4_2.12 scala_version: 2.12.15 @@ -159,4 +159,4 @@ workflows: scala_version: 2.13.8 - scalanative_job: name: native0.4_3 - scala_version: 3.1.1 + scala_version: 3.1.2 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7ce10f238..b78666a0e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,7 +10,7 @@ jobs: fail-fast: false matrix: java: [8, 11, 17] - scala: [2.12.15, 2.13.8, 3.0.2, 3.1.1] + scala: [2.12.15, 2.13.8, 3.0.2, 3.1.2] runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 diff --git a/build.sbt b/build.sbt index 38ff4a4cd..493e00d11 100644 --- a/build.sbt +++ b/build.sbt @@ -35,7 +35,7 @@ lazy val xml = crossProject(JSPlatform, JVMPlatform, NativePlatform) .settings( name := "scala-xml", scalaModuleAutomaticModuleName := Some("scala.xml"), - crossScalaVersions := Seq("2.13.8", "2.12.15", "3.0.2", "3.1.1"), + crossScalaVersions := Seq("2.13.8", "2.12.15", "3.0.2", "3.1.2"), scalaVersion := "2.12.15", // Don't publish for Scala 3.1 or later, only from 3.0 From 9a374d3c40633dfc029921ede55ce852ef89a704 Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Tue, 5 Apr 2022 01:15:45 +0200 Subject: [PATCH 606/789] Update sbt-scalajs, scalajs-compiler, ... to 1.10.0 --- project/plugins.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/plugins.sbt b/project/plugins.sbt index a46079462..da96b0c86 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,6 +1,6 @@ addSbtPlugin("org.scala-lang.modules" % "sbt-scala-module" % "3.0.1") addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.2.0") addSbtPlugin("org.portable-scala" % "sbt-scala-native-crossproject" % "1.2.0") -addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.9.0") +addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.10.0") addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.4.4") addSbtPlugin("de.heikoseeberger" % "sbt-header" % "5.7.0") From 9ca8ef09751ca20fa4006b80391783e876f8c465 Mon Sep 17 00:00:00 2001 From: "Kirill A. Korinsky" Date: Thu, 28 Apr 2022 21:48:58 +0200 Subject: [PATCH 607/789] Disable MiMA --- build.sbt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index 493e00d11..94249744e 100644 --- a/build.sbt +++ b/build.sbt @@ -67,7 +67,8 @@ lazy val xml = crossProject(JSPlatform, JVMPlatform, NativePlatform) |additional information regarding copyright ownership. |""".stripMargin)), - versionPolicyIntention := Compatibility.BinaryAndSourceCompatible, + // should be reverted to Compatibility.BinaryAndSourceCompatible after 2.2.0 is released + versionPolicyIntention := Compatibility.None, // Note: See discussion on non-JVM Mima in https://github.com/scala/scala-xml/pull/517 mimaBinaryIssueFilters ++= { import com.typesafe.tools.mima.core._ From 1b662cac7046d25a6d3f182968c45cda404fa797 Mon Sep 17 00:00:00 2001 From: "Kirill A. Korinsky" Date: Fri, 29 Apr 2022 00:02:45 +0200 Subject: [PATCH 608/789] Revert circleCI job names --- .circleci/config.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 0f90879e1..f0f2de05e 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -92,19 +92,19 @@ workflows: build: jobs: - scala_job: - name: 2.12 + name: 2.12.15 java_version: jdk8 scala_version: 2.12.15 - scala_job: - name: 2.13 + name: 2.13.8 java_version: jdk8 scala_version: 2.13.8 - scala_job: - name: 3.0 + name: 3.0.2 java_version: jdk8 scala_version: 3.0.2 - scala_job: - name: 3.1 + name: 3.1.0 java_version: jdk8 scala_version: 3.1.2 - scala_job: From 26298e40476fa7b0faf3bee5ac3c7175479398e3 Mon Sep 17 00:00:00 2001 From: Seth Tisue Date: Mon, 27 Jun 2022 12:10:27 -0700 Subject: [PATCH 609/789] add scalacheck-xml to readme (#608) --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 535484a24..0d1361430 100644 --- a/README.md +++ b/README.md @@ -41,6 +41,7 @@ The XML spec has some features that are best turned off, to avoid unsavory thing - [Json4s XML](https://github.com/json4s/json4s) - Conversion to and from JSON - [monadic-html](https://github.com/OlivierBlanvillain/monadic-html) - DOM-like event-based programming with XHTML - [phobos](https://github.com/TinkoffCreditSystems/phobos) - Data-binding library based on stream parsing using Aalto XML +- [scalacheck-xml](https://github.com/typelevel/scalacheck-xml) - Provides Scalacheck instances for scala-xml - [scalaxb](http://scalaxb.org/) - XML data binding, serialization, SOAP and WSDL support - [ScalaTags](https://github.com/lihaoyi/scalatags) - Alternative syntax for XML literals - [scala-xml-dotty](https://github.com/felixmulder/scala-xml-dotty) - Macro library for XML literals in Dotty @@ -48,4 +49,4 @@ The XML spec has some features that are best turned off, to avoid unsavory thing - [xs4s](https://github.com/ScalaWilliam/xs4s) - XML streaming for Scala - [xtract](https://github.com/lucidsoftware/xtract) - A library for deserializing XML -See also the "XML" section of [Awesome Scala](https://github.com/lauris/awesome-scala). +You might also [search "XML" on Scaladex](https://index.scala-lang.org/search?q=xml). From 09d4a3f43f3382fdf5260f59d4d185d16cc239b6 Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Tue, 28 Jun 2022 23:01:52 +0000 Subject: [PATCH 610/789] Update scala-compiler, scala-library to 2.12.16 --- .circleci/config.yml | 10 +++++----- .github/workflows/ci.yml | 2 +- build.sbt | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index f0f2de05e..8251cd731 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -94,7 +94,7 @@ workflows: - scala_job: name: 2.12.15 java_version: jdk8 - scala_version: 2.12.15 + scala_version: 2.12.16 - scala_job: name: 2.13.8 java_version: jdk8 @@ -110,7 +110,7 @@ workflows: - scala_job: name: jdk11_2.12 java_version: jdk11 - scala_version: 2.12.15 + scala_version: 2.12.16 - scala_job: name: jdk11_2.13 java_version: jdk11 @@ -126,7 +126,7 @@ workflows: - scala_job: name: jdk17_2.12 java_version: jdk17 - scala_version: 2.12.15 + scala_version: 2.12.16 - scala_job: name: jdk17_2.13 java_version: jdk17 @@ -141,7 +141,7 @@ workflows: scala_version: 3.1.2 - scalajs_job: name: sjs1.0_2.12 - scala_version: 2.12.15 + scala_version: 2.12.16 - scalajs_job: name: sjs1.0_2.13 scala_version: 2.13.8 @@ -153,7 +153,7 @@ workflows: scala_version: 3.1.2 - scalanative_job: name: native0.4_2.12 - scala_version: 2.12.15 + scala_version: 2.12.16 - scalanative_job: name: native0.4_2.13 scala_version: 2.13.8 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b78666a0e..25e1c0aaa 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,7 +10,7 @@ jobs: fail-fast: false matrix: java: [8, 11, 17] - scala: [2.12.15, 2.13.8, 3.0.2, 3.1.2] + scala: [2.12.16, 2.13.8, 3.0.2, 3.1.2] runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 diff --git a/build.sbt b/build.sbt index 94249744e..eabb11443 100644 --- a/build.sbt +++ b/build.sbt @@ -35,8 +35,8 @@ lazy val xml = crossProject(JSPlatform, JVMPlatform, NativePlatform) .settings( name := "scala-xml", scalaModuleAutomaticModuleName := Some("scala.xml"), - crossScalaVersions := Seq("2.13.8", "2.12.15", "3.0.2", "3.1.2"), - scalaVersion := "2.12.15", + crossScalaVersions := Seq("2.13.8", "2.12.16", "3.0.2", "3.1.2"), + scalaVersion := "2.12.16", // Don't publish for Scala 3.1 or later, only from 3.0 publish / skip := (CrossVersion.partialVersion(scalaVersion.value) match { From 2874dbd2d2f0720b9c9b13f5a00dffd4f96796ea Mon Sep 17 00:00:00 2001 From: Scala Steward <43047562+scala-steward@users.noreply.github.com> Date: Tue, 12 Jul 2022 15:46:08 +0200 Subject: [PATCH 611/789] Update sbt to 1.7.1 (#613) --- project/build.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/build.properties b/project/build.properties index c8fcab543..22af2628c 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version=1.6.2 +sbt.version=1.7.1 From 15c81a10532ac71e0a77b68f81bcb6ccc695095f Mon Sep 17 00:00:00 2001 From: Scala Steward <43047562+scala-steward@users.noreply.github.com> Date: Tue, 12 Jul 2022 15:46:18 +0200 Subject: [PATCH 612/789] Update sbt-scalajs, scalajs-compiler, ... to 1.10.1 (#609) --- project/plugins.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/plugins.sbt b/project/plugins.sbt index da96b0c86..1a9acf277 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,6 +1,6 @@ addSbtPlugin("org.scala-lang.modules" % "sbt-scala-module" % "3.0.1") addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.2.0") addSbtPlugin("org.portable-scala" % "sbt-scala-native-crossproject" % "1.2.0") -addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.10.0") +addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.10.1") addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.4.4") addSbtPlugin("de.heikoseeberger" % "sbt-header" % "5.7.0") From e06c9f0a05721f368cf93e26e92fce9bb5409a19 Mon Sep 17 00:00:00 2001 From: Scala Steward <43047562+scala-steward@users.noreply.github.com> Date: Tue, 12 Jul 2022 15:46:30 +0200 Subject: [PATCH 613/789] Update scala3-library, ... to 3.1.3 (#611) --- .circleci/config.yml | 10 +++++----- .github/workflows/ci.yml | 2 +- build.sbt | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index f0f2de05e..e80368688 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -106,7 +106,7 @@ workflows: - scala_job: name: 3.1.0 java_version: jdk8 - scala_version: 3.1.2 + scala_version: 3.1.3 - scala_job: name: jdk11_2.12 java_version: jdk11 @@ -122,7 +122,7 @@ workflows: - scala_job: name: jdk11_3.1 java_version: jdk11 - scala_version: 3.1.2 + scala_version: 3.1.3 - scala_job: name: jdk17_2.12 java_version: jdk17 @@ -138,7 +138,7 @@ workflows: - scala_job: name: jdk17_3.1 java_version: jdk17 - scala_version: 3.1.2 + scala_version: 3.1.3 - scalajs_job: name: sjs1.0_2.12 scala_version: 2.12.15 @@ -150,7 +150,7 @@ workflows: scala_version: 3.0.2 - scalajs_job: name: sjs1.0_3.1 - scala_version: 3.1.2 + scala_version: 3.1.3 - scalanative_job: name: native0.4_2.12 scala_version: 2.12.15 @@ -159,4 +159,4 @@ workflows: scala_version: 2.13.8 - scalanative_job: name: native0.4_3 - scala_version: 3.1.2 + scala_version: 3.1.3 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b78666a0e..d81493000 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,7 +10,7 @@ jobs: fail-fast: false matrix: java: [8, 11, 17] - scala: [2.12.15, 2.13.8, 3.0.2, 3.1.2] + scala: [2.12.15, 2.13.8, 3.0.2, 3.1.3] runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 diff --git a/build.sbt b/build.sbt index 94249744e..693e5cfab 100644 --- a/build.sbt +++ b/build.sbt @@ -35,7 +35,7 @@ lazy val xml = crossProject(JSPlatform, JVMPlatform, NativePlatform) .settings( name := "scala-xml", scalaModuleAutomaticModuleName := Some("scala.xml"), - crossScalaVersions := Seq("2.13.8", "2.12.15", "3.0.2", "3.1.2"), + crossScalaVersions := Seq("2.13.8", "2.12.15", "3.0.2", "3.1.3"), scalaVersion := "2.12.15", // Don't publish for Scala 3.1 or later, only from 3.0 From a617e42d8aa8e7d5f3907e6070d86d0cf8f1dc55 Mon Sep 17 00:00:00 2001 From: Seth Tisue Date: Tue, 12 Jul 2022 06:51:21 -0700 Subject: [PATCH 614/789] use new sbt 1.7 feature to simplify Actions config --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d81493000..ed8d51ffa 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,7 +10,7 @@ jobs: fail-fast: false matrix: java: [8, 11, 17] - scala: [2.12.15, 2.13.8, 3.0.2, 3.1.3] + scala: [2.12.x, 2.13.x, 3.0.x, 3.1.x] runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 From dafa2df00afc08048c928c4d37c0745292f55f7e Mon Sep 17 00:00:00 2001 From: Seth Tisue Date: Tue, 12 Jul 2022 06:51:30 -0700 Subject: [PATCH 615/789] Actions config: use setup-java@v3 to improve caching --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ed8d51ffa..b9243bccc 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,10 +16,10 @@ jobs: - uses: actions/checkout@v2 with: fetch-depth: 0 - - uses: coursier/cache-action@v6 - - uses: actions/setup-java@v2 + - uses: actions/setup-java@v3 with: distribution: temurin java-version: ${{matrix.java}} + cache: sbt - name: Test run: sbt ++${{matrix.scala}} test headerCheck versionPolicyCheck package From 84da01b8cc0ffe21dcabacd355aa60608cd45c28 Mon Sep 17 00:00:00 2001 From: Seth Tisue Date: Tue, 12 Jul 2022 06:54:50 -0700 Subject: [PATCH 616/789] drop support for Scala 3.0.x I see this happening ecosystem-wide, we might as well --- .circleci/config.yml | 15 --------------- .github/workflows/ci.yml | 2 +- build.sbt | 2 +- 3 files changed, 2 insertions(+), 17 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index e80368688..282e168b8 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -99,10 +99,6 @@ workflows: name: 2.13.8 java_version: jdk8 scala_version: 2.13.8 - - scala_job: - name: 3.0.2 - java_version: jdk8 - scala_version: 3.0.2 - scala_job: name: 3.1.0 java_version: jdk8 @@ -115,10 +111,6 @@ workflows: name: jdk11_2.13 java_version: jdk11 scala_version: 2.13.8 - - scala_job: - name: jdk11_3.0 - java_version: jdk11 - scala_version: 3.0.2 - scala_job: name: jdk11_3.1 java_version: jdk11 @@ -131,10 +123,6 @@ workflows: name: jdk17_2.13 java_version: jdk17 scala_version: 2.13.8 - - scala_job: - name: jdk17_3.0 - java_version: jdk17 - scala_version: 3.0.2 - scala_job: name: jdk17_3.1 java_version: jdk17 @@ -145,9 +133,6 @@ workflows: - scalajs_job: name: sjs1.0_2.13 scala_version: 2.13.8 - - scalajs_job: - name: sjs1.0_3 - scala_version: 3.0.2 - scalajs_job: name: sjs1.0_3.1 scala_version: 3.1.3 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d81493000..9965fb09e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,7 +10,7 @@ jobs: fail-fast: false matrix: java: [8, 11, 17] - scala: [2.12.15, 2.13.8, 3.0.2, 3.1.3] + scala: [2.12.15, 2.13.8, 3.1.3] runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 diff --git a/build.sbt b/build.sbt index 693e5cfab..132d86d13 100644 --- a/build.sbt +++ b/build.sbt @@ -35,7 +35,7 @@ lazy val xml = crossProject(JSPlatform, JVMPlatform, NativePlatform) .settings( name := "scala-xml", scalaModuleAutomaticModuleName := Some("scala.xml"), - crossScalaVersions := Seq("2.13.8", "2.12.15", "3.0.2", "3.1.3"), + crossScalaVersions := Seq("2.13.8", "2.12.15", "3.1.3"), scalaVersion := "2.12.15", // Don't publish for Scala 3.1 or later, only from 3.0 From 1610cc54a0006f118cc53c8ac2aa10e8ef36bf27 Mon Sep 17 00:00:00 2001 From: Scala Steward <43047562+scala-steward@users.noreply.github.com> Date: Tue, 12 Jul 2022 15:55:51 +0200 Subject: [PATCH 617/789] Update junit-runtime, nscplugin, ... to 0.4.5 (#612) Co-authored-by: Seth Tisue --- project/plugins.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/plugins.sbt b/project/plugins.sbt index 1a9acf277..598c2f05c 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -2,5 +2,5 @@ addSbtPlugin("org.scala-lang.modules" % "sbt-scala-module" % "3.0.1") addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.2.0") addSbtPlugin("org.portable-scala" % "sbt-scala-native-crossproject" % "1.2.0") addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.10.1") -addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.4.4") +addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.4.5") addSbtPlugin("de.heikoseeberger" % "sbt-header" % "5.7.0") From bf5b7bea9f883cfa8fad859fb158dc682cd8dd74 Mon Sep 17 00:00:00 2001 From: Seth Tisue Date: Tue, 12 Jul 2022 06:57:28 -0700 Subject: [PATCH 618/789] also bump to Scala 2.12.16 in CircleCI config --- .circleci/config.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 383bb89fc..74b26678f 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -20,7 +20,7 @@ commands: parameters: scala_version: type: string - default: 2.12.15 + default: 2.12.16 sbt_tasks: type: string default: update compile test:compile test doc package osgiBundle @@ -44,7 +44,7 @@ jobs: parameters: scala_version: description: "Scala version" - default: 2.12.15 + default: 2.12.16 type: string java_version: description: "Java version" @@ -61,7 +61,7 @@ jobs: parameters: scala_version: description: "Scala version" - default: 2.12.15 + default: 2.12.16 type: string steps: - checkout @@ -75,7 +75,7 @@ jobs: parameters: scala_version: description: "Scala version" - default: 2.12.15 + default: 2.12.16 type: string steps: - checkout @@ -92,7 +92,7 @@ workflows: build: jobs: - scala_job: - name: 2.12.15 + name: 2.12.16 java_version: jdk8 scala_version: 2.12.16 - scala_job: From 22b67efcad52b93075a80eb5373386f08daa6b56 Mon Sep 17 00:00:00 2001 From: Seth Tisue Date: Wed, 27 Jul 2022 21:23:43 -0700 Subject: [PATCH 619/789] fix Scala 3 publishing sequel to #615 --- build.sbt | 22 ---------------------- 1 file changed, 22 deletions(-) diff --git a/build.sbt b/build.sbt index d07b350e0..b27906664 100644 --- a/build.sbt +++ b/build.sbt @@ -38,12 +38,6 @@ lazy val xml = crossProject(JSPlatform, JVMPlatform, NativePlatform) crossScalaVersions := Seq("2.13.8", "2.12.16", "3.1.3"), scalaVersion := "2.12.16", - // Don't publish for Scala 3.1 or later, only from 3.0 - publish / skip := (CrossVersion.partialVersion(scalaVersion.value) match { - case Some((3, x)) if x > 0 => true - case _ => false - }), - scalacOptions ++= (CrossVersion.partialVersion(scalaVersion.value) match { case Some((3, _)) => Seq("-language:Scala2") @@ -161,20 +155,4 @@ lazy val xml = crossProject(JSPlatform, JVMPlatform, NativePlatform) s"-Xplugin:$jarPath" }, Test / testOptions += Tests.Argument(TestFrameworks.JUnit, "-a", "-s", "-v"), - // Scala Native doesn't support Scala 3.0 - Compile / nativeLink := { if(isScala30(scalaVersion.value)) null else (Compile / nativeLink).value }, - Test / nativeLink := { if(isScala30(scalaVersion.value)) null else (Test / nativeLink).value }, - Test / test := { if(isScala30(scalaVersion.value)) {} else (Test / test).value }, - Compile / sources := { if(isScala30(scalaVersion.value)) Nil else (Compile / sources).value }, - Test / sources := { if(isScala30(scalaVersion.value)) Nil else (Test / sources).value }, - libraryDependencies := { if(isScala30(scalaVersion.value)) Nil else libraryDependencies.value }, - Test / scalacOptions := { if(isScala30(scalaVersion.value)) Nil else (Test / scalacOptions).value }, - publish / skip := { isScala30(scalaVersion.value) }, ) - -def isScala30(scalaVersion: String) = { - CrossVersion.partialVersion(scalaVersion) match { - case Some((3, 0)) => true - case _ => false - } -} From ef4e47a03cbbd7e5640206fd11507486445b7fca Mon Sep 17 00:00:00 2001 From: Arman Bilge Date: Sun, 18 Sep 2022 06:01:44 -0700 Subject: [PATCH 620/789] Set `apiURL` --- build.sbt | 1 + 1 file changed, 1 insertion(+) diff --git a/build.sbt b/build.sbt index b27906664..42bcf8333 100644 --- a/build.sbt +++ b/build.sbt @@ -7,6 +7,7 @@ ThisBuild / licenses += (("Apache-2.0", url("https://www.apache.org/licenses/LIC // because it doesn't declare it itself ThisBuild / libraryDependencySchemes += "org.scala-js" %% "scalajs-library" % "semver-spec" +ThisBuild / apiURL := Some(url("https://javadoc.io/doc/org.scala-lang.modules/scala-xml_2.13/")) lazy val configSettings: Seq[Setting[_]] = Seq( unmanagedSourceDirectories ++= { From 560cc3128db23aef710b8215aaff36f96feac65b Mon Sep 17 00:00:00 2001 From: Scala Steward <43047562+scala-steward@users.noreply.github.com> Date: Mon, 19 Sep 2022 01:39:28 +0200 Subject: [PATCH 621/789] Update junit-runtime, nscplugin, ... to 0.4.7 (#618) --- project/plugins.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/plugins.sbt b/project/plugins.sbt index 598c2f05c..c2f4bd578 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -2,5 +2,5 @@ addSbtPlugin("org.scala-lang.modules" % "sbt-scala-module" % "3.0.1") addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.2.0") addSbtPlugin("org.portable-scala" % "sbt-scala-native-crossproject" % "1.2.0") addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.10.1") -addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.4.5") +addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.4.7") addSbtPlugin("de.heikoseeberger" % "sbt-header" % "5.7.0") From 350fc8b8baeeb3a0a961065b83613ac77db80215 Mon Sep 17 00:00:00 2001 From: Scala Steward <43047562+scala-steward@users.noreply.github.com> Date: Sun, 16 Oct 2022 14:24:10 +0200 Subject: [PATCH 622/789] Update sbt to 1.7.2 (#624) --- project/build.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/build.properties b/project/build.properties index 22af2628c..563a014da 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version=1.7.1 +sbt.version=1.7.2 From 294683109716f0e1d7c64fd3ff2787d068096a5d Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Sat, 15 Oct 2022 09:38:45 +0000 Subject: [PATCH 623/789] Update scala-compiler, scala-library to 2.13.10 --- .circleci/config.yml | 12 ++++++------ build.sbt | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 1840aa129..b6960b92e 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -96,9 +96,9 @@ workflows: java_version: jdk8 scala_version: 2.12.16 - scala_job: - name: 2.13.8 + name: 2.13.10 java_version: jdk8 - scala_version: 2.13.8 + scala_version: 2.13.10 - scala_job: name: 3.1.0 java_version: jdk8 @@ -110,7 +110,7 @@ workflows: - scala_job: name: jdk11_2.13 java_version: jdk11 - scala_version: 2.13.8 + scala_version: 2.13.10 - scala_job: name: jdk11_3.1 java_version: jdk11 @@ -122,7 +122,7 @@ workflows: - scala_job: name: jdk17_2.13 java_version: jdk17 - scala_version: 2.13.8 + scala_version: 2.13.10 - scala_job: name: jdk17_3.1 java_version: jdk17 @@ -132,7 +132,7 @@ workflows: scala_version: 2.12.16 - scalajs_job: name: sjs1.0_2.13 - scala_version: 2.13.8 + scala_version: 2.13.10 - scalajs_job: name: sjs1.0_3.1 scala_version: 3.1.3 @@ -141,7 +141,7 @@ workflows: scala_version: 2.12.16 - scalanative_job: name: native0.4_2.13 - scala_version: 2.13.8 + scala_version: 2.13.10 - scalanative_job: name: native0.4_3 scala_version: 3.1.3 diff --git a/build.sbt b/build.sbt index b27906664..4b3be0647 100644 --- a/build.sbt +++ b/build.sbt @@ -35,7 +35,7 @@ lazy val xml = crossProject(JSPlatform, JVMPlatform, NativePlatform) .settings( name := "scala-xml", scalaModuleAutomaticModuleName := Some("scala.xml"), - crossScalaVersions := Seq("2.13.8", "2.12.16", "3.1.3"), + crossScalaVersions := Seq("2.13.10", "2.12.16", "3.1.3"), scalaVersion := "2.12.16", scalacOptions ++= (CrossVersion.partialVersion(scalaVersion.value) match { From f068327e5a370b7d551a54358d50eb7fc0a8b47c Mon Sep 17 00:00:00 2001 From: Scala Steward <43047562+scala-steward@users.noreply.github.com> Date: Mon, 17 Oct 2022 09:48:58 +0200 Subject: [PATCH 624/789] Update sbt-scalajs, scalajs-compiler, ... to 1.11.0 (#621) --- project/plugins.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/plugins.sbt b/project/plugins.sbt index c2f4bd578..01ba00883 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,6 +1,6 @@ addSbtPlugin("org.scala-lang.modules" % "sbt-scala-module" % "3.0.1") addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.2.0") addSbtPlugin("org.portable-scala" % "sbt-scala-native-crossproject" % "1.2.0") -addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.10.1") +addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.11.0") addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.4.7") addSbtPlugin("de.heikoseeberger" % "sbt-header" % "5.7.0") From 897d82995172e57625ed32ec536303052dca953a Mon Sep 17 00:00:00 2001 From: Scala Steward <43047562+scala-steward@users.noreply.github.com> Date: Mon, 17 Oct 2022 09:49:11 +0200 Subject: [PATCH 625/789] Update scala-compiler, scala-library to 2.12.17 (#622) --- .circleci/config.yml | 20 ++++++++++---------- build.sbt | 4 ++-- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 1840aa129..b22122179 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -20,7 +20,7 @@ commands: parameters: scala_version: type: string - default: 2.12.16 + default: 2.12.17 sbt_tasks: type: string default: update compile test:compile test doc package osgiBundle @@ -44,7 +44,7 @@ jobs: parameters: scala_version: description: "Scala version" - default: 2.12.16 + default: 2.12.17 type: string java_version: description: "Java version" @@ -61,7 +61,7 @@ jobs: parameters: scala_version: description: "Scala version" - default: 2.12.16 + default: 2.12.17 type: string steps: - checkout @@ -75,7 +75,7 @@ jobs: parameters: scala_version: description: "Scala version" - default: 2.12.16 + default: 2.12.17 type: string steps: - checkout @@ -92,9 +92,9 @@ workflows: build: jobs: - scala_job: - name: 2.12.16 + name: 2.12.17 java_version: jdk8 - scala_version: 2.12.16 + scala_version: 2.12.17 - scala_job: name: 2.13.8 java_version: jdk8 @@ -106,7 +106,7 @@ workflows: - scala_job: name: jdk11_2.12 java_version: jdk11 - scala_version: 2.12.16 + scala_version: 2.12.17 - scala_job: name: jdk11_2.13 java_version: jdk11 @@ -118,7 +118,7 @@ workflows: - scala_job: name: jdk17_2.12 java_version: jdk17 - scala_version: 2.12.16 + scala_version: 2.12.17 - scala_job: name: jdk17_2.13 java_version: jdk17 @@ -129,7 +129,7 @@ workflows: scala_version: 3.1.3 - scalajs_job: name: sjs1.0_2.12 - scala_version: 2.12.16 + scala_version: 2.12.17 - scalajs_job: name: sjs1.0_2.13 scala_version: 2.13.8 @@ -138,7 +138,7 @@ workflows: scala_version: 3.1.3 - scalanative_job: name: native0.4_2.12 - scala_version: 2.12.16 + scala_version: 2.12.17 - scalanative_job: name: native0.4_2.13 scala_version: 2.13.8 diff --git a/build.sbt b/build.sbt index b27906664..c34aec2bd 100644 --- a/build.sbt +++ b/build.sbt @@ -35,8 +35,8 @@ lazy val xml = crossProject(JSPlatform, JVMPlatform, NativePlatform) .settings( name := "scala-xml", scalaModuleAutomaticModuleName := Some("scala.xml"), - crossScalaVersions := Seq("2.13.8", "2.12.16", "3.1.3"), - scalaVersion := "2.12.16", + crossScalaVersions := Seq("2.13.8", "2.12.17", "3.1.3"), + scalaVersion := "2.12.17", scalacOptions ++= (CrossVersion.partialVersion(scalaVersion.value) match { case Some((3, _)) => From df38f84a72850b0e8c902e7cce7b758040e7dc13 Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Sun, 6 Nov 2022 21:29:51 +0000 Subject: [PATCH 626/789] Update sbt to 1.7.3 --- project/build.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/build.properties b/project/build.properties index 563a014da..6a9f03889 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version=1.7.2 +sbt.version=1.7.3 From 5fb6e34244d452dc12f53d057cddd22985dbd7ec Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Thu, 17 Nov 2022 03:01:49 +0000 Subject: [PATCH 627/789] Update sbt-header to 5.9.0 --- project/plugins.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/plugins.sbt b/project/plugins.sbt index 01ba00883..73c9df569 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -3,4 +3,4 @@ addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.2.0") addSbtPlugin("org.portable-scala" % "sbt-scala-native-crossproject" % "1.2.0") addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.11.0") addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.4.7") -addSbtPlugin("de.heikoseeberger" % "sbt-header" % "5.7.0") +addSbtPlugin("de.heikoseeberger" % "sbt-header" % "5.9.0") From 0bc719200da66938171232fa0681b0af9dc86a3b Mon Sep 17 00:00:00 2001 From: Chris Kipp Date: Sun, 20 Nov 2022 20:24:11 +0100 Subject: [PATCH 628/789] docs: remove hardcoded stable version Typically hardcoded versions like this always lag behind or get forgotten. I'm assuming the vast majority of users can instead rely on the badge in the readme, the GitHub releases, or manually doing `cs complete-dep org.scala-lang.modules:scala-xml_3:` to get the latest stable version. Closes #629 --- README.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/README.md b/README.md index 0d1361430..cd77bd202 100644 --- a/README.md +++ b/README.md @@ -13,8 +13,6 @@ API documentation is available [here](https://javadoc.io/doc/org.scala-lang.modu How to documentation is available in the [wiki](https://github.com/scala/scala-xml/wiki) -The latest stable release of Scala XML is 2.0.1. - ## Maintenance status This library is community-maintained. The lead maintainer is [@aaron_s_hawley](https://github.com/ashawley). From 08ec5ec3a1fbb3f058770d081c5f0e02aa1db531 Mon Sep 17 00:00:00 2001 From: Scala Steward <43047562+scala-steward@users.noreply.github.com> Date: Tue, 22 Nov 2022 17:08:01 +0100 Subject: [PATCH 629/789] Update sbt to 1.8.0 (#632) --- project/build.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/build.properties b/project/build.properties index 6a9f03889..8b9a0b0ab 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version=1.7.3 +sbt.version=1.8.0 From f5ad7964dd0f0a53455b96f4f608f07834e39669 Mon Sep 17 00:00:00 2001 From: Arman Bilge Date: Tue, 22 Nov 2022 18:13:29 -0800 Subject: [PATCH 630/789] Update link for http4s-scala-xml (#633) --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index cd77bd202..b3b9e1cd7 100644 --- a/README.md +++ b/README.md @@ -35,7 +35,7 @@ The XML spec has some features that are best turned off, to avoid unsavory thing - [Advxml](https://github.com/geirolz/advxml) - Functional library combining scala-xml with cats-core - [Binding.scala](https://github.com/ThoughtWorksInc/Binding.scala) - Reactive programming library - [ezXML](https://github.com/JulienSt/ezXML) - Extensions for traverse, encoding, decoding and mapping XML -- [http4s-scala-xml](https://http4s.org/v0.21/entity/) - XML literal support in http4s +- [http4s-scala-xml](https://http4s.github.io/http4s-scala-xml/) - XML literal support in http4s - [Json4s XML](https://github.com/json4s/json4s) - Conversion to and from JSON - [monadic-html](https://github.com/OlivierBlanvillain/monadic-html) - DOM-like event-based programming with XHTML - [phobos](https://github.com/TinkoffCreditSystems/phobos) - Data-binding library based on stream parsing using Aalto XML From 37124fa91ecc21b10c39093d807922306131d3cd Mon Sep 17 00:00:00 2001 From: Scala Steward <43047562+scala-steward@users.noreply.github.com> Date: Fri, 2 Dec 2022 17:31:17 +0100 Subject: [PATCH 631/789] Update junit-runtime, nscplugin, ... to 0.4.9 (#635) --- project/plugins.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/plugins.sbt b/project/plugins.sbt index 73c9df569..c77da1c03 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -2,5 +2,5 @@ addSbtPlugin("org.scala-lang.modules" % "sbt-scala-module" % "3.0.1") addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.2.0") addSbtPlugin("org.portable-scala" % "sbt-scala-native-crossproject" % "1.2.0") addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.11.0") -addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.4.7") +addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.4.9") addSbtPlugin("de.heikoseeberger" % "sbt-header" % "5.9.0") From 5b7e32ffdb5dadd55d4213df04f5b2cfce14ffe8 Mon Sep 17 00:00:00 2001 From: Scala Steward <43047562+scala-steward@users.noreply.github.com> Date: Mon, 5 Dec 2022 18:07:57 +0100 Subject: [PATCH 632/789] Update sbt-scalajs, scalajs-compiler, ... to 1.12.0 (#634) Co-authored-by: Seth Tisue --- project/plugins.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/plugins.sbt b/project/plugins.sbt index c77da1c03..0e3a944bb 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,6 +1,6 @@ addSbtPlugin("org.scala-lang.modules" % "sbt-scala-module" % "3.0.1") addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.2.0") addSbtPlugin("org.portable-scala" % "sbt-scala-native-crossproject" % "1.2.0") -addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.11.0") +addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.12.0") addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.4.9") addSbtPlugin("de.heikoseeberger" % "sbt-header" % "5.9.0") From eaccb88682579921152a20810bca2be768952829 Mon Sep 17 00:00:00 2001 From: Leonid Dubinsky Date: Sun, 25 Dec 2022 03:03:22 -0500 Subject: [PATCH 633/789] Remove some unneeded semicolons and the like. --- .../scala-2.x/scala/xml/CompilerErrors.scala | 2 +- .../test/scala/scala/xml/ReuseNodesTest.scala | 31 ++-- .../test/scala/scala/xml/XMLSyntaxTest.scala | 6 +- jvm/src/test/scala/scala/xml/XMLTest.scala | 141 +++++++++--------- .../src/main/scala/scala/xml/Attribute.scala | 2 +- shared/src/main/scala/scala/xml/Comment.scala | 2 +- shared/src/main/scala/scala/xml/Elem.scala | 3 +- .../src/main/scala/scala/xml/MetaData.scala | 2 +- .../scala/scala/xml/NamespaceBinding.scala | 8 +- shared/src/main/scala/scala/xml/NodeSeq.scala | 12 +- .../main/scala/scala/xml/PrettyPrinter.scala | 12 +- .../src/main/scala/scala/xml/ProcInstr.scala | 2 +- shared/src/main/scala/scala/xml/Utility.scala | 13 +- shared/src/main/scala/scala/xml/XML.scala | 2 +- shared/src/main/scala/scala/xml/Xhtml.scala | 2 +- .../scala/scala/xml/dtd/ContentModel.scala | 4 +- shared/src/main/scala/scala/xml/dtd/DTD.scala | 4 +- .../src/main/scala/scala/xml/dtd/Decl.scala | 4 +- .../main/scala/scala/xml/dtd/DocType.scala | 2 +- .../main/scala/scala/xml/dtd/ExternalID.scala | 2 +- .../scala/xml/dtd/ValidationException.scala | 10 +- .../main/scala/scala/xml/dtd/impl/Base.scala | 2 +- .../scala/xml/dtd/impl/DetWordAutom.scala | 2 +- .../scala/scala/xml/dtd/impl/Inclusion.scala | 4 +- .../xml/dtd/impl/SubsetConstruction.scala | 2 +- .../scala/scala/xml/factory/NodeFactory.scala | 2 +- .../xml/include/sax/EncodingHeuristics.scala | 4 +- .../xml/include/sax/XIncludeFilter.scala | 40 ++--- .../scala/xml/include/sax/XIncluder.scala | 2 +- .../scala/xml/parsing/MarkupHandler.scala | 6 +- .../scala/xml/parsing/MarkupParser.scala | 16 +- .../xml/parsing/MarkupParserCommon.scala | 4 +- .../scala/xml/parsing/XhtmlEntities.scala | 2 +- .../xml/transform/BasicTransformer.scala | 2 +- .../scala/xml/TransformersTest.scala | 3 +- .../test/scala-2.x/scala/xml/XMLTest2x.scala | 2 +- .../test/scala/scala/xml/AttributeTest.scala | 18 +-- .../test/scala/scala/xml/CommentTest.scala | 4 +- .../test/scala/scala/xml/MetaDataTest.scala | 12 +- .../test/scala/scala/xml/NodeSeqTest.scala | 2 +- .../scala/scala/xml/PatternMatchingTest.scala | 12 +- .../test/scala/scala/xml/ShouldCompile.scala | 2 +- .../test/scala/scala/xml/UtilityTest.scala | 10 +- .../test/scala/scala/xml/XMLSyntaxTest.scala | 4 +- shared/src/test/scala/scala/xml/XMLTest.scala | 36 ++--- 45 files changed, 230 insertions(+), 229 deletions(-) diff --git a/jvm/src/test/scala-2.x/scala/xml/CompilerErrors.scala b/jvm/src/test/scala-2.x/scala/xml/CompilerErrors.scala index 4d3197890..b847a827c 100644 --- a/jvm/src/test/scala-2.x/scala/xml/CompilerErrors.scala +++ b/jvm/src/test/scala-2.x/scala/xml/CompilerErrors.scala @@ -202,7 +202,7 @@ class CompilerTesting { def expectXmlErrors(msgCount: Int, msg: String, code: String) = { val errors = xmlErrorMessages(msg, code) - val errorCount = errors.filter(_ contains msg).length + val errorCount = errors.count(_ contains msg) assert(errorCount == msgCount, s"$errorCount occurrences of \'$msg\' found -- expected $msgCount in:\n${errors mkString "\n"}") } } diff --git a/jvm/src/test/scala/scala/xml/ReuseNodesTest.scala b/jvm/src/test/scala/scala/xml/ReuseNodesTest.scala index 5d38d74e2..0b0bfd8cb 100644 --- a/jvm/src/test/scala/scala/xml/ReuseNodesTest.scala +++ b/jvm/src/test/scala/scala/xml/ReuseNodesTest.scala @@ -20,12 +20,12 @@ object ReuseNodesTest { class OriginalTranformr(rules: RewriteRule*) extends RuleTransformer(rules:_*) { override def transform(ns: Seq[Node]): Seq[Node] = { val xs = ns.toStream map transform - val (xs1, xs2) = xs zip ns span { case (x, n) => unchanged(n, x) } + val (xs1, xs2) = xs.zip(ns).span { case (x, n) => unchanged(n, x) } if (xs2.isEmpty) ns - else (xs1 map (_._2)) ++ xs2.head._1 ++ transform(ns drop (xs1.length + 1)) + else xs1.map(_._2) ++ xs2.head._1 ++ transform(ns.drop(xs1.length + 1)) } - override def transform(n:Node): Seq[Node] = super.transform(n) + override def transform(n: Node): Seq[Node] = super.transform(n) } class ModifiedTranformr(rules: RewriteRule*) extends RuleTransformer(rules:_*) { @@ -35,18 +35,18 @@ object ReuseNodesTest { if (changed.length != ns.length || changed.zip(ns).exists(p => p._1 != p._2)) changed else ns } - override def transform(n:Node): Seq[Node] = super.transform(n) + override def transform(n: Node): Seq[Node] = super.transform(n) } class AlternateTranformr(rules: RewriteRule*) extends RuleTransformer(rules:_*) { override def transform(ns: Seq[Node]): Seq[Node] = { - val xs = ns.toStream map transform - val (xs1, xs2) = xs zip ns span { case (x, n) => unchanged(n, x) } + val xs = ns.toStream.map(transform) + val (xs1, xs2) = xs.zip(ns).span { case (x, n) => unchanged(n, x) } if (xs2.isEmpty) ns - else (xs1 map (_._2)) ++ xs2.head._1 ++ transform(ns drop (xs1.length + 1)) + else xs1.map(_._2) ++ xs2.head._1 ++ transform(ns.drop(xs1.length + 1)) } - override def transform(n:Node): Seq[Node] = super.transform(n) + override def transform(n: Node): Seq[Node] = super.transform(n) } def rewriteRule = new RewriteRule { @@ -68,34 +68,33 @@ object ReuseNodesTest { class ReuseNodesTest { @Theory - def transformReferentialEquality(rt:RuleTransformer) = { + def transformReferentialEquality(rt: RuleTransformer) = { val original =

val tranformed = rt.transform(original) assertSame(original, tranformed) } @Theory - def transformReferentialEqualityOnly(rt:RuleTransformer) = { + def transformReferentialEqualityOnly(rt: RuleTransformer) = { val original =
val transformed = rt.transform(original) recursiveAssert(original,transformed) } - def recursiveAssert(original:Seq[Node], transformed:Seq[Node]):Unit = { - original zip transformed foreach { + def recursiveAssert(original: Seq[Node], transformed: Seq[Node]): Unit = { + original.zip(transformed).foreach { case (x, y) => recursiveAssert(x, y) } } - def recursiveAssert(original:Node, transformed:Node):Unit = { + def recursiveAssert(original: Node, transformed: Node): Unit = { transformed.label match { case "changed" => // do nothing expect this node to be changed recursiveAssert(original.child,transformed.child) - case _ => { + case _ => assertSame(original, transformed) - // No need to check for children, node being immuatable + // No need to check for children, node being immuatable // children can't be different if parents are referentially equal - } } } } diff --git a/jvm/src/test/scala/scala/xml/XMLSyntaxTest.scala b/jvm/src/test/scala/scala/xml/XMLSyntaxTest.scala index 5030dcc04..4225545ee 100644 --- a/jvm/src/test/scala/scala/xml/XMLSyntaxTest.scala +++ b/jvm/src/test/scala/scala/xml/XMLSyntaxTest.scala @@ -12,11 +12,11 @@ class XMLSyntaxTestJVM { object parser extends xml.parsing.ConstructingParser(s, false /*ignore ws*/) { override def replacementText(entityName: String): io.Source = { entityName match { - case "nbsp" => io.Source.fromString("\u0160"); - case _ => super.replacementText(entityName); + case "nbsp" => io.Source.fromString("\u0160") + case _ => super.replacementText(entityName) } } - nextch(); // !!important, to initialize the parser + nextch() // !!important, to initialize the parser } val parsed = parser.element(TopScope) // parse the source as element // alternatively, we could call document() diff --git a/jvm/src/test/scala/scala/xml/XMLTest.scala b/jvm/src/test/scala/scala/xml/XMLTest.scala index 3f6eb62ed..812b53680 100644 --- a/jvm/src/test/scala/scala/xml/XMLTest.scala +++ b/jvm/src/test/scala/scala/xml/XMLTest.scala @@ -9,8 +9,6 @@ import org.junit.Assert.assertEquals import java.io.StringWriter import java.io.ByteArrayOutputStream import java.io.StringReader -import scala.collection.Iterable -import scala.collection.Seq import scala.xml.Utility.sort object XMLTestJVM { @@ -19,14 +17,14 @@ object XMLTestJVM { } class XMLTestJVM { - import XMLTestJVM.{ e, sc } + import XMLTestJVM.{e, sc} def Elem(prefix: String, label: String, attributes: MetaData, scope: NamespaceBinding, child: Node*): Elem = scala.xml.Elem.apply(prefix, label, attributes, scope, minimizeEmpty = true, child: _*) lazy val parsedxml1 = XML.load(new InputSource(new StringReader(""))) lazy val parsedxml11 = XML.load(new InputSource(new StringReader(""))) - val xmlFile2 = "Peter BunemanDan SuciuData on ze webJohn MitchellFoundations of Programming Languages"; + val xmlFile2 = "Peter BunemanDan SuciuData on ze webJohn MitchellFoundations of Programming Languages" lazy val parsedxml2 = XML.load(new InputSource(new StringReader(xmlFile2))) @UnitTest @@ -34,9 +32,9 @@ class XMLTestJVM { val c = new Node { def label = "hello" override def hashCode() = - Utility.hashCode(prefix, label, this.attributes.hashCode(), scope.hashCode(), child); - def child = Elem(null, "world", e, sc); - //def attributes = e; + Utility.hashCode(prefix, label, this.attributes.hashCode(), scope.hashCode(), child) + def child = Elem(null, "world", e, sc) + //def attributes = e override def text = "" } @@ -45,7 +43,7 @@ class XMLTestJVM { assertTrue(List(parsedxml1) sameElements List(parsedxml11)) assertTrue(Array(parsedxml1).toList sameElements List(parsedxml11)) - val x2 = "Peter BunemanDan SuciuData on ze web"; + val x2 = "Peter BunemanDan SuciuData on ze web" val i = new InputSource(new StringReader(x2)) val x2p = scala.xml.XML.load(i) @@ -115,10 +113,10 @@ class XMLTestJVM { Elem(null, "title", e, sc, Text("Foundations of Programming Languages")))) assertEquals("Peter BunemanDan SuciuData on ze web", - (parsedxml2 \\ "book") { (n: Node) => (n \ "title") xml_== "Data on ze web" } toString) + (parsedxml2 \\ "book") { (n: Node) => (n \ "title") xml_== "Data on ze web" }.toString) assertTrue( - ((NodeSeq.fromSeq(List(parsedxml2))) \\ "_") sameElements List( + (NodeSeq.fromSeq(List(parsedxml2)) \\ "_") sameElements List( Elem(null, "bib", e, sc, Elem(null, "book", e, sc, Elem(null, "author", e, sc, Text("Peter Buneman")), @@ -144,27 +142,28 @@ class XMLTestJVM { @UnitTest def unparsed = { // println("attribute value normalization") - val xmlAttrValueNorm = ""; + val xmlAttrValueNorm = "" + { - val isrcA = new InputSource(new StringReader(xmlAttrValueNorm)); - val parsedxmlA = XML.load(isrcA); - val c = (parsedxmlA \ "@nom").text.charAt(0); - assertTrue(c == '\u015e'); + val isrcA = new InputSource(new StringReader(xmlAttrValueNorm)) + val parsedxmlA = XML.load(isrcA) + val c = (parsedxmlA \ "@nom").text.charAt(0) + assertTrue(c == '\u015e') } // buraq: if the following test fails with 'character x not allowed', it is // related to the mutable variable in a closures in MarkupParser.parsecharref { - val isr = scala.io.Source.fromString(xmlAttrValueNorm); - val pxmlB = scala.xml.parsing.ConstructingParser.fromSource(isr, false); - val parsedxmlB = pxmlB.element(TopScope); - val c = (parsedxmlB \ "@nom").text.charAt(0); - assertTrue(c == '\u015e'); + val isr = scala.io.Source.fromString(xmlAttrValueNorm) + val pxmlB = scala.xml.parsing.ConstructingParser.fromSource(isr, false) + val parsedxmlB = pxmlB.element(TopScope) + val c = (parsedxmlB \ "@nom").text.charAt(0) + assertTrue(c == '\u015e') } // #60 test by round trip val p = scala.xml.parsing.ConstructingParser.fromSource(scala.io.Source.fromString(""), true) - val n = p.element(new scala.xml.NamespaceBinding("bar", "BAR", scala.xml.TopScope))(0) + val n = p.element(scala.xml.NamespaceBinding("bar", "BAR", scala.xml.TopScope))(0) assertTrue(n.attributes.get("BAR", n, "attr").nonEmpty) } @@ -181,7 +180,7 @@ class XMLTestJVM { assertEquals( """ abc - """, f("a,b,c") toString) + """, f("a,b,c").toString) object Serialize { @throws(classOf[java.io.IOException]) @@ -190,7 +189,7 @@ class XMLTestJVM { val out = new java.io.ObjectOutputStream(ba) out.writeObject(o) out.close() - ba.toByteArray() + ba.toByteArray } @throws(classOf[java.io.IOException]) @throws(classOf[ClassNotFoundException]) @@ -231,7 +230,7 @@ class XMLTestJVM { @UnitTest def serializeElem = { // Elem - val e1 = title; + val e1 = title val _e1: Elem = read(write(e1)) check(e1, _e1) } @@ -250,10 +249,10 @@ class XMLTestJVM { { for (p <- people) yield { p.name } - { p.age.toString() } + { p.age.toString } } - ; + } val people = new AddressBook( @@ -266,7 +265,7 @@ class XMLTestJVM { { people.toXHTML } - ; + val _e2: Elem = read(write(e2)) check(e2, _e2) } @@ -274,24 +273,24 @@ class XMLTestJVM { // t-486 def wsdlTemplate1(serviceName: String): Node = - ; + def wsdlTemplate2(serviceName: String, targetNamespace: String): Node = - ; + def wsdlTemplate4(serviceName: String, targetNamespace: () => String): Node = - ; + @UnitTest def wsdl = { assertEquals(""" - """, wsdlTemplate1("service1") toString) + """, wsdlTemplate1("service1").toString) assertEquals(""" - """, wsdlTemplate2("service2", "target2") toString) + """, wsdlTemplate2("service2", "target2").toString) assertEquals(""" - """, wsdlTemplate4("service4", () => "target4") toString) + """, wsdlTemplate4("service4", () => "target4").toString) } // Issue found with ISO-8859-1 in #121 that was fixed with UTF-8 default @@ -309,7 +308,7 @@ class XMLTestJVM { val streamWriter = new java.io.OutputStreamWriter(outputStream, "UTF-8") XML.write(streamWriter, xml, XML.encoding, false, null) - streamWriter.flush + streamWriter.flush() val inputStream = new java.io.ByteArrayInputStream(outputStream.toByteArray) val streamReader = new java.io.InputStreamReader(inputStream, XML.encoding) @@ -321,13 +320,13 @@ class XMLTestJVM { def t0663 = { val src = scala.io.Source.fromString("") val parser = xml.parsing.ConstructingParser.fromSource(src, true) - assertEquals("", parser.document() toString) + assertEquals("", parser.document().toString) } @UnitTest def t1079 = assertFalse( == ) - import dtd.{ DocType, PublicID } + import dtd.{DocType, PublicID} @UnitTest def t1620 = { @@ -367,8 +366,8 @@ class XMLTestJVM { def backslashSearch(x: xml.Elem) = "root:-" + (x \ "@{nsUri}at") + "-sub:-" + (x \ "sub" \ "@{nsUri}at") + "-" - assertEquals("root:-rootVal-sub:-subVal-", backslashSearch(xml1) toString) - assertEquals("root:-rootVal-sub:-subVal-", backslashSearch(xml2) toString) + assertEquals("root:-rootVal-sub:-subVal-", backslashSearch(xml1)) + assertEquals("root:-rootVal-sub:-subVal-", backslashSearch(xml2)) } @UnitTest @@ -422,15 +421,15 @@ class XMLTestJVM { val bar = scala.xml.Attribute(null, "bar", "2", foo) val ns = scala.xml.NamespaceBinding(null, "uri", scala.xml.TopScope) - assertEquals(""" foo="1"""", foo toString) + assertEquals(""" foo="1"""", foo.toString) assertEquals(null, scala.xml.TopScope.getURI(foo.pre)) - assertEquals(""" bar="2"""", bar remove "foo" toString) - assertEquals(""" foo="1"""", bar remove "bar" toString) - assertEquals(""" bar="2"""", bar remove (null, scala.xml.TopScope, "foo") toString) - assertEquals(""" foo="1"""", bar remove (null, scala.xml.TopScope, "bar") toString) - assertEquals(""" bar="2" foo="1"""", bar toString) - assertEquals(""" bar="2" foo="1"""", bar remove (null, ns, "foo") toString) - assertEquals(""" bar="2" foo="1"""", bar remove (null, ns, "bar") toString) + assertEquals(""" bar="2"""", bar.remove("foo").toString) + assertEquals(""" foo="1"""", bar.remove("bar").toString) + assertEquals(""" bar="2"""", bar.remove(null, scala.xml.TopScope, "foo").toString) + assertEquals(""" foo="1"""", bar.remove(null, scala.xml.TopScope, "bar").toString) + assertEquals(""" bar="2" foo="1"""", bar.toString) + assertEquals(""" bar="2" foo="1"""", bar.remove(null, ns, "foo").toString) + assertEquals(""" bar="2" foo="1"""", bar.remove(null, ns, "bar").toString) } @UnitTest @@ -450,15 +449,15 @@ class XMLTestJVM { @UnitTest def t7074 = { - assertEquals("""""", sort() toString) - assertEquals("""""", sort() toString) - assertEquals("""""", sort() toString) - assertEquals("""""", sort() toString) - assertEquals("""""", sort() toString) - assertEquals("""""", sort() toString) - assertEquals("""""", sort() toString) - assertEquals("""""", sort() toString) - assertEquals("""""", sort() toString) + assertEquals("""""", sort().toString) + assertEquals("""""", sort().toString) + assertEquals("""""", sort().toString) + assertEquals("""""", sort().toString) + assertEquals("""""", sort().toString) + assertEquals("""""", sort().toString) + assertEquals("""""", sort().toString) + assertEquals("""""", sort().toString) + assertEquals("""""", sort().toString) } @UnitTest @@ -485,20 +484,20 @@ class XMLTestJVM { assertEquals(xml1, xml2) assertEquals(xml1, xml3) - assertEquals("""""", noAttr toString) - assertEquals("""""", attrNull toString) - assertEquals("""""", attrNone toString) - assertEquals("""""", preAttrNull toString) - assertEquals("""""", preAttrNone toString) - assertEquals("""""", xml1 toString) - assertEquals("""""", xml2 toString) - assertEquals("""""", xml3 toString) + assertEquals("""""", noAttr.toString) + assertEquals("""""", attrNull.toString) + assertEquals("""""", attrNone.toString) + assertEquals("""""", preAttrNull.toString) + assertEquals("""""", preAttrNone.toString) + assertEquals("""""", xml1.toString) + assertEquals("""""", xml2.toString) + assertEquals("""""", xml3.toString) // Check if attribute order is retained - assertEquals("""""", toString) - assertEquals("""""", toString) - assertEquals("""""", toString) - assertEquals("""""", toString) + assertEquals("""""", .toString) + assertEquals("""""", .toString) + assertEquals("""""", .toString) + assertEquals("""""", .toString) } import java.io.{ Console => _, _ } @@ -507,9 +506,9 @@ class XMLTestJVM { def dontLoop: Unit = { val xml = " " val sink = new PrintStream(new ByteArrayOutputStream()) - (Console withOut sink) { - (Console withErr sink) { - ConstructingParser.fromSource((io.Source fromString xml), true).document().docElem + Console.withOut(sink) { + Console.withErr(sink) { + ConstructingParser.fromSource(io.Source.fromString(xml), preserveWS = true).document().docElem } } } @@ -643,7 +642,7 @@ class XMLTestJVM { parserFactory.setNamespaceAware(namespaceAware) parserFactory.setXIncludeAware(namespaceAware) - assertEquals(xml, XML.withSAXParser(parserFactory.newSAXParser()).loadString(xml).toString()) + assertEquals(xml, XML.withSAXParser(parserFactory.newSAXParser).loadString(xml).toString()) } @UnitTest diff --git a/shared/src/main/scala/scala/xml/Attribute.scala b/shared/src/main/scala/scala/xml/Attribute.scala index e73c6c8b9..f2506d193 100644 --- a/shared/src/main/scala/scala/xml/Attribute.scala +++ b/shared/src/main/scala/scala/xml/Attribute.scala @@ -53,7 +53,7 @@ object Attribute { * * @author Burak Emir */ -abstract trait Attribute extends MetaData { +trait Attribute extends MetaData { def pre: String // will be null if unprefixed val key: String val value: Seq[Node] diff --git a/shared/src/main/scala/scala/xml/Comment.scala b/shared/src/main/scala/scala/xml/Comment.scala index 52b6e787d..6a80c20cb 100644 --- a/shared/src/main/scala/scala/xml/Comment.scala +++ b/shared/src/main/scala/scala/xml/Comment.scala @@ -31,7 +31,7 @@ case class Comment(commentText: String) extends SpecialNode { if (commentText.contains("--")) { throw new IllegalArgumentException("text contains \"--\"") } - if (commentText.length > 0 && commentText.charAt(commentText.length - 1) == '-') { + if (commentText.nonEmpty && commentText.charAt(commentText.length - 1) == '-') { throw new IllegalArgumentException("The final character of a XML comment may not be '-'. See https://www.w3.org/TR/xml11//#IDA5CES") } diff --git a/shared/src/main/scala/scala/xml/Elem.scala b/shared/src/main/scala/scala/xml/Elem.scala index 9015c4b9e..630aeb16f 100755 --- a/shared/src/main/scala/scala/xml/Elem.scala +++ b/shared/src/main/scala/scala/xml/Elem.scala @@ -100,7 +100,8 @@ class Elem( attributes: MetaData = this.attributes, scope: NamespaceBinding = this.scope, minimizeEmpty: Boolean = this.minimizeEmpty, - child: Seq[Node] = this.child.toSeq): Elem = Elem(prefix, label, attributes, scope, minimizeEmpty, child: _*) + child: Seq[Node] = this.child + ): Elem = Elem(prefix, label, attributes, scope, minimizeEmpty, child: _*) /** * Returns concatenation of `text(n)` for each child `n`. diff --git a/shared/src/main/scala/scala/xml/MetaData.scala b/shared/src/main/scala/scala/xml/MetaData.scala index c36587fc3..46ef8c62b 100644 --- a/shared/src/main/scala/scala/xml/MetaData.scala +++ b/shared/src/main/scala/scala/xml/MetaData.scala @@ -134,7 +134,7 @@ abstract class MetaData /** if owner is the element of this metadata item, returns namespace */ def getNamespace(owner: Node): String - def hasNext = (Null != next) + def hasNext = Null != next def length: Int = length(0) diff --git a/shared/src/main/scala/scala/xml/NamespaceBinding.scala b/shared/src/main/scala/scala/xml/NamespaceBinding.scala index 7a750d37c..94caeb238 100644 --- a/shared/src/main/scala/scala/xml/NamespaceBinding.scala +++ b/shared/src/main/scala/scala/xml/NamespaceBinding.scala @@ -42,7 +42,7 @@ case class NamespaceBinding(prefix: String, uri: String, parent: NamespaceBindin def getPrefix(_uri: String): String = if (_uri == uri) prefix else parent getPrefix _uri - override def toString(): String = sbToString(buildString(_, TopScope)) + override def toString: String = sbToString(buildString(_, TopScope)) private def shadowRedefined(stop: NamespaceBinding): NamespaceBinding = { def prefixList(x: NamespaceBinding): List[String] = @@ -50,7 +50,7 @@ case class NamespaceBinding(prefix: String, uri: String, parent: NamespaceBindin else x.prefix :: prefixList(x.parent) def fromPrefixList(l: List[String]): NamespaceBinding = l match { case Nil => stop - case x :: xs => new NamespaceBinding(x, this.getURI(x), fromPrefixList(xs)) + case x :: xs => NamespaceBinding(x, this.getURI(x), fromPrefixList(xs)) } val ps0 = prefixList(this).reverse val ps = ps0.distinct @@ -80,8 +80,8 @@ case class NamespaceBinding(prefix: String, uri: String, parent: NamespaceBindin if (List(null, stop, TopScope).contains(this)) return val s = " xmlns%s=\"%s\"".format( - (if (prefix != null) ":" + prefix else ""), - (if (uri != null) uri else "") + if (prefix != null) ":" + prefix else "", + if (uri != null) uri else "" ) parent.doBuildString(sb append s, stop) // copy(ignore) } diff --git a/shared/src/main/scala/scala/xml/NodeSeq.scala b/shared/src/main/scala/scala/xml/NodeSeq.scala index 7f7daf638..4ccbab390 100644 --- a/shared/src/main/scala/scala/xml/NodeSeq.scala +++ b/shared/src/main/scala/scala/xml/NodeSeq.scala @@ -60,7 +60,7 @@ abstract class NodeSeq extends AbstractSeq[Node] with immutable.Seq[Node] with S val these = this.iterator val those = that.iterator while (these.hasNext && those.hasNext) - if (these.next xml_!= those.next) + if (these.next() xml_!= those.next()) return false !these.hasNext && !those.hasNext @@ -118,11 +118,11 @@ abstract class NodeSeq extends AbstractSeq[Node] with immutable.Seq[Node] with S NodeSeq fromSeq (this flatMap (_.child) filter cond) that match { - case "" => fail - case "_" => makeSeq(!_.isAtom) - case "@" => fail - case _ if (that(0) == '@' && this.length == 1) => atResult - case _ => makeSeq(_.label == that) + case "" => fail + case "_" => makeSeq(!_.isAtom) + case "@" => fail + case _ if that(0) == '@' && this.length == 1 => atResult + case _ => makeSeq(_.label == that) } } diff --git a/shared/src/main/scala/scala/xml/PrettyPrinter.scala b/shared/src/main/scala/scala/xml/PrettyPrinter.scala index c99893d5e..90b683ddb 100755 --- a/shared/src/main/scala/scala/xml/PrettyPrinter.scala +++ b/shared/src/main/scala/scala/xml/PrettyPrinter.scala @@ -38,7 +38,7 @@ class PrettyPrinter(width: Int, step: Int, minimizeEmpty: Boolean) { class Item case object Break extends Item { - override def toString() = "\\" + override def toString = "\\" } case class Box(col: Int, s: String) extends Item case class Para(s: String) extends Item @@ -146,12 +146,12 @@ class PrettyPrinter(width: Int, step: Int, minimizeEmpty: Boolean) { test.length < width - cur private def doPreserve(node: Node) = - node.attribute(XML.namespace, XML.space).map(_.toString == XML.preserve) getOrElse false + node.attribute(XML.namespace, XML.space).exists(_.toString == XML.preserve) protected def traverse(node: Node, pscope: NamespaceBinding, ind: Int): Unit = node match { case Text(s) if s.trim() == "" => - ; + case _: Atom[_] | _: Comment | _: EntityRef | _: ProcInstr => makeBox(ind, node.toString().trim()) case g@Group(xs) => @@ -186,9 +186,9 @@ class PrettyPrinter(width: Int, step: Int, minimizeEmpty: Boolean) { makeBox(ind, stg.substring(0, len2)) makeBreak() // todo: break the rest in pieces /*{ //@todo - val sq:Seq[String] = stg.split(" "); - val it = sq.iterator; - it.next; + val sq:Seq[String] = stg.split(" ") + val it = sq.iterator + it.next for (c <- it) { makeBox(ind+len2-2, c) makeBreak() diff --git a/shared/src/main/scala/scala/xml/ProcInstr.scala b/shared/src/main/scala/scala/xml/ProcInstr.scala index 2bab1d7ef..04970a229 100644 --- a/shared/src/main/scala/scala/xml/ProcInstr.scala +++ b/shared/src/main/scala/scala/xml/ProcInstr.scala @@ -39,5 +39,5 @@ case class ProcInstr(target: String, proctext: String) extends SpecialNode { * to this stringbuffer. */ override def buildString(sb: StringBuilder) = - sb append "".format(target, (if (proctext == "") "" else " " + proctext)) + sb append "".format(target, if (proctext == "") "" else " " + proctext) } diff --git a/shared/src/main/scala/scala/xml/Utility.scala b/shared/src/main/scala/scala/xml/Utility.scala index 1a5226d69..d95931a8c 100755 --- a/shared/src/main/scala/scala/xml/Utility.scala +++ b/shared/src/main/scala/scala/xml/Utility.scala @@ -247,9 +247,10 @@ object Utility extends AnyRef with parsing.TokenTests { stripComments: Boolean = false, decodeEntities: Boolean = true, preserveWhitespace: Boolean = false, - minimizeTags: MinimizeMode.Value = MinimizeMode.Default): Unit = + minimizeTags: MinimizeMode.Value = MinimizeMode.Default + ): Unit = { - if (children.isEmpty) return + if (children.isEmpty) () else if (children forall isAtomAndNotText) { // add space val it = children.iterator val f = it.next() @@ -265,7 +266,7 @@ object Utility extends AnyRef with parsing.TokenTests { /** * Returns prefix of qualified name if any. */ - final def prefix(name: String): Option[String] = (name indexOf ':') match { + final def prefix(name: String): Option[String] = name.indexOf(':') match { case -1 => None case i => Some(name.substring(0, i)) } @@ -360,7 +361,7 @@ object Utility extends AnyRef with parsing.TokenTests { rfb.clear() unescape(ref, sb) match { case null => - if (sb.length > 0) { // flush buffer + if (sb.nonEmpty) { // flush buffer nb += Text(sb.toString()) sb.clear() } @@ -370,9 +371,9 @@ object Utility extends AnyRef with parsing.TokenTests { } } else sb append c } - if (sb.length > 0) { // flush buffer + if (sb.nonEmpty) { // flush buffer val x = Text(sb.toString()) - if (nb.length == 0) + if (nb.isEmpty) return x else nb += x diff --git a/shared/src/main/scala/scala/xml/XML.scala b/shared/src/main/scala/scala/xml/XML.scala index d93d2ce08..46b5a0ec6 100755 --- a/shared/src/main/scala/scala/xml/XML.scala +++ b/shared/src/main/scala/scala/xml/XML.scala @@ -94,7 +94,7 @@ object XML extends XMLLoader[Elem] { doctype: dtd.DocType = null): Unit = { val fos = new FileOutputStream(filename) - val w = Channels.newWriter(fos.getChannel(), enc) + val w = Channels.newWriter(fos.getChannel, enc) ultimately(w.close())( write(w, node, enc, xmlDecl, doctype) diff --git a/shared/src/main/scala/scala/xml/Xhtml.scala b/shared/src/main/scala/scala/xml/Xhtml.scala index 614720d54..c0ec1d3b9 100644 --- a/shared/src/main/scala/scala/xml/Xhtml.scala +++ b/shared/src/main/scala/scala/xml/Xhtml.scala @@ -57,7 +57,7 @@ object Xhtml { } def shortForm = minimizeTags && - (x.child == null || x.child.length == 0) && + (x.child == null || x.child.isEmpty) && (minimizableElements contains x.label) x match { diff --git a/shared/src/main/scala/scala/xml/dtd/ContentModel.scala b/shared/src/main/scala/scala/xml/dtd/ContentModel.scala index 0981c6875..6910f13a7 100644 --- a/shared/src/main/scala/scala/xml/dtd/ContentModel.scala +++ b/shared/src/main/scala/scala/xml/dtd/ContentModel.scala @@ -38,7 +38,7 @@ object ContentModel extends WordExp { } case class ElemName(name: String) extends Label { - override def toString() = """ElemName("%s")""" format name + override def toString = """ElemName("%s")""" format name } def isMixed(cm: ContentModel) = cond(cm) { case _: MIXED => true } @@ -89,7 +89,7 @@ object ContentModel extends WordExp { } sealed abstract class ContentModel { - override def toString(): String = sbToString(buildString) + override def toString: String = sbToString(buildString) def buildString(sb: StringBuilder): StringBuilder } diff --git a/shared/src/main/scala/scala/xml/dtd/DTD.scala b/shared/src/main/scala/scala/xml/dtd/DTD.scala index 919c8acb3..996e7f325 100644 --- a/shared/src/main/scala/scala/xml/dtd/DTD.scala +++ b/shared/src/main/scala/scala/xml/dtd/DTD.scala @@ -32,9 +32,9 @@ abstract class DTD { var attr: mutable.Map[String, AttListDecl] = new mutable.HashMap[String, AttListDecl]() var ent: mutable.Map[String, EntityDecl] = new mutable.HashMap[String, EntityDecl]() - override def toString() = + override def toString = "DTD [\n%s%s]".format( - Option(externalID) getOrElse "", + Option(externalID).getOrElse(""), decls.mkString("", "\n", "\n") ) } diff --git a/shared/src/main/scala/scala/xml/dtd/Decl.scala b/shared/src/main/scala/scala/xml/dtd/Decl.scala index 5497dbb74..80ebc20d8 100644 --- a/shared/src/main/scala/scala/xml/dtd/Decl.scala +++ b/shared/src/main/scala/scala/xml/dtd/Decl.scala @@ -30,7 +30,7 @@ import Utility.sbToString sealed abstract class Decl sealed abstract class MarkupDecl extends Decl { - override def toString(): String = sbToString(buildString) + override def toString: String = sbToString(buildString) def buildString(sb: StringBuilder): StringBuilder } @@ -60,7 +60,7 @@ case class AttListDecl(name: String, attrs: List[AttrDecl]) * directly. */ case class AttrDecl(name: String, tpe: String, default: DefaultDecl) { - override def toString(): String = sbToString(buildString) + override def toString: String = sbToString(buildString) def buildString(sb: StringBuilder): StringBuilder = { sb append " " append name append ' ' append tpe append ' ' diff --git a/shared/src/main/scala/scala/xml/dtd/DocType.scala b/shared/src/main/scala/scala/xml/dtd/DocType.scala index 3e967f03b..62161a566 100644 --- a/shared/src/main/scala/scala/xml/dtd/DocType.scala +++ b/shared/src/main/scala/scala/xml/dtd/DocType.scala @@ -30,7 +30,7 @@ case class DocType(name: String, extID: ExternalID, intSubset: Seq[dtd.Decl]) { throw new IllegalArgumentException(name + " must be an XML Name") /** returns "<!DOCTYPE + name + extID? + ("["+intSubSet+"]")? >" */ - final override def toString() = { + final override def toString = { def intString = if (intSubset.isEmpty) "" else intSubset.mkString("[", "", "]") diff --git a/shared/src/main/scala/scala/xml/dtd/ExternalID.scala b/shared/src/main/scala/scala/xml/dtd/ExternalID.scala index d47b0b173..467430256 100644 --- a/shared/src/main/scala/scala/xml/dtd/ExternalID.scala +++ b/shared/src/main/scala/scala/xml/dtd/ExternalID.scala @@ -27,7 +27,7 @@ sealed abstract class ExternalID extends parsing.TokenTests { // public != null: PUBLIC " " publicLiteral " " [systemLiteral] // public == null: SYSTEM " " systemLiteral - override def toString(): String = { + override def toString: String = { lazy val quotedSystemLiteral = quoted(systemId) lazy val quotedPublicLiteral = quoted(publicId) diff --git a/shared/src/main/scala/scala/xml/dtd/ValidationException.scala b/shared/src/main/scala/scala/xml/dtd/ValidationException.scala index 3e9af6845..127f5ae2e 100644 --- a/shared/src/main/scala/scala/xml/dtd/ValidationException.scala +++ b/shared/src/main/scala/scala/xml/dtd/ValidationException.scala @@ -25,21 +25,21 @@ object MakeValidationException { value + "\", but document tries \"" + actual + "\"") def fromNonEmptyElement() = - new ValidationException("element should be *empty*") + ValidationException("element should be *empty*") def fromUndefinedElement(label: String) = - new ValidationException("element \"" + label + "\" not allowed here") + ValidationException("element \"" + label + "\" not allowed here") def fromUndefinedAttribute(key: String) = - new ValidationException("attribute " + key + " not allowed here") + ValidationException("attribute " + key + " not allowed here") def fromMissingAttribute(allKeys: Set[String]) = { val sb = new StringBuilder("missing value for REQUIRED attribute") if (allKeys.size > 1) sb.append('s') allKeys foreach (k => sb append "'%s'".format(k)) - new ValidationException(sb.toString()) + ValidationException(sb.toString()) } def fromMissingAttribute(key: String, tpe: String) = - new ValidationException("missing value for REQUIRED attribute %s of type %s".format(key, tpe)) + ValidationException("missing value for REQUIRED attribute %s of type %s".format(key, tpe)) } diff --git a/shared/src/main/scala/scala/xml/dtd/impl/Base.scala b/shared/src/main/scala/scala/xml/dtd/impl/Base.scala index e042e709f..bb5f18329 100644 --- a/shared/src/main/scala/scala/xml/dtd/impl/Base.scala +++ b/shared/src/main/scala/scala/xml/dtd/impl/Base.scala @@ -58,7 +58,7 @@ private[dtd] abstract class Base { // The empty Sequ. case object Eps extends RegExp { final lazy val isNullable = true - override def toString() = "Eps" + override def toString = "Eps" } /** this class can be used to add meta information to regexps. */ diff --git a/shared/src/main/scala/scala/xml/dtd/impl/DetWordAutom.scala b/shared/src/main/scala/scala/xml/dtd/impl/DetWordAutom.scala index ffd7e27d2..26fd06e07 100644 --- a/shared/src/main/scala/scala/xml/dtd/impl/DetWordAutom.scala +++ b/shared/src/main/scala/scala/xml/dtd/impl/DetWordAutom.scala @@ -34,7 +34,7 @@ private[dtd] abstract class DetWordAutom[T <: AnyRef] { def isSink(q: Int) = delta(q).isEmpty && default(q) == q def next(q: Int, label: T) = delta(q).getOrElse(label, default(q)) - override def toString() = { + override def toString = { val sb = new StringBuilder("[DetWordAutom nstates=") sb.append(nstates) sb.append(" finals=") diff --git a/shared/src/main/scala/scala/xml/dtd/impl/Inclusion.scala b/shared/src/main/scala/scala/xml/dtd/impl/Inclusion.scala index 8cc36cd88..45d984ff0 100644 --- a/shared/src/main/scala/scala/xml/dtd/impl/Inclusion.scala +++ b/shared/src/main/scala/scala/xml/dtd/impl/Inclusion.scala @@ -32,8 +32,8 @@ private[dtd] trait Inclusion[A <: AnyRef] { def inclusion(dfa1: DetWordAutom[A], dfa2: DetWordAutom[A]) = { def encode(q1: Int, q2: Int) = 1 + q1 + q2 * dfa1.nstates - def decode2(c: Int) = (c - 1) / (dfa1.nstates) //integer division - def decode1(c: Int) = (c - 1) % (dfa1.nstates) + def decode2(c: Int) = (c - 1) / dfa1.nstates //integer division + def decode1(c: Int) = (c - 1) % dfa1.nstates var q1 = 0 //dfa1.initstate; // == 0 var q2 = 0 //dfa2.initstate; // == 0 diff --git a/shared/src/main/scala/scala/xml/dtd/impl/SubsetConstruction.scala b/shared/src/main/scala/scala/xml/dtd/impl/SubsetConstruction.scala index 5a9f0c089..e413101fb 100644 --- a/shared/src/main/scala/scala/xml/dtd/impl/SubsetConstruction.scala +++ b/shared/src/main/scala/scala/xml/dtd/impl/SubsetConstruction.scala @@ -54,7 +54,7 @@ private[dtd] class SubsetConstruction[T <: AnyRef](val nfa: NondetWordAutom[T]) addFinal(q0) // initial state may also be a final state - while (!rest.isEmpty) { + while (rest.nonEmpty) { val P = rest.head rest = rest.tail // assign a number to this bitset diff --git a/shared/src/main/scala/scala/xml/factory/NodeFactory.scala b/shared/src/main/scala/scala/xml/factory/NodeFactory.scala index c6b1704ba..93746e611 100644 --- a/shared/src/main/scala/scala/xml/factory/NodeFactory.scala +++ b/shared/src/main/scala/scala/xml/factory/NodeFactory.scala @@ -45,7 +45,7 @@ trait NodeFactory[A <: Node] { val hash = Utility.hashCode(pre, name, attrSeq.##, scope.##, children) def cons(old: List[A]) = construct(hash, old, pre, name, attrSeq, scope, children) - (cache get hash) match { + cache.get(hash) match { case Some(list) => // find structurally equal list.find(nodeEquals(_, pre, name, attrSeq, scope, children)) match { case Some(x) => x diff --git a/shared/src/main/scala/scala/xml/include/sax/EncodingHeuristics.scala b/shared/src/main/scala/scala/xml/include/sax/EncodingHeuristics.scala index 62444f87c..2d4573155 100644 --- a/shared/src/main/scala/scala/xml/include/sax/EncodingHeuristics.scala +++ b/shared/src/main/scala/scala/xml/include/sax/EncodingHeuristics.scala @@ -51,7 +51,7 @@ object EncodingHeuristics { def readEncodingFromStream(in: InputStream): String = { var ret: String = null val bytesToRead = 1024 // enough to read most XML encoding declarations - def resetAndRet = { in.reset; ret } + def resetAndRet = { in.reset(); ret } // This may fail if there are a lot of space characters before the end // of the encoding declaration @@ -79,7 +79,7 @@ object EncodingHeuristics { // Use Latin-1 (ISO-8859-1) because all byte sequences are legal. val declaration = new String(data, 0, length, "ISO-8859-1") val regexp = """(?m).*?encoding\s*=\s*["'](.+?)['"]""".r - (regexp findFirstMatchIn declaration) match { + regexp.findFirstMatchIn(declaration) match { case None => default case Some(md) => md.subgroups(0) } diff --git a/shared/src/main/scala/scala/xml/include/sax/XIncludeFilter.scala b/shared/src/main/scala/scala/xml/include/sax/XIncludeFilter.scala index de10e7706..e7929d93d 100644 --- a/shared/src/main/scala/scala/xml/include/sax/XIncludeFilter.scala +++ b/shared/src/main/scala/scala/xml/include/sax/XIncludeFilter.scala @@ -16,12 +16,12 @@ package include.sax import scala.xml.include._ -import org.xml.sax.{ Attributes, XMLReader, Locator } -import org.xml.sax.helpers.{ XMLReaderFactory, XMLFilterImpl, NamespaceSupport, AttributesImpl } +import org.xml.sax.{Attributes, Locator, XMLReader} +import org.xml.sax.helpers.{AttributesImpl, NamespaceSupport, XMLFilterImpl, XMLReaderFactory} -import java.io.{ BufferedInputStream, InputStreamReader, IOException, UnsupportedEncodingException } +import java.io.{BufferedInputStream, IOException, InputStreamReader, UnsupportedEncodingException} import java.util.Stack -import java.net.{ URL, MalformedURLException } +import java.net.{MalformedURLException, URL} /** * This is a SAX filter which resolves all XInclude include elements before @@ -92,7 +92,7 @@ class XIncludeFilter extends XMLFilterImpl { // there???? override def setDocumentLocator(locator: Locator): Unit = { locators push locator - val base = locator.getSystemId() + val base = locator.getSystemId try { bases.push(new URL(base)) } catch { @@ -124,7 +124,7 @@ class XIncludeFilter extends XMLFilterImpl { // Adjust bases stack by pushing either the new // value of xml:base or the base of the parent val base = atts.getValue(NamespaceSupport.XMLNS, "base") - val parentBase = bases.peek().asInstanceOf[URL] + val parentBase = bases.peek() var currentBase = parentBase if (base != null) { try { @@ -164,7 +164,7 @@ class XIncludeFilter extends XMLFilterImpl { // add xml:base attribute if necessary val attsImpl = new AttributesImpl(atts) attsImpl.addAttribute(NamespaceSupport.XMLNS, "base", - "xml:base", "CDATA", currentBase.toExternalForm()) + "xml:base", "CDATA", currentBase.toExternalForm) atts = attsImpl atRoot = false } @@ -226,16 +226,16 @@ class XIncludeFilter extends XMLFilterImpl { // convenience method for error messages private def getLocation(): String = { var locationString = "" - val locator = locators.peek().asInstanceOf[Locator] + val locator = locators.peek() var publicID = "" var systemID = "" var column = -1 var line = -1 if (locator != null) { - publicID = locator.getPublicId() - systemID = locator.getSystemId() - line = locator.getLineNumber() - column = locator.getColumnNumber() + publicID = locator.getPublicId + systemID = locator.getSystemId + line = locator.getLineNumber + column = locator.getColumnNumber } locationString = (" in document included from " + publicID + " at " + systemID @@ -261,7 +261,7 @@ class XIncludeFilter extends XMLFilterImpl { if (encoding == null || encoding.trim().equals("")) encoding = "UTF-8" var source: URL = null try { - val base = bases.peek().asInstanceOf[URL] + val base = bases.peek() source = new URL(base, url) } catch { case e: MalformedURLException => @@ -273,9 +273,9 @@ class XIncludeFilter extends XMLFilterImpl { try { val uc = source.openConnection() - val in = new BufferedInputStream(uc.getInputStream()) - val encodingFromHeader = uc.getContentEncoding() - var contentType = uc.getContentType() + val in = new BufferedInputStream(uc.getInputStream) + val encodingFromHeader = uc.getContentEncoding + var contentType = uc.getContentType if (encodingFromHeader != null) encoding = encodingFromHeader else { @@ -305,7 +305,7 @@ class XIncludeFilter extends XMLFilterImpl { + encoding + getLocation(), e) case e: IOException => throw new SAXException("Document not found: " - + source.toExternalForm() + getLocation(), e) + + source.toExternalForm + getLocation(), e) } } @@ -342,7 +342,7 @@ class XIncludeFilter extends XMLFilterImpl { } parser setContentHandler this - val resolver = this.getEntityResolver() + val resolver = this.getEntityResolver if (resolver != null) parser setEntityResolver resolver @@ -357,14 +357,14 @@ class XIncludeFilter extends XMLFilterImpl { bases push source atRoot = true - parser parse source.toExternalForm() + parser parse source.toExternalForm // restore old level and base this.level = previousLevel bases.pop() } catch { case e: IOException => - throw new SAXException("Document not found: " + source.toExternalForm() + getLocation(), e) + throw new SAXException("Document not found: " + source.toExternalForm + getLocation(), e) } } } diff --git a/shared/src/main/scala/scala/xml/include/sax/XIncluder.scala b/shared/src/main/scala/scala/xml/include/sax/XIncluder.scala index a54664002..2dcc69b8c 100644 --- a/shared/src/main/scala/scala/xml/include/sax/XIncluder.scala +++ b/shared/src/main/scala/scala/xml/include/sax/XIncluder.scala @@ -56,7 +56,7 @@ class XIncluder(outs: OutputStream, encoding: String) extends ContentHandler wit def startElement(namespaceURI: String, localName: String, qualifiedName: String, atts: Attributes) = { try { out.write("<" + qualifiedName) - var i = 0; while (i < atts.getLength()) { + var i = 0; while (i < atts.getLength) { out.write(" ") out.write(atts.getQName(i)) out.write("='") diff --git a/shared/src/main/scala/scala/xml/parsing/MarkupHandler.scala b/shared/src/main/scala/scala/xml/parsing/MarkupHandler.scala index 886ee3499..88e30d048 100755 --- a/shared/src/main/scala/scala/xml/parsing/MarkupHandler.scala +++ b/shared/src/main/scala/scala/xml/parsing/MarkupHandler.scala @@ -42,7 +42,7 @@ abstract class MarkupHandler { } def replacementText(entityName: String): Source = - Source fromString ((ent get entityName) match { + Source.fromString(ent.get(entityName) match { case Some(ParsedEntityDecl(_, IntDef(value))) => value case Some(ParameterEntityDecl(_, IntDef(value))) => " %s " format value case Some(_) => "" format entityName @@ -120,10 +120,10 @@ abstract class MarkupHandler { } def parameterEntityDecl(name: String, edef: EntityDef): Unit = - someEntityDecl(name, edef, ParameterEntityDecl.apply _) + someEntityDecl(name, edef, ParameterEntityDecl.apply) def parsedEntityDecl(name: String, edef: EntityDef): Unit = - someEntityDecl(name, edef, ParsedEntityDecl.apply _) + someEntityDecl(name, edef, ParsedEntityDecl.apply) def peReference(name: String): Unit = { decls ::= PEReference(name) } def unparsedEntityDecl(name: String, extID: ExternalID, notat: String): Unit = () diff --git a/shared/src/main/scala/scala/xml/parsing/MarkupParser.scala b/shared/src/main/scala/scala/xml/parsing/MarkupParser.scala index 60b7b5a4b..853897117 100755 --- a/shared/src/main/scala/scala/xml/parsing/MarkupParser.scala +++ b/shared/src/main/scala/scala/xml/parsing/MarkupParser.scala @@ -71,8 +71,8 @@ trait MarkupParser extends MarkupParserCommon with TokenTests { iter.buffered } val iter = new Iterator[Char] { - def hasNext = underlying.hasNext || !queue.isEmpty - def next() = if (!queue.isEmpty) queue.dequeue() else underlying.next() + def hasNext = underlying.hasNext || queue.nonEmpty + def next() = if (queue.nonEmpty) queue.dequeue() else underlying.next() } } @@ -265,7 +265,7 @@ trait MarkupParser extends MarkupParserCommon with TokenTests { case _: EntityRef => // todo: fix entities, shouldn't be "special" reportSyntaxError("no entity references allowed here") case s: SpecialNode => - if (s.toString.trim().length > 0) //non-empty text nodes not allowed + if (s.toString.trim.nonEmpty) //non-empty text nodes not allowed elemCount += 2 case m: Node => elemCount += 1 @@ -328,7 +328,7 @@ trait MarkupParser extends MarkupParserCommon with TokenTests { Utility.prefix(qname) match { case Some("xmlns") => val prefix = qname.substring(6 /*xmlns:*/ , qname.length) - scope = new NamespaceBinding(prefix, value, scope) + scope = NamespaceBinding(prefix, value, scope) case Some(prefix) => val key = qname.substring(prefix.length + 1, qname.length) @@ -336,7 +336,7 @@ trait MarkupParser extends MarkupParserCommon with TokenTests { case _ => if (qname == "xmlns") - scope = new NamespaceBinding(null, value, scope) + scope = NamespaceBinding(null, value, scope) else aMap = new UnprefixedAttribute(qname, Text(value), aMap) } @@ -503,14 +503,14 @@ trait MarkupParser extends MarkupParserCommon with TokenTests { xToken("YSTEM") xSpace() val sysID = systemLiteral() - new SystemID(sysID) + SystemID(sysID) case 'P' => nextch(); xToken("UBLIC") xSpace() val pubID = pubidLiteral() xSpace() val sysID = systemLiteral() - new PublicID(pubID, sysID) + PublicID(pubID, sysID) } /** @@ -934,7 +934,7 @@ trait MarkupParser extends MarkupParserCommon with TokenTests { systemLiteral() else null - new PublicID(pubID, sysID) + PublicID(pubID, sysID) } else { reportSyntaxError("PUBLIC or SYSTEM expected") truncatedError("died parsing notationdecl") diff --git a/shared/src/main/scala/scala/xml/parsing/MarkupParserCommon.scala b/shared/src/main/scala/scala/xml/parsing/MarkupParserCommon.scala index 1a3886589..c967a5f02 100644 --- a/shared/src/main/scala/scala/xml/parsing/MarkupParserCommon.scala +++ b/shared/src/main/scala/scala/xml/parsing/MarkupParserCommon.scala @@ -164,11 +164,11 @@ private[scala] trait MarkupParserCommon extends TokenTests { * see [66] */ def xCharRef(ch: () => Char, nextch: () => Unit): String = - Utility.parseCharRef(ch, nextch, reportSyntaxError _, truncatedError _) + Utility.parseCharRef(ch, nextch, reportSyntaxError, truncatedError) def xCharRef(it: Iterator[Char]): String = { var c = it.next() - Utility.parseCharRef(() => c, () => { c = it.next() }, reportSyntaxError _, truncatedError _) + Utility.parseCharRef(() => c, () => { c = it.next() }, reportSyntaxError, truncatedError) } def xCharRef: String = xCharRef(() => ch, () => nextch()) diff --git a/shared/src/main/scala/scala/xml/parsing/XhtmlEntities.scala b/shared/src/main/scala/scala/xml/parsing/XhtmlEntities.scala index 89b53d844..c3649f8c6 100644 --- a/shared/src/main/scala/scala/xml/parsing/XhtmlEntities.scala +++ b/shared/src/main/scala/scala/xml/parsing/XhtmlEntities.scala @@ -52,7 +52,7 @@ object XhtmlEntities { val entMap: Map[String, Char] = Map.empty[String, Char] ++ entList.map { case (name, value) => (name, value.toChar) } val entities = entList. - map { case (name, value) => (name, new ParsedEntityDecl(name, new IntDef(value.toChar.toString))) } + map { case (name, value) => (name, ParsedEntityDecl(name, IntDef(value.toChar.toString))) } def apply() = entities } diff --git a/shared/src/main/scala/scala/xml/transform/BasicTransformer.scala b/shared/src/main/scala/scala/xml/transform/BasicTransformer.scala index 53dc8002f..c066d52cc 100644 --- a/shared/src/main/scala/scala/xml/transform/BasicTransformer.scala +++ b/shared/src/main/scala/scala/xml/transform/BasicTransformer.scala @@ -30,7 +30,7 @@ abstract class BasicTransformer extends Function1[Node, Node] { * to NodeBuffer. */ def transform(it: Iterator[Node], nb: NodeBuffer): Seq[Node] = - it.foldLeft(nb)(_ ++= transform(_)).toSeq + it.foldLeft(nb)(_ ++= transform(_)) /** * Call transform(Node) to each node in ns, yield ns if nothing changes, diff --git a/shared/src/test/scala-2.x/scala/xml/TransformersTest.scala b/shared/src/test/scala-2.x/scala/xml/TransformersTest.scala index f8c5b661a..ae1ae1463 100644 --- a/shared/src/test/scala-2.x/scala/xml/TransformersTest.scala +++ b/shared/src/test/scala-2.x/scala/xml/TransformersTest.scala @@ -66,10 +66,9 @@ class TransformersTest { new RuleTransformer(new RewriteRule { override def transform(n: Node): Seq[Node] = { n match { - case t: Text if !t.text.trim.isEmpty => { + case t: Text if t.text.trim.nonEmpty => i += 1 Text(t.text + "!") - } case _ => n } } diff --git a/shared/src/test/scala-2.x/scala/xml/XMLTest2x.scala b/shared/src/test/scala-2.x/scala/xml/XMLTest2x.scala index c7e39b93a..21835506f 100644 --- a/shared/src/test/scala-2.x/scala/xml/XMLTest2x.scala +++ b/shared/src/test/scala-2.x/scala/xml/XMLTest2x.scala @@ -10,7 +10,7 @@ class XMLTest2x { // t-486 def wsdlTemplate3(serviceName: String): Node = - ; + @UnitTest def wsdl = { diff --git a/shared/src/test/scala/scala/xml/AttributeTest.scala b/shared/src/test/scala/scala/xml/AttributeTest.scala index 84cebbeb6..4e151224e 100644 --- a/shared/src/test/scala/scala/xml/AttributeTest.scala +++ b/shared/src/test/scala/scala/xml/AttributeTest.scala @@ -56,8 +56,8 @@ class AttributeTest { def attributeToString: Unit = { val expected: String = """""" - assertEquals(expected, ().toString) - assertEquals(expected, ().toString) + assertEquals(expected, .toString) + assertEquals(expected, .toString) } @Test @@ -102,31 +102,31 @@ class AttributeTest { @Test def attributePathDescendantAttributes: Unit = { val xml = - assertEquals(NodeSeq.fromSeq(Seq(Text("1"), Text("2"))), (xml \\ "@bar")) + assertEquals(NodeSeq.fromSeq(Seq(Text("1"), Text("2"))), xml \\ "@bar") } @Test def attributeDescendantPathChildAttributes: Unit = { val xml = - assertEquals(NodeSeq.fromSeq(Seq(Text("1"), Text("2"))), (xml \ "b" \\ "@bar")) + assertEquals(NodeSeq.fromSeq(Seq(Text("1"), Text("2"))), xml \ "b" \\ "@bar") } @Test def attributeDescendantPathDescendantAttributes: Unit = { val xml = - assertEquals(NodeSeq.fromSeq(Seq(Text("1"), Text("2"))), (xml \\ "b" \\ "@bar")) + assertEquals(NodeSeq.fromSeq(Seq(Text("1"), Text("2"))), xml \\ "b" \\ "@bar") } @Test def attributeChildDescendantPathDescendantAttributes: Unit = { val xml = - assertEquals(NodeSeq.fromSeq(Seq(Text("1"), Text("2"))), (xml \ "a" \\ "@bar")) + assertEquals(NodeSeq.fromSeq(Seq(Text("1"), Text("2"))), xml \ "a" \\ "@bar") } @Test def attributeDescendantDescendantPathDescendantAttributes: Unit = { val xml = - assertEquals(NodeSeq.fromSeq(Seq(Text("1"), Text("2"))), (xml \\ "b" \\ "@bar")) + assertEquals(NodeSeq.fromSeq(Seq(Text("1"), Text("2"))), xml \\ "b" \\ "@bar") } @Test(expected=classOf[IllegalArgumentException]) @@ -138,13 +138,13 @@ class AttributeTest { @Test def attributePathNoDescendantAttributes: Unit = { val xml = - assertEquals(NodeSeq.Empty, (xml \\ "@oops")) + assertEquals(NodeSeq.Empty, xml \\ "@oops") } @Test def attributePathOneChildWithAttributes: Unit = { val xml = > - assertEquals(Group(Seq(Text("1"))), (xml \ "b" \ "@bar")) + assertEquals(Group(Seq(Text("1"))), xml \ "b" \ "@bar") } @Test diff --git a/shared/src/test/scala/scala/xml/CommentTest.scala b/shared/src/test/scala/scala/xml/CommentTest.scala index 0e077a969..b1a6cfe34 100644 --- a/shared/src/test/scala/scala/xml/CommentTest.scala +++ b/shared/src/test/scala/scala/xml/CommentTest.scala @@ -18,12 +18,12 @@ final class CommentTest { @Test def validCommentWithDash: Unit = { val valid: String = "valid-comment" - assertEquals(s"", Comment(valid).toString) + assertEquals(s"", Comment(valid).toString) } @Test def validEmptyComment: Unit = { val valid: String = "" - assertEquals(s"", Comment(valid).toString) + assertEquals(s"", Comment(valid).toString) } } diff --git a/shared/src/test/scala/scala/xml/MetaDataTest.scala b/shared/src/test/scala/scala/xml/MetaDataTest.scala index d6bacc0ef..44c9454d6 100644 --- a/shared/src/test/scala/scala/xml/MetaDataTest.scala +++ b/shared/src/test/scala/scala/xml/MetaDataTest.scala @@ -14,23 +14,23 @@ class MetaDataTest { @Test def absentElementPrefixed2: Unit = { - assertEquals(None, Null.get("za://foo.com", TopScope, "bar" )) - assertEquals(None, Null.get("bar")) + assertEquals(Option.empty, Null.get("za://foo.com", TopScope, "bar" )) + assertEquals(Option.empty, Null.get("bar")) } @Test def presentElement1: Unit = { val x = new PrefixedAttribute("zo","bar", new Atom(42), Null) - val s = new NamespaceBinding("zo","za://foo.com", TopScope) + val s = NamespaceBinding("zo","za://foo.com", TopScope) assertEquals(new Atom(42), x("za://foo.com", s, "bar" )) assertEquals(null, x("bar")) assertEquals(Some(new Atom(42)), x.get("za://foo.com", s, "bar")) - assertEquals(None, x.get("bar")) + assertEquals(Option.empty, x.get("bar")) } @Test def presentElement2: Unit = { - val s = new NamespaceBinding("zo","za://foo.com", TopScope) + val s = NamespaceBinding("zo","za://foo.com", TopScope) val x1 = new PrefixedAttribute("zo","bar", new Atom(42), Null) val x = new UnprefixedAttribute("bar","meaning", x1) assertEquals(null, x(null, s, "bar")) @@ -43,7 +43,7 @@ class MetaDataTest { def attributeExtractor: Unit = { def domatch(x:Node): Node = { x match { - case Node("foo", md @ UnprefixedAttribute(_, value, _), _*) if !value.isEmpty => + case Node("foo", md @ UnprefixedAttribute(_, value, _), _*) if value.nonEmpty => md("bar")(0) case _ => new Atom(3) } diff --git a/shared/src/test/scala/scala/xml/NodeSeqTest.scala b/shared/src/test/scala/scala/xml/NodeSeqTest.scala index 7f80b3366..8fa427363 100644 --- a/shared/src/test/scala/scala/xml/NodeSeqTest.scala +++ b/shared/src/test/scala/scala/xml/NodeSeqTest.scala @@ -46,7 +46,7 @@ class NodeSeqTest { val exp: NodeBuffer = { HelloHi } - assertEquals(exp, res) + assertEquals(exp.toSeq, res) } @Test diff --git a/shared/src/test/scala/scala/xml/PatternMatchingTest.scala b/shared/src/test/scala/scala/xml/PatternMatchingTest.scala index 2fce27208..b2892c9cb 100644 --- a/shared/src/test/scala/scala/xml/PatternMatchingTest.scala +++ b/shared/src/test/scala/scala/xml/PatternMatchingTest.scala @@ -18,7 +18,7 @@ class PatternMatchingTest { } def matchList(args: List[String]) = - Elem(null, "bla", Null, TopScope, minimizeEmpty = true, (args map { x => Text(x) }): _*) match { + Elem(null, "bla", Null, TopScope, minimizeEmpty = true, args.map { x => Text(x) }: _*) match { case Elem(_, _, _, _, Text("1"), _*) => true } @@ -58,9 +58,11 @@ class PatternMatchingTest { object SafeNodeSeq { def unapplySeq(any: Any): Option[Seq[Node]] = any match { - case s: Seq[_] => Some((s flatMap (_ match { - case n: Node => n case _ => NodeSeq.Empty - })).toSeq) case _ => None + case s: Seq[_] => Some(s flatMap { + case n: Node => n + case _ => NodeSeq.Empty + }) + case _ => None } } @@ -73,7 +75,7 @@ class PatternMatchingTest { Blabla Blubabla Baaaaaaalabla - ; + assertTrue(NodeSeq.fromSeq(books.child) match { case t @ Seq(Blabla) => false diff --git a/shared/src/test/scala/scala/xml/ShouldCompile.scala b/shared/src/test/scala/scala/xml/ShouldCompile.scala index 0059a0b83..e394b4b90 100644 --- a/shared/src/test/scala/scala/xml/ShouldCompile.scala +++ b/shared/src/test/scala/scala/xml/ShouldCompile.scala @@ -64,7 +64,7 @@ object SI_5858 { class Floozy { def fooz(x: Node => String) = {} def foo(m: Node): Unit = fooz { - case Elem(_, _, _, _, n, _*) if (n == m) => "gaga" + case Elem(_, _, _, _, n, _*) if n == m => "gaga" } } diff --git a/shared/src/test/scala/scala/xml/UtilityTest.scala b/shared/src/test/scala/scala/xml/UtilityTest.scala index de4a8c29e..73d4a85a4 100644 --- a/shared/src/test/scala/scala/xml/UtilityTest.scala +++ b/shared/src/test/scala/scala/xml/UtilityTest.scala @@ -83,7 +83,7 @@ class UtilityTest { @Test def escapePrintablesTest: Unit = { for { - char <- (printableAscii.diff(escapedChars)) + char <- printableAscii.diff(escapedChars) } yield { assertEquals(char.toString, Utility.escape(char.toString)) } @@ -120,7 +120,7 @@ class UtilityTest { @Test def escapeUnicodeExtendedControlCodesTest: Unit = { for { - char <- ('\u0080' to '\u009f') // Extended control codes (C1) + char <- '\u0080' to '\u009f' // Extended control codes (C1) } yield { assertEquals(char.toString, Utility.escape(char.toString)) } @@ -129,7 +129,7 @@ class UtilityTest { @Test def escapeUnicodeTwoBytesTest: Unit = { for { - char <- ('\u00A0' to '\u07FF') // Two bytes (cont.) + char <- '\u00A0' to '\u07FF' // Two bytes (cont.) } yield { assertEquals(char.toString, Utility.escape(char.toString)) } @@ -138,7 +138,7 @@ class UtilityTest { @Test def escapeUnicodeThreeBytesTest: Unit = { for { - char <- ('\u0800' to '\uFFFF') // Three bytes + char <- '\u0800' to '\uFFFF' // Three bytes } yield { assertEquals(char.toString, Utility.escape(char.toString)) } @@ -193,7 +193,7 @@ class UtilityTest { '\u001E' -> "^^", // Record separator '\u001F' -> "^_", // Unit separator '\u007F' -> "^?" // Delete - ).toMap.withDefault { + ).withDefault { (key: Char) => key.toString } diff --git a/shared/src/test/scala/scala/xml/XMLSyntaxTest.scala b/shared/src/test/scala/scala/xml/XMLSyntaxTest.scala index 26410a9af..700709f29 100644 --- a/shared/src/test/scala/scala/xml/XMLSyntaxTest.scala +++ b/shared/src/test/scala/scala/xml/XMLSyntaxTest.scala @@ -55,11 +55,11 @@ class XMLSyntaxTest { @Test def test2(): Unit = { val x1: Option[Seq[Node]] = Some(hello) - val n1 = ; + val n1 = assertEquals(x1, n1.attribute("key")) val x2: Option[Seq[Node]] = None - val n2 = ; + val n2 = assertEquals(x2, n2.attribute("key")) } diff --git a/shared/src/test/scala/scala/xml/XMLTest.scala b/shared/src/test/scala/scala/xml/XMLTest.scala index 8e8e3acb0..f57aeb2fa 100644 --- a/shared/src/test/scala/scala/xml/XMLTest.scala +++ b/shared/src/test/scala/scala/xml/XMLTest.scala @@ -28,9 +28,9 @@ class XMLTest { val pelems_1 = for (x <- p \ "bar"; y <- p \ "baz") yield { Text(x.attributes("value").toString + y.attributes("bazValue").toString + "!") - }; + } - val pelems_2 = NodeSeq.fromSeq(List(Text("38!"), Text("58!"))); + val pelems_2 = NodeSeq.fromSeq(List(Text("38!"), Text("58!"))) assertTrue(pelems_1 sameElements pelems_2) assertTrue(Text("8") sameElements (p \\ "@bazValue")) } @@ -42,7 +42,7 @@ class XMLTest { Blabla Blubabla Baaaaaaalabla - ; + val reviews = @@ -64,16 +64,16 @@ class XMLTest { rem 2 - ; + val results1 = new scala.xml.PrettyPrinter(80, 5).formatNodes( - for ( - t <- books \\ "title"; + for { + t <- books \\ "title" r <- reviews \\ "entry" if (r \ "title") xml_== t - ) yield + } yield { t } { r \ "remarks" } - ); + ) val results1Expected = """ | Blabla | Hallo Welt. @@ -110,7 +110,7 @@ class XMLTest { +41 21 693 68 67 +41 79 602 23 23 - ; + val addrBook = @@ -125,13 +125,13 @@ class XMLTest { Elm Street Dolphin City - ; + val actual: String = new scala.xml.PrettyPrinter(80, 5).formatNodes( - for ( - t <- addrBook \\ "entry"; + for { + t <- addrBook \\ "entry" r <- phoneBook \\ "entry" if (t \ "name") xml_== (r \ "name") - ) yield + } yield { t.child } { r \ "phone" } ) @@ -160,7 +160,7 @@ class XMLTest { val cuckoo = - ; +
assertEquals("http://cuckoo.com", cuckoo.namespace) for (n <- cuckoo \ "_") { assertEquals("http://cuckoo.com", n.namespace) @@ -197,7 +197,7 @@ class XMLTest { @UnitTest def dodgyNamespace = { val x = - assertTrue(x.toString.matches(".*xmlns:dog=\"http://dog.com\".*")); + assertTrue(x.toString.matches(".*xmlns:dog=\"http://dog.com\".*")) } val ax = @@ -302,15 +302,15 @@ Ours is the portal of hope, come as you are." // t-486 def wsdlTemplate1(serviceName: String): Node = - ; + def wsdlTemplate2(serviceName: String, targetNamespace: String): Node = - ; + def wsdlTemplate4(serviceName: String, targetNamespace: () => String): Node = - ; + @UnitTest def wsdl = { From d6d8e3374b8bd27dcc82609464662dbbdca759a0 Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Thu, 5 Jan 2023 20:38:49 +0000 Subject: [PATCH 634/789] Update sbt to 1.8.2 --- project/build.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/build.properties b/project/build.properties index 8b9a0b0ab..46e43a97e 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version=1.8.0 +sbt.version=1.8.2 From fc5586191a733ff2005f9b43eaee654460ff3663 Mon Sep 17 00:00:00 2001 From: Seth Tisue Date: Fri, 13 Jan 2023 08:14:19 -0800 Subject: [PATCH 635/789] copyright 2023 (#640) --- NOTICE | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/NOTICE b/NOTICE index 2d345d83a..8e6166dc5 100644 --- a/NOTICE +++ b/NOTICE @@ -1,6 +1,6 @@ scala-xml -Copyright (c) 2002-2022 EPFL -Copyright (c) 2011-2022 Lightbend, Inc. +Copyright (c) 2002-2023 EPFL +Copyright (c) 2011-2023 Lightbend, Inc. scala-xml includes software developed at LAMP/EPFL (https://lamp.epfl.ch/) and From faae2429273992e0119fe0518e59d2a1e7068996 Mon Sep 17 00:00:00 2001 From: Seth Tisue Date: Fri, 20 Jan 2023 18:43:09 -0800 Subject: [PATCH 636/789] re-enable sbt-version-policy fixes #617 --- build.sbt | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/build.sbt b/build.sbt index 8eda4f7f8..38272a18f 100644 --- a/build.sbt +++ b/build.sbt @@ -62,8 +62,7 @@ lazy val xml = crossProject(JSPlatform, JVMPlatform, NativePlatform) |additional information regarding copyright ownership. |""".stripMargin)), - // should be reverted to Compatibility.BinaryAndSourceCompatible after 2.2.0 is released - versionPolicyIntention := Compatibility.None, + versionPolicyIntention := Compatibility.BinaryCompatible, // Note: See discussion on non-JVM Mima in https://github.com/scala/scala-xml/pull/517 mimaBinaryIssueFilters ++= { import com.typesafe.tools.mima.core._ @@ -130,11 +129,15 @@ lazy val xml = crossProject(JSPlatform, JVMPlatform, NativePlatform) }), ) .jsSettings( + versionPolicyCheck / skip := true, + versionCheck / skip := true, // Scala.js cannot run forked tests Test / fork := false ) .jsEnablePlugins(ScalaJSJUnitPlugin) .nativeSettings( + versionPolicyCheck / skip := true, + versionCheck / skip := true, // Scala Native cannot run forked tests Test / fork := false, libraryDependencies += "org.scala-native" %%% "junit-runtime" % nativeVersion % Test, From 5371522e99ab82afa691b8685abe33fabea83de2 Mon Sep 17 00:00:00 2001 From: Seth Tisue Date: Fri, 20 Jan 2023 19:12:22 -0800 Subject: [PATCH 637/789] wip --- build.sbt | 2 -- 1 file changed, 2 deletions(-) diff --git a/build.sbt b/build.sbt index 38272a18f..ce0a85051 100644 --- a/build.sbt +++ b/build.sbt @@ -129,8 +129,6 @@ lazy val xml = crossProject(JSPlatform, JVMPlatform, NativePlatform) }), ) .jsSettings( - versionPolicyCheck / skip := true, - versionCheck / skip := true, // Scala.js cannot run forked tests Test / fork := false ) From 1cc9ea896221370591b83f7b6d28d958a34254a4 Mon Sep 17 00:00:00 2001 From: Leonid Dubinsky Date: Sat, 24 Dec 2022 22:20:47 -0500 Subject: [PATCH 638/789] `scala.xml.XML` allows overriding the SAXParser used via the `withSAXParser()` method. Some XML parsing customizations require changing the XMLReader contained inside every SAXParser (e.g., adding an XMLFilter). This pull request introduces an additional extension point `XMLLoader.reader` and a method `XML.withXMLReader()` for such a purpose. Also, ErrorHandler and EntityResolver configured externally are no longer wiped out before parsing the XML. --- jvm/src/test/scala/scala/xml/XMLTest.scala | 28 +++++++ shared/src/main/scala/scala/xml/XML.scala | 8 +- .../scala/scala/xml/factory/XMLLoader.scala | 74 ++++++++++++------- shared/src/main/scala/scala/xml/package.scala | 1 + .../scala/xml/parsing/MarkupParser.scala | 5 +- 5 files changed, 84 insertions(+), 32 deletions(-) diff --git a/jvm/src/test/scala/scala/xml/XMLTest.scala b/jvm/src/test/scala/scala/xml/XMLTest.scala index 812b53680..032b341a6 100644 --- a/jvm/src/test/scala/scala/xml/XMLTest.scala +++ b/jvm/src/test/scala/scala/xml/XMLTest.scala @@ -657,6 +657,34 @@ class XMLTestJVM { def namespaceAware2: Unit = roundtrip(namespaceAware = true, """""") + @UnitTest + def useXMLReaderWithXMLFilter(): Unit = { + val parent: org.xml.sax.XMLReader = javax.xml.parsers.SAXParserFactory.newInstance.newSAXParser.getXMLReader + val filter: org.xml.sax.XMLFilter = new org.xml.sax.helpers.XMLFilterImpl(parent) { + override def characters(ch: Array[Char], start: Int, length: Int): Unit = { + for (i <- 0 until length) if (ch(start+i) == 'a') ch(start+i) = 'b' + super.characters(ch, start, length) + } + } + assertEquals(XML.withXMLReader(filter).loadString("caffeeaaay").toString, "cbffeebbby") + } + + @UnitTest + def checkThatErrorHandlerIsNotOverwritten(): Unit = { + var gotAnError: Boolean = false + XML.reader.setErrorHandler(new org.xml.sax.ErrorHandler { + override def warning(e: SAXParseException): Unit = gotAnError = true + override def error(e: SAXParseException): Unit = gotAnError = true + override def fatalError(e: SAXParseException): Unit = gotAnError = true + }) + try { + XML.loadString("") + } catch { + case _: org.xml.sax.SAXParseException => + } + assertTrue(gotAnError) + } + @UnitTest def nodeSeqNs: Unit = { val x = { diff --git a/shared/src/main/scala/scala/xml/XML.scala b/shared/src/main/scala/scala/xml/XML.scala index 46b5a0ec6..531afcc97 100755 --- a/shared/src/main/scala/scala/xml/XML.scala +++ b/shared/src/main/scala/scala/xml/XML.scala @@ -14,8 +14,8 @@ package scala package xml import factory.XMLLoader -import java.io.{ File, FileDescriptor, FileInputStream, FileOutputStream } -import java.io.{ InputStream, Reader, StringReader } +import java.io.{File, FileDescriptor, FileInputStream, FileOutputStream} +import java.io.{InputStream, Reader, StringReader} import java.nio.channels.Channels import scala.util.control.Exception.ultimately @@ -72,6 +72,10 @@ object XML extends XMLLoader[Elem] { def withSAXParser(p: SAXParser): XMLLoader[Elem] = new XMLLoader[Elem] { override val parser: SAXParser = p } + /** Returns an XMLLoader whose load* methods will use the supplied XMLReader. */ + def withXMLReader(r: XMLReader): XMLLoader[Elem] = + new XMLLoader[Elem] { override val reader: XMLReader = r } + /** * Saves a node to a file with given filename using given encoding * optionally with xmldecl and doctype declaration. diff --git a/shared/src/main/scala/scala/xml/factory/XMLLoader.scala b/shared/src/main/scala/scala/xml/factory/XMLLoader.scala index 620e1b6e0..5cdc9461e 100644 --- a/shared/src/main/scala/scala/xml/factory/XMLLoader.scala +++ b/shared/src/main/scala/scala/xml/factory/XMLLoader.scala @@ -14,7 +14,7 @@ package scala package xml package factory -import org.xml.sax.SAXNotRecognizedException +import org.xml.sax.{SAXNotRecognizedException, XMLReader} import javax.xml.parsers.SAXParserFactory import parsing.{FactoryAdapter, NoBindingFactoryAdapter} import java.io.{File, FileDescriptor, InputStream, Reader} @@ -46,59 +46,77 @@ trait XMLLoader[T <: Node] { /* Override this to use a different SAXParser. */ def parser: SAXParser = parserInstance.get + /* Override this to use a different XMLReader. */ + def reader: XMLReader = parser.getXMLReader + /** * Loads XML from the given InputSource, using the supplied parser. * The methods available in scala.xml.XML use the XML parser in the JDK. */ - def loadXML(source: InputSource, parser: SAXParser): T = { - val result: FactoryAdapter = parse(source, parser) + def loadXML(source: InputSource, parser: SAXParser): T = loadXML(source, parser.getXMLReader) + + def loadXMLNodes(source: InputSource, parser: SAXParser): Seq[Node] = loadXMLNodes(source, parser.getXMLReader) + + private def loadXML(source: InputSource, reader: XMLReader): T = { + val result: FactoryAdapter = parse(source, reader) result.rootElem.asInstanceOf[T] } - - def loadXMLNodes(source: InputSource, parser: SAXParser): Seq[Node] = { - val result: FactoryAdapter = parse(source, parser) + + private def loadXMLNodes(source: InputSource, reader: XMLReader): Seq[Node] = { + val result: FactoryAdapter = parse(source, reader) result.prolog ++ (result.rootElem :: result.epilogue) } - private def parse(source: InputSource, parser: SAXParser): FactoryAdapter = { + private def parse(source: InputSource, reader: XMLReader): FactoryAdapter = { + if (source == null) throw new IllegalArgumentException("InputSource cannot be null") + val result: FactoryAdapter = adapter + reader.setContentHandler(result) + reader.setDTDHandler(result) + /* Do not overwrite pre-configured EntityResolver. */ + if (reader.getEntityResolver == null) reader.setEntityResolver(result) + /* Do not overwrite pre-configured ErrorHandler. */ + if (reader.getErrorHandler == null) reader.setErrorHandler(result) + try { - parser.setProperty("http://xml.org/sax/properties/lexical-handler", result) + reader.setProperty("http://xml.org/sax/properties/lexical-handler", result) } catch { case _: SAXNotRecognizedException => } result.scopeStack = TopScope :: result.scopeStack - parser.parse(source, result) + reader.parse(source) result.scopeStack = result.scopeStack.tail result } + /** loads XML from given InputSource. */ + def load(source: InputSource): T = loadXML(source, reader) + /** Loads XML from the given file, file descriptor, or filename. */ - def loadFile(file: File): T = loadXML(fromFile(file), parser) - def loadFile(fd: FileDescriptor): T = loadXML(fromFile(fd), parser) - def loadFile(name: String): T = loadXML(fromFile(name), parser) + def loadFile(file: File): T = load(fromFile(file)) + def loadFile(fd: FileDescriptor): T = load(fromFile(fd)) + def loadFile(name: String): T = load(fromFile(name)) - /** loads XML from given InputStream, Reader, sysID, InputSource, or URL. */ - def load(is: InputStream): T = loadXML(fromInputStream(is), parser) - def load(reader: Reader): T = loadXML(fromReader(reader), parser) - def load(sysID: String): T = loadXML(fromSysId(sysID), parser) - def load(source: InputSource): T = loadXML(source, parser) - def load(url: URL): T = loadXML(fromInputStream(url.openStream()), parser) + /** loads XML from given InputStream, Reader, sysID, or URL. */ + def load(is: InputStream): T = load(fromInputStream(is)) + def load(reader: Reader): T = load(fromReader(reader)) + def load(sysID: String): T = load(fromSysId(sysID)) + def load(url: URL): T = load(fromInputStream(url.openStream())) /** Loads XML from the given String. */ - def loadString(string: String): T = loadXML(fromString(string), parser) + def loadString(string: String): T = load(fromString(string)) /** Load XML nodes, including comments and processing instructions that precede and follow the root element. */ - def loadFileNodes(file: File): Seq[Node] = loadXMLNodes(fromFile(file), parser) - def loadFileNodes(fd: FileDescriptor): Seq[Node] = loadXMLNodes(fromFile(fd), parser) - def loadFileNodes(name: String): Seq[Node] = loadXMLNodes(fromFile(name), parser) - def loadNodes(is: InputStream): Seq[Node] = loadXMLNodes(fromInputStream(is), parser) - def loadNodes(reader: Reader): Seq[Node] = loadXMLNodes(fromReader(reader), parser) - def loadNodes(sysID: String): Seq[Node] = loadXMLNodes(fromSysId(sysID), parser) - def loadNodes(source: InputSource): Seq[Node] = loadXMLNodes(source, parser) - def loadNodes(url: URL): Seq[Node] = loadXMLNodes(fromInputStream(url.openStream()), parser) - def loadStringNodes(string: String): Seq[Node] = loadXMLNodes(fromString(string), parser) + def loadNodes(source: InputSource): Seq[Node] = loadXMLNodes(source, reader) + def loadFileNodes(file: File): Seq[Node] = loadNodes(fromFile(file)) + def loadFileNodes(fd: FileDescriptor): Seq[Node] = loadNodes(fromFile(fd)) + def loadFileNodes(name: String): Seq[Node] = loadNodes(fromFile(name)) + def loadNodes(is: InputStream): Seq[Node] = loadNodes(fromInputStream(is)) + def loadNodes(reader: Reader): Seq[Node] = loadNodes(fromReader(reader)) + def loadNodes(sysID: String): Seq[Node] = loadNodes(fromSysId(sysID)) + def loadNodes(url: URL): Seq[Node] = loadNodes(fromInputStream(url.openStream())) + def loadStringNodes(string: String): Seq[Node] = loadNodes(fromString(string)) } diff --git a/shared/src/main/scala/scala/xml/package.scala b/shared/src/main/scala/scala/xml/package.scala index 7847f63ba..d25a80e27 100644 --- a/shared/src/main/scala/scala/xml/package.scala +++ b/shared/src/main/scala/scala/xml/package.scala @@ -80,5 +80,6 @@ package object xml { type SAXParseException = org.xml.sax.SAXParseException type EntityResolver = org.xml.sax.EntityResolver type InputSource = org.xml.sax.InputSource + type XMLReader = org.xml.sax.XMLReader type SAXParser = javax.xml.parsers.SAXParser } diff --git a/shared/src/main/scala/scala/xml/parsing/MarkupParser.scala b/shared/src/main/scala/scala/xml/parsing/MarkupParser.scala index 853897117..4fe936a4b 100755 --- a/shared/src/main/scala/scala/xml/parsing/MarkupParser.scala +++ b/shared/src/main/scala/scala/xml/parsing/MarkupParser.scala @@ -98,8 +98,9 @@ trait MarkupParser extends MarkupParserCommon with TokenTests { var extIndex = -1 /** holds temporary values of pos */ - // Note: this is clearly an override, but if marked as such it causes a "...cannot override a mutable variable" - // error with Scala 3; does it work with Scala 3 if not explicitly marked as an override remains to be seen... + // Note: if marked as an override, this causes a "...cannot override a mutable variable" error with Scala 3; + // SethTisue noted on Oct 14, 2021 that lampepfl/dotty#13744 should fix it - and it probably did, + // but Scala XML still builds against Scala 3 version that has this bug, so this still can not be marked as an override :( var tmppos: Int = _ /** holds the next character */ From 3024a725c67db83307657b079effb686adcaf162 Mon Sep 17 00:00:00 2001 From: Seth Tisue Date: Thu, 26 Jan 2023 13:34:31 -0800 Subject: [PATCH 639/789] add Leonid to maintainers --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index b3b9e1cd7..99c580943 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ How to documentation is available in the [wiki](https://github.com/scala/scala-x ## Maintenance status -This library is community-maintained. The lead maintainer is [@aaron_s_hawley](https://github.com/ashawley). +This library is community-maintained. Maintainers with merge rights include [@aaron_s_hawley](https://github.com/ashawley) and [@dubinsky](https://github.com/dubinsky). Contributors are welcome, and should read the [contributor guide](https://github.com/scala/scala-xml/wiki/Contributor-guide) on the wiki. From 30fc3ad1c1a9434b8ad14718b84b10eb1882f059 Mon Sep 17 00:00:00 2001 From: Seth Tisue Date: Thu, 26 Jan 2023 13:35:09 -0800 Subject: [PATCH 640/789] remove security section from readme since #17 is considered fixed, we have more secure defaults now --- README.md | 4 ---- 1 file changed, 4 deletions(-) diff --git a/README.md b/README.md index 99c580943..d48869070 100644 --- a/README.md +++ b/README.md @@ -26,10 +26,6 @@ here, but not all of them. Community assistance identifying and migrating still-relevant issues is welcome. See [this page](https://github.com/scala/scala-xml/issues/62) for details. -## Security best practices - -The XML spec has some features that are best turned off, to avoid unsavory things like file system access, DoS attacks,... Issue [#17](https://github.com/scala/scala-xml/issues/17) tracks the recommended way of configuring the XML parser used by scala-xml to avoid these. This is by no means an exhaustive list. We'll be happy to incorporate your suggestions -- just comment on the ticket! - ## Related projects - [Advxml](https://github.com/geirolz/advxml) - Functional library combining scala-xml with cats-core From dbb1aa8172fd787530fe0f26b5e7191925e4d0f6 Mon Sep 17 00:00:00 2001 From: Seth Tisue Date: Thu, 26 Jan 2023 13:37:52 -0800 Subject: [PATCH 641/789] minor readme tweaks --- README.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index d48869070..10f310d2a 100644 --- a/README.md +++ b/README.md @@ -5,23 +5,23 @@ scala-xml [![Gitter](https://badges.gitter.im/Join+Chat.svg)](https://gitter.im/scala/scala-xml) ========= -The standard Scala XML library. Please file XML issues here, not at https://github.com/scala/bug/issues. +The standard Scala XML library. Please file XML issues here, not at https://github.com/scala/bug/issues or http://github.com/lampepfl/dotty/issues. -The decoupling of scala-xml from the Scala compiler and standard library is possible because the compiler desugars XML literals in Scala source code into a set of method calls. Alternative implementations of these calls are welcome! (The calls are unfortunately only defined by the [implementation](https://github.com/scala/scala/blob/2.11.x/src/compiler/scala/tools/nsc/ast/parser/SymbolicXMLBuilder.scala).) +The decoupling of scala-xml from the Scala compiler and standard library is possible because the compiler desugars XML literals in Scala source code into a set of method calls. Alternative implementations of these calls are welcome! (This [implementation](https://github.com/scala/scala/blob/2.11.x/src/compiler/scala/tools/nsc/ast/parser/SymbolicXMLBuilder.scala) shows the calls needed.) API documentation is available [here](https://javadoc.io/doc/org.scala-lang.modules/scala-xml_2.13/). -How to documentation is available in the [wiki](https://github.com/scala/scala-xml/wiki) +How-to documentation is available in the [wiki](https://github.com/scala/scala-xml/wiki) ## Maintenance status This library is community-maintained. Maintainers with merge rights include [@aaron_s_hawley](https://github.com/ashawley) and [@dubinsky](https://github.com/dubinsky). -Contributors are welcome, and should read the [contributor guide](https://github.com/scala/scala-xml/wiki/Contributor-guide) on the wiki. +Contributors are welcome. Please consult the [contributor guide](https://github.com/scala/scala-xml/wiki/Contributor-guide) on the wiki. ## Issues -Many old issues from the Scala JIRA issue tracker have been migrated +Some old issues from the Scala issue tracker have been migrated here, but not all of them. Community assistance identifying and migrating still-relevant issues is welcome. See [this page](https://github.com/scala/scala-xml/issues/62) for details. From 21fe99ea4c4e37c68728e18f9dd3234be6d65209 Mon Sep 17 00:00:00 2001 From: Leonid Dubinsky Date: Thu, 26 Jan 2023 23:40:19 -0500 Subject: [PATCH 642/789] Add missing `override`s. --- jvm/src/test/scala/scala/xml/XMLTest.scala | 6 +-- .../xml/parsing/ConstructingParserTest.scala | 6 +-- .../scala/xml/ScalaVersionSpecific.scala | 4 +- shared/src/main/scala/scala/xml/Atom.scala | 4 +- .../src/main/scala/scala/xml/Attribute.scala | 24 +++++----- shared/src/main/scala/scala/xml/Comment.scala | 2 +- .../src/main/scala/scala/xml/Document.scala | 2 +- shared/src/main/scala/scala/xml/Elem.scala | 4 +- .../src/main/scala/scala/xml/EntityRef.scala | 2 +- shared/src/main/scala/scala/xml/Group.scala | 2 +- .../src/main/scala/scala/xml/MetaData.scala | 2 +- .../scala/scala/xml/NamespaceBinding.scala | 2 +- shared/src/main/scala/scala/xml/Node.scala | 2 +- shared/src/main/scala/scala/xml/NodeSeq.scala | 8 ++-- shared/src/main/scala/scala/xml/Null.scala | 22 +++++----- .../scala/scala/xml/PrefixedAttribute.scala | 16 +++---- .../src/main/scala/scala/xml/ProcInstr.scala | 2 +- .../main/scala/scala/xml/SpecialNode.scala | 2 +- .../scala/scala/xml/UnprefixedAttribute.scala | 16 +++---- .../scala/scala/xml/dtd/ContentModel.scala | 8 ++-- .../main/scala/scala/xml/dtd/ExternalID.scala | 10 ++--- .../main/scala/scala/xml/dtd/impl/Base.scala | 10 ++--- .../xml/dtd/impl/SubsetConstruction.scala | 8 ++-- .../scala/xml/dtd/impl/WordBerrySethi.scala | 10 ++--- .../scala/scala/xml/dtd/impl/WordExp.scala | 6 +-- .../scala/xml/include/sax/XIncluder.scala | 36 +++++++-------- .../xml/parsing/ConstructingHandler.scala | 10 ++--- .../xml/parsing/ConstructingParser.scala | 2 +- .../xml/parsing/DefaultMarkupHandler.scala | 10 ++--- .../scala/xml/parsing/MarkupParser.scala | 44 +++++++++---------- .../scala/scala/xml/parsing/XhtmlParser.scala | 4 +- .../xml/transform/BasicTransformer.scala | 2 +- .../src/test/scala/scala/xml/Properties.scala | 4 +- 33 files changed, 146 insertions(+), 146 deletions(-) diff --git a/jvm/src/test/scala/scala/xml/XMLTest.scala b/jvm/src/test/scala/scala/xml/XMLTest.scala index 032b341a6..3363a1fb5 100644 --- a/jvm/src/test/scala/scala/xml/XMLTest.scala +++ b/jvm/src/test/scala/scala/xml/XMLTest.scala @@ -30,10 +30,10 @@ class XMLTestJVM { @UnitTest def equality = { val c = new Node { - def label = "hello" + override def label = "hello" override def hashCode() = Utility.hashCode(prefix, label, this.attributes.hashCode(), scope.hashCode(), child) - def child = Elem(null, "world", e, sc) + override def child = Elem(null, "world", e, sc) //def attributes = e override def text = "" } @@ -792,7 +792,7 @@ class XMLTestJVM { } def toSource(s: String) = new scala.io.Source { - val iter = s.iterator + override val iter = s.iterator override def reportError(pos: Int, msg: String, out: java.io.PrintStream = Console.err): Unit = {} } diff --git a/jvm/src/test/scala/scala/xml/parsing/ConstructingParserTest.scala b/jvm/src/test/scala/scala/xml/parsing/ConstructingParserTest.scala index fb8590d00..4b8e60375 100644 --- a/jvm/src/test/scala/scala/xml/parsing/ConstructingParserTest.scala +++ b/jvm/src/test/scala/scala/xml/parsing/ConstructingParserTest.scala @@ -12,7 +12,7 @@ class ConstructingParserTest { def t9060 = { val a = """""" val source = new Source { - val iter = a.iterator + override val iter = a.iterator override def reportError(pos: Int, msg: String, out: java.io.PrintStream = Console.err) = {} } val doc = ConstructingParser.fromSource(source, false).content(TopScope) @@ -42,7 +42,7 @@ class ConstructingParserTest { val source = new Source { - val iter = xml.iterator + override val iter = xml.iterator override def reportError(pos: Int, msg: String, out: java.io.PrintStream = Console.err) = {} } @@ -65,7 +65,7 @@ class ConstructingParserTest { |""".stripMargin val source = new Source { - val iter = xml.iterator + override val iter = xml.iterator override def reportError(pos: Int, msg: String, out: java.io.PrintStream = Console.err) = {} } diff --git a/shared/src/main/scala-2.13-/scala/xml/ScalaVersionSpecific.scala b/shared/src/main/scala-2.13-/scala/xml/ScalaVersionSpecific.scala index af7daf769..4a2d66f2a 100644 --- a/shared/src/main/scala-2.13-/scala/xml/ScalaVersionSpecific.scala +++ b/shared/src/main/scala-2.13-/scala/xml/ScalaVersionSpecific.scala @@ -19,8 +19,8 @@ private[xml] object ScalaVersionSpecific { import NodeSeq.Coll type CBF[-From, -A, +C] = CanBuildFrom[From, A, C] object NodeSeqCBF extends CanBuildFrom[Coll, Node, NodeSeq] { - def apply(from: Coll) = NodeSeq.newBuilder - def apply() = NodeSeq.newBuilder + override def apply(from: Coll) = NodeSeq.newBuilder + override def apply() = NodeSeq.newBuilder } } diff --git a/shared/src/main/scala/scala/xml/Atom.scala b/shared/src/main/scala/scala/xml/Atom.scala index 89f805c28..98eaeb3d8 100644 --- a/shared/src/main/scala/scala/xml/Atom.scala +++ b/shared/src/main/scala/scala/xml/Atom.scala @@ -41,13 +41,13 @@ class Atom[+A](val data: A) extends SpecialNode with Serializable { final override def doCollectNamespaces = false final override def doTransform = false - def label = "#PCDATA" + override def label = "#PCDATA" /** * Returns text, with some characters escaped according to the XML * specification. */ - def buildString(sb: StringBuilder): StringBuilder = + override def buildString(sb: StringBuilder): StringBuilder = Utility.escape(data.toString, sb) override def text: String = data.toString diff --git a/shared/src/main/scala/scala/xml/Attribute.scala b/shared/src/main/scala/scala/xml/Attribute.scala index f2506d193..62e60ab79 100644 --- a/shared/src/main/scala/scala/xml/Attribute.scala +++ b/shared/src/main/scala/scala/xml/Attribute.scala @@ -55,27 +55,27 @@ object Attribute { */ trait Attribute extends MetaData { def pre: String // will be null if unprefixed - val key: String - val value: Seq[Node] - val next: MetaData + override val key: String + override val value: Seq[Node] + override val next: MetaData - def apply(key: String): Seq[Node] - def apply(namespace: String, scope: NamespaceBinding, key: String): Seq[Node] - def copy(next: MetaData): Attribute + override def apply(key: String): Seq[Node] + override def apply(namespace: String, scope: NamespaceBinding, key: String): Seq[Node] + override def copy(next: MetaData): Attribute - def remove(key: String) = + override def remove(key: String) = if (!isPrefixed && this.key == key) next else copy(next remove key) - def remove(namespace: String, scope: NamespaceBinding, key: String) = + override def remove(namespace: String, scope: NamespaceBinding, key: String) = if (this.key == key && (scope getURI pre) == namespace) next else copy(next.remove(namespace, scope, key)) - def isPrefixed: Boolean = pre != null + override def isPrefixed: Boolean = pre != null - def getNamespace(owner: Node): String + override def getNamespace(owner: Node): String - def wellformed(scope: NamespaceBinding): Boolean = { + override def wellformed(scope: NamespaceBinding): Boolean = { val arg = if (isPrefixed) scope getURI pre else null (next(arg, scope, key) == null) && (next wellformed scope) } @@ -94,7 +94,7 @@ trait Attribute extends MetaData { /** * Appends string representation of only this attribute to stringbuffer. */ - protected def toString1(sb: StringBuilder): Unit = { + override protected def toString1(sb: StringBuilder): Unit = { if (value == null) return if (isPrefixed) diff --git a/shared/src/main/scala/scala/xml/Comment.scala b/shared/src/main/scala/scala/xml/Comment.scala index 6a80c20cb..05a39d217 100644 --- a/shared/src/main/scala/scala/xml/Comment.scala +++ b/shared/src/main/scala/scala/xml/Comment.scala @@ -23,7 +23,7 @@ package xml */ case class Comment(commentText: String) extends SpecialNode { - def label = "#REM" + override def label = "#REM" override def text = "" final override def doCollectNamespaces = false final override def doTransform = false diff --git a/shared/src/main/scala/scala/xml/Document.scala b/shared/src/main/scala/scala/xml/Document.scala index 5ea235bf7..0ff3ad2d8 100644 --- a/shared/src/main/scala/scala/xml/Document.scala +++ b/shared/src/main/scala/scala/xml/Document.scala @@ -96,7 +96,7 @@ class Document extends NodeSeq with Serializable { // methods for NodeSeq - def theSeq: Seq[Node] = this.docElem + override def theSeq: Seq[Node] = this.docElem override def canEqual(other: Any) = other match { case _: Document => true diff --git a/shared/src/main/scala/scala/xml/Elem.scala b/shared/src/main/scala/scala/xml/Elem.scala index 630aeb16f..20feb40a9 100755 --- a/shared/src/main/scala/scala/xml/Elem.scala +++ b/shared/src/main/scala/scala/xml/Elem.scala @@ -53,11 +53,11 @@ object Elem { */ class Elem( override val prefix: String, - val label: String, + override val label: String, attributes1: MetaData, override val scope: NamespaceBinding, val minimizeEmpty: Boolean, - val child: Node* + override val child: Node* ) extends Node with Serializable { final override def doCollectNamespaces = true diff --git a/shared/src/main/scala/scala/xml/EntityRef.scala b/shared/src/main/scala/scala/xml/EntityRef.scala index 1e94db5fd..17eb0543d 100644 --- a/shared/src/main/scala/scala/xml/EntityRef.scala +++ b/shared/src/main/scala/scala/xml/EntityRef.scala @@ -22,7 +22,7 @@ package xml case class EntityRef(entityName: String) extends SpecialNode { final override def doCollectNamespaces = false final override def doTransform = false - def label = "#ENTITY" + override def label = "#ENTITY" override def text = entityName match { case "lt" => "<" diff --git a/shared/src/main/scala/scala/xml/Group.scala b/shared/src/main/scala/scala/xml/Group.scala index a53b0f681..9ad9f6ff1 100644 --- a/shared/src/main/scala/scala/xml/Group.scala +++ b/shared/src/main/scala/scala/xml/Group.scala @@ -41,7 +41,7 @@ final case class Group(nodes: Seq[Node]) extends Node { */ private def fail(msg: String) = throw new UnsupportedOperationException("class Group does not support method '%s'" format msg) - def label = fail("label") + override def label = fail("label") override def attributes = fail("attributes") override def namespace = fail("namespace") override def child = fail("child") diff --git a/shared/src/main/scala/scala/xml/MetaData.scala b/shared/src/main/scala/scala/xml/MetaData.scala index 46ef8c62b..06470c299 100644 --- a/shared/src/main/scala/scala/xml/MetaData.scala +++ b/shared/src/main/scala/scala/xml/MetaData.scala @@ -150,7 +150,7 @@ abstract class MetaData case m: MetaData => this.asAttrMap == m.asAttrMap case _ => false } - protected def basisForHashCode: Seq[Any] = List(this.asAttrMap) + override protected def basisForHashCode: Seq[Any] = List(this.asAttrMap) /** filters this sequence of meta data */ override def filter(f: MetaData => Boolean): MetaData = diff --git a/shared/src/main/scala/scala/xml/NamespaceBinding.scala b/shared/src/main/scala/scala/xml/NamespaceBinding.scala index 94caeb238..030358b9d 100644 --- a/shared/src/main/scala/scala/xml/NamespaceBinding.scala +++ b/shared/src/main/scala/scala/xml/NamespaceBinding.scala @@ -68,7 +68,7 @@ case class NamespaceBinding(prefix: String, uri: String, parent: NamespaceBindin case _ => false } - def basisForHashCode: Seq[Any] = List(prefix, uri, parent) + override def basisForHashCode: Seq[Any] = List(prefix, uri, parent) def buildString(stop: NamespaceBinding): String = sbToString(buildString(_, stop)) diff --git a/shared/src/main/scala/scala/xml/Node.scala b/shared/src/main/scala/scala/xml/Node.scala index d1a34338b..6e68a084d 100755 --- a/shared/src/main/scala/scala/xml/Node.scala +++ b/shared/src/main/scala/scala/xml/Node.scala @@ -165,7 +165,7 @@ abstract class Node extends NodeSeq { /** * returns a sequence consisting of only this node */ - def theSeq: Seq[Node] = this :: Nil + override def theSeq: Seq[Node] = this :: Nil /** * String representation of this node diff --git a/shared/src/main/scala/scala/xml/NodeSeq.scala b/shared/src/main/scala/scala/xml/NodeSeq.scala index 4ccbab390..fe16be05a 100644 --- a/shared/src/main/scala/scala/xml/NodeSeq.scala +++ b/shared/src/main/scala/scala/xml/NodeSeq.scala @@ -27,7 +27,7 @@ import scala.collection.Seq object NodeSeq { final val Empty = fromSeq(Nil) def fromSeq(s: Seq[Node]): NodeSeq = new NodeSeq { - def theSeq = s + override def theSeq = s } // --- @@ -50,10 +50,10 @@ object NodeSeq { */ abstract class NodeSeq extends AbstractSeq[Node] with immutable.Seq[Node] with ScalaVersionSpecificNodeSeq with Equality with Serializable { def theSeq: Seq[Node] - def length = theSeq.length + override def length = theSeq.length override def iterator = theSeq.iterator - def apply(i: Int): Node = theSeq(i) + override def apply(i: Int): Node = theSeq(i) def apply(f: Node => Boolean): NodeSeq = filter(f) def xml_sameElements[A](that: Iterable[A]): Boolean = { @@ -66,7 +66,7 @@ abstract class NodeSeq extends AbstractSeq[Node] with immutable.Seq[Node] with S !these.hasNext && !those.hasNext } - protected def basisForHashCode: Seq[Any] = theSeq + override protected def basisForHashCode: Seq[Any] = theSeq override def canEqual(other: Any) = other match { case _: NodeSeq => true diff --git a/shared/src/main/scala/scala/xml/Null.scala b/shared/src/main/scala/scala/xml/Null.scala index b98965910..3800f185f 100644 --- a/shared/src/main/scala/scala/xml/Null.scala +++ b/shared/src/main/scala/scala/xml/Null.scala @@ -30,14 +30,14 @@ case object Null extends MetaData { override def append(m: MetaData, scope: NamespaceBinding = TopScope): MetaData = m override def filter(f: MetaData => Boolean): MetaData = this - def copy(next: MetaData) = next - def getNamespace(owner: Node) = null + override def copy(next: MetaData) = next + override def getNamespace(owner: Node) = null override def hasNext = false - def next = null - def key = null - def value = null - def isPrefixed = false + override def next = null + override def key = null + override def value = null + override def isPrefixed = false override def length = 0 override def length(i: Int) = i @@ -48,12 +48,12 @@ case object Null extends MetaData { } override protected def basisForHashCode: Seq[Any] = Nil - def apply(namespace: String, scope: NamespaceBinding, key: String) = null - def apply(key: String) = + override def apply(namespace: String, scope: NamespaceBinding, key: String) = null + override def apply(key: String) = if (isNameStart(key.head)) null else throw new IllegalArgumentException("not a valid attribute name '" + key + "', so can never match !") - protected def toString1(sb: StringBuilder) = () + override protected def toString1(sb: StringBuilder) = () override protected def toString1(): String = "" override def toString(): String = "" @@ -62,6 +62,6 @@ case object Null extends MetaData { override def wellformed(scope: NamespaceBinding) = true - def remove(key: String) = this - def remove(namespace: String, scope: NamespaceBinding, key: String) = this + override def remove(key: String) = this + override def remove(namespace: String, scope: NamespaceBinding, key: String) = this } diff --git a/shared/src/main/scala/scala/xml/PrefixedAttribute.scala b/shared/src/main/scala/scala/xml/PrefixedAttribute.scala index 56c5a66ed..eddea4156 100644 --- a/shared/src/main/scala/scala/xml/PrefixedAttribute.scala +++ b/shared/src/main/scala/scala/xml/PrefixedAttribute.scala @@ -24,12 +24,12 @@ import scala.collection.Seq * @param next1 */ class PrefixedAttribute( - val pre: String, - val key: String, - val value: Seq[Node], + override val pre: String, + override val key: String, + override val value: Seq[Node], val next1: MetaData) extends Attribute { - val next = if (value ne null) next1 else next1.remove(key) + override val next = if (value ne null) next1 else next1.remove(key) /** same as this(pre, key, Text(value), next), or no attribute if value is null */ def this(pre: String, key: String, value: String, next: MetaData) = @@ -43,19 +43,19 @@ class PrefixedAttribute( * Returns a copy of this unprefixed attribute with the given * next field. */ - def copy(next: MetaData) = + override def copy(next: MetaData) = new PrefixedAttribute(pre, key, value, next) - def getNamespace(owner: Node) = + override def getNamespace(owner: Node) = owner.getNamespace(pre) /** forwards the call to next (because caller looks for unprefixed attribute */ - def apply(key: String): Seq[Node] = next(key) + override def apply(key: String): Seq[Node] = next(key) /** * gets attribute value of qualified (prefixed) attribute with given key */ - def apply(namespace: String, scope: NamespaceBinding, key: String): Seq[Node] = { + override def apply(namespace: String, scope: NamespaceBinding, key: String): Seq[Node] = { if (key == this.key && scope.getURI(pre) == namespace) value else diff --git a/shared/src/main/scala/scala/xml/ProcInstr.scala b/shared/src/main/scala/scala/xml/ProcInstr.scala index 04970a229..1d67825dd 100644 --- a/shared/src/main/scala/scala/xml/ProcInstr.scala +++ b/shared/src/main/scala/scala/xml/ProcInstr.scala @@ -31,7 +31,7 @@ case class ProcInstr(target: String, proctext: String) extends SpecialNode { final override def doCollectNamespaces = false final override def doTransform = false - final def label = "#PI" + final override def label = "#PI" override def text = "" /** diff --git a/shared/src/main/scala/scala/xml/SpecialNode.scala b/shared/src/main/scala/scala/xml/SpecialNode.scala index 775983b14..b10ce16d7 100644 --- a/shared/src/main/scala/scala/xml/SpecialNode.scala +++ b/shared/src/main/scala/scala/xml/SpecialNode.scala @@ -28,7 +28,7 @@ abstract class SpecialNode extends Node { final override def namespace = null /** always empty */ - final def child = Nil + final override def child = Nil /** Append string representation to the given string buffer argument. */ def buildString(sb: StringBuilder): StringBuilder diff --git a/shared/src/main/scala/scala/xml/UnprefixedAttribute.scala b/shared/src/main/scala/scala/xml/UnprefixedAttribute.scala index d3b0c6796..9a7b71be2 100644 --- a/shared/src/main/scala/scala/xml/UnprefixedAttribute.scala +++ b/shared/src/main/scala/scala/xml/UnprefixedAttribute.scala @@ -21,12 +21,12 @@ import scala.collection.Seq * @author Burak Emir */ class UnprefixedAttribute( - val key: String, - val value: Seq[Node], + override val key: String, + override val value: Seq[Node], next1: MetaData) extends Attribute { - final val pre = null - val next = if (value ne null) next1 else next1.remove(key) + final override val pre = null + override val next = if (value ne null) next1 else next1.remove(key) /** same as this(key, Text(value), next), or no attribute if value is null */ def this(key: String, value: String, next: MetaData) = @@ -37,9 +37,9 @@ class UnprefixedAttribute( this(key, value.orNull, next) /** returns a copy of this unprefixed attribute with the given next field*/ - def copy(next: MetaData) = new UnprefixedAttribute(key, value, next) + override def copy(next: MetaData) = new UnprefixedAttribute(key, value, next) - final def getNamespace(owner: Node): String = null + final override def getNamespace(owner: Node): String = null /** * Gets value of unqualified (unprefixed) attribute with given key, null if not found @@ -47,7 +47,7 @@ class UnprefixedAttribute( * @param key * @return value as Seq[Node] if key is found, null otherwise */ - def apply(key: String): Seq[Node] = + override def apply(key: String): Seq[Node] = if (key == this.key) value else next(key) /** @@ -58,7 +58,7 @@ class UnprefixedAttribute( * @param key * @return .. */ - def apply(namespace: String, scope: NamespaceBinding, key: String): Seq[Node] = + override def apply(namespace: String, scope: NamespaceBinding, key: String): Seq[Node] = next(namespace, scope, key) } object UnprefixedAttribute { diff --git a/shared/src/main/scala/scala/xml/dtd/ContentModel.scala b/shared/src/main/scala/scala/xml/dtd/ContentModel.scala index 6910f13a7..2f8506b8e 100644 --- a/shared/src/main/scala/scala/xml/dtd/ContentModel.scala +++ b/shared/src/main/scala/scala/xml/dtd/ContentModel.scala @@ -28,8 +28,8 @@ object ContentModelLaundry extends ContentModelLaundry { object ContentModel extends WordExp { - type _labelT = ElemName - type _regexpT = RegExp + override type _labelT = ElemName + override type _regexpT = RegExp @deprecated("Avoidance", since="2.10") trait Translator extends WordBerrySethi @@ -114,7 +114,7 @@ sealed abstract class DFAContentModel extends ContentModel { } } -case class MIXED(r: RegExp) extends DFAContentModel { +case class MIXED(override val r: RegExp) extends DFAContentModel { import ContentModel.Alt override def buildString(sb: StringBuilder): StringBuilder = { @@ -126,7 +126,7 @@ case class MIXED(r: RegExp) extends DFAContentModel { } } -case class ELEMENTS(r: RegExp) extends DFAContentModel { +case class ELEMENTS(override val r: RegExp) extends DFAContentModel { override def buildString(sb: StringBuilder): StringBuilder = ContentModel.buildString(r, sb) } diff --git a/shared/src/main/scala/scala/xml/dtd/ExternalID.scala b/shared/src/main/scala/scala/xml/dtd/ExternalID.scala index 467430256..7344e4034 100644 --- a/shared/src/main/scala/scala/xml/dtd/ExternalID.scala +++ b/shared/src/main/scala/scala/xml/dtd/ExternalID.scala @@ -48,8 +48,8 @@ sealed abstract class ExternalID extends parsing.TokenTests { * @author Burak Emir * @param systemId the system identifier literal */ -case class SystemID(systemId: String) extends ExternalID { - val publicId = null +case class SystemID(override val systemId: String) extends ExternalID { + override val publicId = null if (!checkSysID(systemId)) throw new IllegalArgumentException("can't use both \" and ' in systemId") @@ -62,7 +62,7 @@ case class SystemID(systemId: String) extends ExternalID { * @param publicId the public identifier literal * @param systemId (can be null for notation pubIDs) the system identifier literal */ -case class PublicID(publicId: String, systemId: String) extends ExternalID { +case class PublicID(override val publicId: String, override val systemId: String) extends ExternalID { if (!checkPubID(publicId)) throw new IllegalArgumentException("publicId must consist of PubidChars") @@ -85,8 +85,8 @@ case class PublicID(publicId: String, systemId: String) extends ExternalID { * @author Michael Bayne */ object NoExternalID extends ExternalID { - val publicId = null - val systemId = null + override val publicId = null + override val systemId = null override def toString = "" } diff --git a/shared/src/main/scala/scala/xml/dtd/impl/Base.scala b/shared/src/main/scala/scala/xml/dtd/impl/Base.scala index bb5f18329..4dffb7830 100644 --- a/shared/src/main/scala/scala/xml/dtd/impl/Base.scala +++ b/shared/src/main/scala/scala/xml/dtd/impl/Base.scala @@ -38,7 +38,7 @@ private[dtd] abstract class Base { } class Alt private (val rs: _regexpT*) extends RegExp { - final val isNullable = rs exists (_.isNullable) + final override val isNullable = rs exists (_.isNullable) } object Sequ { @@ -48,22 +48,22 @@ private[dtd] abstract class Base { } class Sequ private (val rs: _regexpT*) extends RegExp { - final val isNullable = rs forall (_.isNullable) + final override val isNullable = rs forall (_.isNullable) } case class Star(r: _regexpT) extends RegExp { - final lazy val isNullable = true + final override lazy val isNullable = true } // The empty Sequ. case object Eps extends RegExp { - final lazy val isNullable = true + final override lazy val isNullable = true override def toString = "Eps" } /** this class can be used to add meta information to regexps. */ class Meta(r1: _regexpT) extends RegExp { - final val isNullable = r1.isNullable + final override val isNullable = r1.isNullable def r = r1 } } diff --git a/shared/src/main/scala/scala/xml/dtd/impl/SubsetConstruction.scala b/shared/src/main/scala/scala/xml/dtd/impl/SubsetConstruction.scala index e413101fb..38c570223 100644 --- a/shared/src/main/scala/scala/xml/dtd/impl/SubsetConstruction.scala +++ b/shared/src/main/scala/scala/xml/dtd/impl/SubsetConstruction.scala @@ -104,10 +104,10 @@ private[dtd] class SubsetConstruction[T <: AnyRef](val nfa: NondetWordAutom[T]) finals foreach { case (k, v) => finalsR(indexMap(k)) = v } new DetWordAutom[T] { - val nstates = nstatesR - val delta = deltaR - val default = defaultR - val finals = finalsR + override val nstates = nstatesR + override val delta = deltaR + override val default = defaultR + override val finals = finalsR } } } diff --git a/shared/src/main/scala/scala/xml/dtd/impl/WordBerrySethi.scala b/shared/src/main/scala/scala/xml/dtd/impl/WordBerrySethi.scala index 58c3a7783..19a5880df 100644 --- a/shared/src/main/scala/scala/xml/dtd/impl/WordBerrySethi.scala +++ b/shared/src/main/scala/scala/xml/dtd/impl/WordBerrySethi.scala @@ -159,11 +159,11 @@ private[dtd] abstract class WordBerrySethi extends BaseBerrySethi { val defaultArr = (0 until pos map (k => immutable.BitSet(defaultq(k): _*))).toArray new NondetWordAutom[_labelT] { - val nstates = pos - val labels = WordBerrySethi.this.labels.toList - val finals = finalsArr - val delta = deltaArr - val default = defaultArr + override val nstates = pos + override val labels = WordBerrySethi.this.labels.toList + override val finals = finalsArr + override val delta = deltaArr + override val default = defaultArr } case z => automatonFrom(Sequ(z.asInstanceOf[this.lang._regexpT]), finalTag) diff --git a/shared/src/main/scala/scala/xml/dtd/impl/WordExp.scala b/shared/src/main/scala/scala/xml/dtd/impl/WordExp.scala index a34eda9c6..a3974ced1 100644 --- a/shared/src/main/scala/scala/xml/dtd/impl/WordExp.scala +++ b/shared/src/main/scala/scala/xml/dtd/impl/WordExp.scala @@ -45,16 +45,16 @@ private[dtd] abstract class WordExp extends Base { abstract class Label - type _regexpT <: RegExp + override type _regexpT <: RegExp type _labelT <: Label case class Letter(a: _labelT) extends RegExp { - final lazy val isNullable = false + final override lazy val isNullable = false var pos = -1 } case class Wildcard() extends RegExp { - final lazy val isNullable = false + final override lazy val isNullable = false var pos = -1 } } diff --git a/shared/src/main/scala/scala/xml/include/sax/XIncluder.scala b/shared/src/main/scala/scala/xml/include/sax/XIncluder.scala index 2dcc69b8c..986b14364 100644 --- a/shared/src/main/scala/scala/xml/include/sax/XIncluder.scala +++ b/shared/src/main/scala/scala/xml/include/sax/XIncluder.scala @@ -28,9 +28,9 @@ class XIncluder(outs: OutputStream, encoding: String) extends ContentHandler wit var out = new OutputStreamWriter(outs, encoding) - def setDocumentLocator(locator: Locator): Unit = {} + override def setDocumentLocator(locator: Locator): Unit = {} - def startDocument(): Unit = { + override def startDocument(): Unit = { try { out.write("\r\n") @@ -40,7 +40,7 @@ class XIncluder(outs: OutputStream, encoding: String) extends ContentHandler wit } } - def endDocument(): Unit = { + override def endDocument(): Unit = { try { out.flush() } catch { @@ -49,11 +49,11 @@ class XIncluder(outs: OutputStream, encoding: String) extends ContentHandler wit } } - def startPrefixMapping(prefix: String, uri: String): Unit = {} + override def startPrefixMapping(prefix: String, uri: String): Unit = {} - def endPrefixMapping(prefix: String): Unit = {} + override def endPrefixMapping(prefix: String): Unit = {} - def startElement(namespaceURI: String, localName: String, qualifiedName: String, atts: Attributes) = { + override def startElement(namespaceURI: String, localName: String, qualifiedName: String, atts: Attributes) = { try { out.write("<" + qualifiedName) var i = 0; while (i < atts.getLength) { @@ -74,7 +74,7 @@ class XIncluder(outs: OutputStream, encoding: String) extends ContentHandler wit } } - def endElement(namespaceURI: String, localName: String, qualifiedName: String): Unit = { + override def endElement(namespaceURI: String, localName: String, qualifiedName: String): Unit = { try { out.write("") } catch { @@ -85,7 +85,7 @@ class XIncluder(outs: OutputStream, encoding: String) extends ContentHandler wit // need to escape characters that are not in the given // encoding using character references???? - def characters(ch: Array[Char], start: Int, length: Int): Unit = { + override def characters(ch: Array[Char], start: Int, length: Int): Unit = { try { var i = 0; while (i < length) { val c = ch(start + i) @@ -104,12 +104,12 @@ class XIncluder(outs: OutputStream, encoding: String) extends ContentHandler wit } } - def ignorableWhitespace(ch: Array[Char], start: Int, length: Int): Unit = { + override def ignorableWhitespace(ch: Array[Char], start: Int, length: Int): Unit = { this.characters(ch, start, length) } // do I need to escape text in PI???? - def processingInstruction(target: String, data: String): Unit = { + override def processingInstruction(target: String, data: String): Unit = { try { out.write("") } catch { @@ -118,7 +118,7 @@ class XIncluder(outs: OutputStream, encoding: String) extends ContentHandler wit } } - def skippedEntity(name: String): Unit = { + override def skippedEntity(name: String): Unit = { try { out.write("&" + name + ";") } catch { @@ -131,7 +131,7 @@ class XIncluder(outs: OutputStream, encoding: String) extends ContentHandler wit private var inDTD: Boolean = false private var entities = List.empty[String] - def startDTD(name: String, publicID: String, systemID: String): Unit = { + override def startDTD(name: String, publicID: String, systemID: String): Unit = { inDTD = true // if this is the source document, output a DOCTYPE declaration if (entities.isEmpty) { @@ -146,18 +146,18 @@ class XIncluder(outs: OutputStream, encoding: String) extends ContentHandler wit } } } - def endDTD(): Unit = {} + override def endDTD(): Unit = {} - def startEntity(name: String): Unit = { + override def startEntity(name: String): Unit = { entities = name :: entities } - def endEntity(name: String): Unit = { + override def endEntity(name: String): Unit = { entities = entities.tail } - def startCDATA(): Unit = {} - def endCDATA(): Unit = {} + override def startCDATA(): Unit = {} + override def endCDATA(): Unit = {} // Just need this reference so we can ask if a comment is // inside an include element or not @@ -167,7 +167,7 @@ class XIncluder(outs: OutputStream, encoding: String) extends ContentHandler wit this.filter = filter } - def comment(ch: Array[Char], start: Int, length: Int): Unit = { + override def comment(ch: Array[Char], start: Int, length: Int): Unit = { if (!inDTD && !filter.insideIncludeElement()) { try { out.write("") @@ -92,7 +92,7 @@ class XMLTestJVM2x { } @UnitTest - def t9027: Unit = { + def t9027(): Unit = { // used to be parsed as .println import reflect.runtime._, universe._ diff --git a/jvm/src/test/scala/scala/xml/AttributeTest.scala b/jvm/src/test/scala/scala/xml/AttributeTest.scala index 11511d1d0..24046ec5c 100644 --- a/jvm/src/test/scala/scala/xml/AttributeTest.scala +++ b/jvm/src/test/scala/scala/xml/AttributeTest.scala @@ -7,31 +7,31 @@ import org.junit.Assert.assertNotEquals class AttributeTestJVM { @Test - def attributeOrder: Unit = { - val x = + def attributeOrder(): Unit = { + val x: Elem = assertEquals("""""", x.toString) } @Test - def attributesFromString: Unit = { - val str = """""" - val doc = XML.loadString(str) + def attributesFromString(): Unit = { + val str: String = """""" + val doc: Elem = XML.loadString(str) assertEquals(str, doc.toString) } @Test - def attributesAndNamespaceFromString: Unit = { - val str = """""" - val doc = XML.loadString(str) + def attributesAndNamespaceFromString(): Unit = { + val str: String = """""" + val doc: Elem = XML.loadString(str) assertNotEquals(str, doc.toString) - val str2 = """""" - val doc2 = XML.loadString(str2) + val str2: String = """""" + val doc2: Elem = XML.loadString(str2) assertEquals(str2, doc2.toString) } @Test(expected=classOf[SAXParseException]) - def attributesFromStringWithDuplicate: Unit = { - val str = """""" + def attributesFromStringWithDuplicate(): Unit = { + val str: String = """""" XML.loadString(str) } } diff --git a/jvm/src/test/scala/scala/xml/BillionLaughsAttackTest.scala b/jvm/src/test/scala/scala/xml/BillionLaughsAttackTest.scala index 88e1e99b2..434ab86a3 100644 --- a/jvm/src/test/scala/scala/xml/BillionLaughsAttackTest.scala +++ b/jvm/src/test/scala/scala/xml/BillionLaughsAttackTest.scala @@ -10,12 +10,12 @@ class BillionLaughsAttackTest { * this is the limit imposed by the JDK. */ @Test(expected=classOf[org.xml.sax.SAXParseException]) - def lolzTest: Unit = { + def lolzTest(): Unit = { XML.loadString(lolz) } // Copied from https://msdn.microsoft.com/en-us/magazine/ee335713.aspx - val lolz = + val lolz: String = """ | @@ -32,5 +32,4 @@ class BillionLaughsAttackTest { |]> |&lol9; |""".stripMargin - } diff --git a/jvm/src/test/scala/scala/xml/ReuseNodesTest.scala b/jvm/src/test/scala/scala/xml/ReuseNodesTest.scala index 0b0bfd8cb..3adbeb698 100644 --- a/jvm/src/test/scala/scala/xml/ReuseNodesTest.scala +++ b/jvm/src/test/scala/scala/xml/ReuseNodesTest.scala @@ -19,8 +19,8 @@ object ReuseNodesTest { class OriginalTranformr(rules: RewriteRule*) extends RuleTransformer(rules:_*) { override def transform(ns: Seq[Node]): Seq[Node] = { - val xs = ns.toStream map transform - val (xs1, xs2) = xs.zip(ns).span { case (x, n) => unchanged(n, x) } + val xs: Seq[Seq[Node]] = ns.toStream map transform + val (xs1: Seq[(Seq[Node], Node)], xs2: Seq[(Seq[Node], Node)]) = xs.zip(ns).span { case (x, n) => unchanged(n, x) } if (xs2.isEmpty) ns else xs1.map(_._2) ++ xs2.head._1 ++ transform(ns.drop(xs1.length + 1)) @@ -30,7 +30,7 @@ object ReuseNodesTest { class ModifiedTranformr(rules: RewriteRule*) extends RuleTransformer(rules:_*) { override def transform(ns: Seq[Node]): Seq[Node] = { - val changed = ns flatMap transform + val changed: Seq[Node] = ns flatMap transform if (changed.length != ns.length || changed.zip(ns).exists(p => p._1 != p._2)) changed else ns @@ -40,8 +40,8 @@ object ReuseNodesTest { class AlternateTranformr(rules: RewriteRule*) extends RuleTransformer(rules:_*) { override def transform(ns: Seq[Node]): Seq[Node] = { - val xs = ns.toStream.map(transform) - val (xs1, xs2) = xs.zip(ns).span { case (x, n) => unchanged(n, x) } + val xs: Seq[Seq[Node]] = ns.toStream.map(transform) + val (xs1: Seq[(Seq[Node], Node)], xs2: Seq[(Seq[Node], Node)]) = xs.zip(ns).span { case (x, n) => unchanged(n, x) } if (xs2.isEmpty) ns else xs1.map(_._2) ++ xs2.head._1 ++ transform(ns.drop(xs1.length + 1)) @@ -49,7 +49,7 @@ object ReuseNodesTest { override def transform(n: Node): Seq[Node] = super.transform(n) } - def rewriteRule = new RewriteRule { + def rewriteRule: RewriteRule = new RewriteRule { override def transform(n: Node): NodeSeq = n match { case n if n.label == "change" => Elem( n.prefix, "changed", n.attributes, n.scope, n.child.isEmpty, n.child : _*) @@ -58,7 +58,7 @@ object ReuseNodesTest { } @DataPoints - def tranformers() = Array( + def tranformers(): Array[RuleTransformer] = Array( new OriginalTranformr(rewriteRule), new ModifiedTranformr(rewriteRule), new AlternateTranformr(rewriteRule)) @@ -68,16 +68,16 @@ object ReuseNodesTest { class ReuseNodesTest { @Theory - def transformReferentialEquality(rt: RuleTransformer) = { - val original =

- val tranformed = rt.transform(original) + def transformReferentialEquality(rt: RuleTransformer): Unit = { + val original: Elem =

+ val tranformed: Seq[Node] = rt.transform(original) assertSame(original, tranformed) } @Theory - def transformReferentialEqualityOnly(rt: RuleTransformer) = { - val original =
- val transformed = rt.transform(original) + def transformReferentialEqualityOnly(rt: RuleTransformer): Unit = { + val original: Elem = + val transformed: Seq[Node] = rt.transform(original) recursiveAssert(original,transformed) } diff --git a/jvm/src/test/scala/scala/xml/SerializationTest.scala b/jvm/src/test/scala/scala/xml/SerializationTest.scala index 37da4c296..e8c5c8800 100644 --- a/jvm/src/test/scala/scala/xml/SerializationTest.scala +++ b/jvm/src/test/scala/scala/xml/SerializationTest.scala @@ -6,24 +6,24 @@ import org.junit.Test class SerializationTest { @Test - def xmlLiteral: Unit = { - val n = + def xmlLiteral(): Unit = { + val n: Elem = assertEquals(n, JavaByteSerialization.roundTrip(n)) } @Test - def empty: Unit = { + def empty(): Unit = { assertEquals(NodeSeq.Empty, JavaByteSerialization.roundTrip(NodeSeq.Empty)) } @Test - def unmatched: Unit = { + def unmatched(): Unit = { assertEquals(NodeSeq.Empty, JavaByteSerialization.roundTrip( \ "HTML")) } @Test - def implicitConversion: Unit = { - val parent = + def implicitConversion(): Unit = { + val parent: Elem = val children: Seq[Node] = parent.child val asNodeSeq: NodeSeq = children assertEquals(asNodeSeq, JavaByteSerialization.roundTrip(asNodeSeq)) diff --git a/jvm/src/test/scala/scala/xml/XMLSyntaxTest.scala b/jvm/src/test/scala/scala/xml/XMLSyntaxTest.scala index 4225545ee..e3ac914fd 100644 --- a/jvm/src/test/scala/scala/xml/XMLSyntaxTest.scala +++ b/jvm/src/test/scala/scala/xml/XMLSyntaxTest.scala @@ -8,8 +8,8 @@ class XMLSyntaxTestJVM { @Test def test3(): Unit = { // this demonstrates how to handle entities - val s = io.Source.fromString(" ") - object parser extends xml.parsing.ConstructingParser(s, false /*ignore ws*/) { + val s: io.Source = io.Source.fromString(" ") + object parser extends xml.parsing.ConstructingParser(s, preserveWS = false /*ignore ws*/) { override def replacementText(entityName: String): io.Source = { entityName match { case "nbsp" => io.Source.fromString("\u0160") @@ -18,9 +18,8 @@ class XMLSyntaxTestJVM { } nextch() // !!important, to initialize the parser } - val parsed = parser.element(TopScope) // parse the source as element + val parsed: NodeSeq = parser.element(TopScope) // parse the source as element // alternatively, we could call document() assertEquals("Š", parsed.toString) } - } diff --git a/jvm/src/test/scala/scala/xml/XMLTest.scala b/jvm/src/test/scala/scala/xml/XMLTest.scala index 3363a1fb5..a8f4dd826 100644 --- a/jvm/src/test/scala/scala/xml/XMLTest.scala +++ b/jvm/src/test/scala/scala/xml/XMLTest.scala @@ -9,11 +9,13 @@ import org.junit.Assert.assertEquals import java.io.StringWriter import java.io.ByteArrayOutputStream import java.io.StringReader +import scala.xml.dtd.{DocType, PublicID} +import scala.xml.parsing.ConstructingParser import scala.xml.Utility.sort object XMLTestJVM { - val e: scala.xml.MetaData = Null //Node.NoAttributes - val sc: scala.xml.NamespaceBinding = TopScope + val e: MetaData = Null //Node.NoAttributes + val sc: NamespaceBinding = TopScope } class XMLTestJVM { @@ -22,20 +24,20 @@ class XMLTestJVM { def Elem(prefix: String, label: String, attributes: MetaData, scope: NamespaceBinding, child: Node*): Elem = scala.xml.Elem.apply(prefix, label, attributes, scope, minimizeEmpty = true, child: _*) - lazy val parsedxml1 = XML.load(new InputSource(new StringReader(""))) - lazy val parsedxml11 = XML.load(new InputSource(new StringReader(""))) - val xmlFile2 = "Peter BunemanDan SuciuData on ze webJohn MitchellFoundations of Programming Languages" - lazy val parsedxml2 = XML.load(new InputSource(new StringReader(xmlFile2))) + lazy val parsedxml1: Elem = XML.load(new InputSource(new StringReader(""))) + lazy val parsedxml11: Elem = XML.load(new InputSource(new StringReader(""))) + val xmlFile2: String = "Peter BunemanDan SuciuData on ze webJohn MitchellFoundations of Programming Languages" + lazy val parsedxml2: Elem = XML.load(new InputSource(new StringReader(xmlFile2))) @UnitTest - def equality = { - val c = new Node { - override def label = "hello" - override def hashCode() = + def equality(): Unit = { + val c: Node = new Node { + override def label: String = "hello" + override def hashCode(): Int = Utility.hashCode(prefix, label, this.attributes.hashCode(), scope.hashCode(), child) - override def child = Elem(null, "world", e, sc) + override def child: Seq[Node] = Elem(null, "world", e, sc) //def attributes = e - override def text = "" + override def text: String = "" } assertEquals(c, parsedxml11) @@ -43,10 +45,10 @@ class XMLTestJVM { assertTrue(List(parsedxml1) sameElements List(parsedxml11)) assertTrue(Array(parsedxml1).toList sameElements List(parsedxml11)) - val x2 = "Peter BunemanDan SuciuData on ze web" + val x2: String = "Peter BunemanDan SuciuData on ze web" - val i = new InputSource(new StringReader(x2)) - val x2p = scala.xml.XML.load(i) + val i: InputSource = new InputSource(new StringReader(x2)) + val x2p: Elem = XML.load(i) assertEquals(Elem(null, "book", e, sc, Elem(null, "author", e, sc, Text("Peter Buneman")), @@ -56,7 +58,7 @@ class XMLTestJVM { } @UnitTest - def xpath = { + def xpath(): Unit = { assertTrue(parsedxml1 \ "_" sameElements List(Elem(null, "world", e, sc))) assertTrue(parsedxml1 \ "world" sameElements List(Elem(null, "world", e, sc))) @@ -100,7 +102,7 @@ class XMLTestJVM { } @UnitTest - def xpathDESCENDANTS = { + def xpathDESCENDANTS(): Unit = { assertTrue( (parsedxml2 \\ "author") sameElements List( Elem(null, "author", e, sc, Text("Peter Buneman")), @@ -140,34 +142,34 @@ class XMLTestJVM { } @UnitTest - def unparsed = { + def unparsed(): Unit = { // println("attribute value normalization") - val xmlAttrValueNorm = "" + val xmlAttrValueNorm: String = "" { - val isrcA = new InputSource(new StringReader(xmlAttrValueNorm)) - val parsedxmlA = XML.load(isrcA) - val c = (parsedxmlA \ "@nom").text.charAt(0) + val isrcA: InputSource = new InputSource(new StringReader(xmlAttrValueNorm)) + val parsedxmlA: Elem = XML.load(isrcA) + val c: Char = (parsedxmlA \ "@nom").text.charAt(0) assertTrue(c == '\u015e') } // buraq: if the following test fails with 'character x not allowed', it is // related to the mutable variable in a closures in MarkupParser.parsecharref { - val isr = scala.io.Source.fromString(xmlAttrValueNorm) - val pxmlB = scala.xml.parsing.ConstructingParser.fromSource(isr, false) - val parsedxmlB = pxmlB.element(TopScope) - val c = (parsedxmlB \ "@nom").text.charAt(0) + val isr: scala.io.Source = scala.io.Source.fromString(xmlAttrValueNorm) + val pxmlB: ConstructingParser = ConstructingParser.fromSource(isr, preserveWS = false) + val parsedxmlB: NodeSeq = pxmlB.element(TopScope) + val c: Char = (parsedxmlB \ "@nom").text.charAt(0) assertTrue(c == '\u015e') } // #60 test by round trip - val p = scala.xml.parsing.ConstructingParser.fromSource(scala.io.Source.fromString(""), true) - val n = p.element(scala.xml.NamespaceBinding("bar", "BAR", scala.xml.TopScope))(0) + val p: ConstructingParser = ConstructingParser.fromSource(scala.io.Source.fromString(""), preserveWS = true) + val n: Node = p.element(NamespaceBinding("bar", "BAR", TopScope))(0) assertTrue(n.attributes.get("BAR", n, "attr").nonEmpty) } - def f(s: String) = { + def f(s: String): Elem = { { for (item <- s split ',') yield { item } @@ -176,7 +178,7 @@ class XMLTestJVM { } @UnitTest - def nodeBuffer = + def nodeBuffer(): Unit = assertEquals( """ abc @@ -185,8 +187,8 @@ class XMLTestJVM { object Serialize { @throws(classOf[java.io.IOException]) def write[A](o: A): Array[Byte] = { - val ba = new ByteArrayOutputStream(512) - val out = new java.io.ObjectOutputStream(ba) + val ba: ByteArrayOutputStream = new ByteArrayOutputStream(512) + val out: java.io.ObjectOutputStream = new java.io.ObjectOutputStream(ba) out.writeObject(o) out.close() ba.toByteArray @@ -194,7 +196,7 @@ class XMLTestJVM { @throws(classOf[java.io.IOException]) @throws(classOf[ClassNotFoundException]) def read[A](buffer: Array[Byte]): A = { - val in = + val in: java.io.ObjectInputStream = new java.io.ObjectInputStream(new java.io.ByteArrayInputStream(buffer)) in.readObject().asInstanceOf[A] } @@ -207,40 +209,38 @@ class XMLTestJVM { } } - import Serialize._ - @UnitTest - def serializeAttribute = { + def serializeAttribute(): Unit = { // Attribute - val a1 = new PrefixedAttribute("xml", "src", Text("hello"), Null) - val _a1: Attribute = read(write(a1)) - check(a1, _a1) + val a1: PrefixedAttribute = new PrefixedAttribute("xml", "src", Text("hello"), Null) + val _a1: Attribute = Serialize.read(Serialize.write(a1)) + Serialize.check(a1, _a1) } @UnitTest - def serializeDocument = { + def serializeDocument(): Unit = { // Document - val d1 = new Document + val d1: Document = new Document d1.docElem = d1.encoding = Some("UTF-8") - val _d1: Document = read(write(d1)) - check(d1, _d1) + val _d1: Document = Serialize.read(Serialize.write(d1)) + Serialize.check(d1, _d1) } @UnitTest - def serializeElem = { + def serializeElem(): Unit = { // Elem - val e1 = title - val _e1: Elem = read(write(e1)) - check(e1, _e1) + val e1: Elem = title + val _e1: Elem = Serialize.read(Serialize.write(e1)) + Serialize.check(e1, _e1) } @UnitTest - def serializeComplex = { + def serializeComplex(): Unit = { case class Person(name: String, age: Int) class AddressBook(a: Person*) { private val people: List[Person] = a.toList - def toXHTML = + def toXHTML: Elem = @@ -255,19 +255,19 @@ class XMLTestJVM {
Last Name
} - val people = new AddressBook( + val people: AddressBook = new AddressBook( Person("Tom", 20), Person("Bob", 22), Person("James", 19)) - val e2 = + val e2: Elem = { people.toXHTML } - val _e2: Elem = read(write(e2)) - check(e2, _e2) + val _e2: Elem = Serialize.read(Serialize.write(e2)) + Serialize.check(e2, _e2) } // t-486 @@ -284,7 +284,7 @@ class XMLTestJVM { @UnitTest - def wsdl = { + def wsdl(): Unit = { assertEquals(""" """, wsdlTemplate1("service1").toString) assertEquals(""" @@ -295,52 +295,50 @@ class XMLTestJVM { // Issue found with ISO-8859-1 in #121 that was fixed with UTF-8 default @UnitTest - def writeReadNoDeclarationDefaultEncoding: Unit = { - val chars = ((32 to 126) ++ (160 to 255)).map(_.toChar) - val xml = { chars.mkString } + def writeReadNoDeclarationDefaultEncoding(): Unit = { + val chars: Seq[Char] = ((32 to 126) ++ (160 to 255)).map(_.toChar) + val xml: Elem = { chars.mkString } // com.sun.org.apache.xerces.internal.impl.io.MalformedByteSequenceException: // Invalid byte 1 of 1-byte UTF-8 sequence. // scala.xml.XML.save("foo.xml", xml) // scala.xml.XML.loadFile("foo.xml").toString - val outputStream = new java.io.ByteArrayOutputStream - val streamWriter = new java.io.OutputStreamWriter(outputStream, "UTF-8") + val outputStream: java.io.ByteArrayOutputStream = new java.io.ByteArrayOutputStream + val streamWriter: java.io.OutputStreamWriter = new java.io.OutputStreamWriter(outputStream, "UTF-8") - XML.write(streamWriter, xml, XML.encoding, false, null) + XML.write(streamWriter, xml, XML.encoding, xmlDecl = false, null) streamWriter.flush() - val inputStream = new java.io.ByteArrayInputStream(outputStream.toByteArray) - val streamReader = new java.io.InputStreamReader(inputStream, XML.encoding) + val inputStream: java.io.ByteArrayInputStream = new java.io.ByteArrayInputStream(outputStream.toByteArray) + val streamReader: java.io.InputStreamReader = new java.io.InputStreamReader(inputStream, XML.encoding) assertEquals(xml.toString, XML.load(streamReader).toString) } @UnitTest - def t0663 = { - val src = scala.io.Source.fromString("") - val parser = xml.parsing.ConstructingParser.fromSource(src, true) + def t0663(): Unit = { + val src: scala.io.Source = scala.io.Source.fromString("") + val parser: ConstructingParser = ConstructingParser.fromSource(src, preserveWS = true) assertEquals("", parser.document().toString) } @UnitTest - def t1079 = assertFalse( == ) - - import dtd.{DocType, PublicID} + def t1079(): Unit = assertFalse( == ) @UnitTest - def t1620 = { - val dt = DocType("foo", PublicID("-//Foo Corp//DTD 1.0//EN", "foo.dtd"), Seq()) - var pw = new StringWriter() - XML.write(pw, , "utf-8", true, dt) + def t1620(): Unit = { + val dt: DocType = DocType("foo", PublicID("-//Foo Corp//DTD 1.0//EN", "foo.dtd"), Seq()) + var pw: StringWriter = new StringWriter() + XML.write(pw, , "utf-8", xmlDecl = true, dt) pw.flush() assertEquals(""" """, pw.toString) pw = new StringWriter() - val dt2 = DocType("foo", PublicID("-//Foo Corp//DTD 1.0//EN", null), Seq()) - XML.write(pw, , "utf-8", true, dt2) + val dt2: DocType = DocType("foo", PublicID("-//Foo Corp//DTD 1.0//EN", null), Seq()) + XML.write(pw, , "utf-8", xmlDecl = true, dt2) pw.flush() assertEquals(""" @@ -348,11 +346,11 @@ class XMLTestJVM { } @UnitTest - def t1773 = { - val xs = List( + def t1773(): Unit = { + val xs: List[Elem] = List( , , - { xml.NodeSeq.Empty }, + { NodeSeq.Empty }, { "" }, { if (true) "" else "I like turtles" }) @@ -360,18 +358,18 @@ class XMLTestJVM { } @UnitTest - def t2771 = { - val xml1 = - val xml2 = scala.xml.XML.loadString("""""") + def t2771(): Unit = { + val xml1: Elem = + val xml2: Elem = XML.loadString("""""") - def backslashSearch(x: xml.Elem) = "root:-" + (x \ "@{nsUri}at") + "-sub:-" + (x \ "sub" \ "@{nsUri}at") + "-" + def backslashSearch(x: Elem): String = "root:-" + (x \ "@{nsUri}at") + "-sub:-" + (x \ "sub" \ "@{nsUri}at") + "-" assertEquals("root:-rootVal-sub:-subVal-", backslashSearch(xml1)) assertEquals("root:-rootVal-sub:-subVal-", backslashSearch(xml2)) } @UnitTest - def t3886 = { + def t3886(): Unit = { assertTrue( == ) assertTrue( != ) assertTrue( != ) @@ -382,19 +380,19 @@ class XMLTestJVM { } @UnitTest - def t4387 = { + def t4387(): Unit = { import XML.loadString - def mkElem(arg: String) = + def mkElem(arg: String): Elem = - val x1 = mkElem("5") - val x2 = mkElem("50") + val x1: Elem = mkElem("5") + val x2: Elem = mkElem("50") assertEquals(x1, loadString("" + x1)) assertTrue(x2 != loadString("" + x1)) } @UnitTest - def t5052 = { + def t5052(): Unit = { assertTrue( xml_== ) assertTrue( xml_== ) assertTrue( xml_== ) @@ -402,8 +400,8 @@ class XMLTestJVM { } @UnitTest - def t5115 = { - def assertHonorsIterableContract(i: Iterable[_]) = assertEquals(i.size.toLong, i.iterator.size.toLong) + def t5115(): Unit = { + def assertHonorsIterableContract(i: Iterable[_]): Unit = assertEquals(i.size.toLong, i.iterator.size.toLong) assertHonorsIterableContract(.attributes) assertHonorsIterableContract(.attributes) @@ -416,39 +414,39 @@ class XMLTestJVM { } @UnitTest - def t5843 = { - val foo = scala.xml.Attribute(null, "foo", "1", scala.xml.Null) - val bar = scala.xml.Attribute(null, "bar", "2", foo) - val ns = scala.xml.NamespaceBinding(null, "uri", scala.xml.TopScope) + def t5843(): Unit = { + val foo: Attribute = Attribute(null, "foo", "1", Null) + val bar: Attribute = Attribute(null, "bar", "2", foo) + val ns: NamespaceBinding = NamespaceBinding(null, "uri", TopScope) assertEquals(""" foo="1"""", foo.toString) - assertEquals(null, scala.xml.TopScope.getURI(foo.pre)) + assertEquals(null, TopScope.getURI(foo.pre)) assertEquals(""" bar="2"""", bar.remove("foo").toString) assertEquals(""" foo="1"""", bar.remove("bar").toString) - assertEquals(""" bar="2"""", bar.remove(null, scala.xml.TopScope, "foo").toString) - assertEquals(""" foo="1"""", bar.remove(null, scala.xml.TopScope, "bar").toString) + assertEquals(""" bar="2"""", bar.remove(null, TopScope, "foo").toString) + assertEquals(""" foo="1"""", bar.remove(null, TopScope, "bar").toString) assertEquals(""" bar="2" foo="1"""", bar.toString) assertEquals(""" bar="2" foo="1"""", bar.remove(null, ns, "foo").toString) assertEquals(""" bar="2" foo="1"""", bar.remove(null, ns, "bar").toString) } @UnitTest - def t6939 = { - val foo = + def t6939(): Unit = { + val foo: Elem = assertEquals(foo.child.head.scope.toString, """ xmlns:x="http://bar.com/"""") - val fooDefault = + val fooDefault: Elem = assertEquals(fooDefault.child.head.scope.toString, """ xmlns="http://bar.com/"""") - val foo2 = scala.xml.XML.loadString("""""") + val foo2: Elem = XML.loadString("""""") assertEquals(foo2.child.head.scope.toString, """ xmlns:x="http://bar.com/"""") - val foo2Default = scala.xml.XML.loadString("""""") + val foo2Default: Elem = XML.loadString("""""") assertEquals(foo2Default.child.head.scope.toString, """ xmlns="http://bar.com/"""") } @UnitTest - def t7074 = { + def t7074(): Unit = { assertEquals("""""", sort().toString) assertEquals("""""", sort().toString) assertEquals("""""", sort().toString) @@ -461,26 +459,26 @@ class XMLTestJVM { } @UnitTest - def t9060 = { - val expected = """""" + def t9060(): Unit = { + val expected: String = """""" assertEquals(expected, XML.loadString(expected).toString) } @UnitTest - def attributes = { - val noAttr = - val attrNull = - val attrNone = - val preAttrNull = - val preAttrNone = + def attributes(): Unit = { + val noAttr: Elem = + val attrNull: Elem = + val attrNone: Elem = + val preAttrNull: Elem = + val preAttrNone: Elem = assertEquals(noAttr, attrNull) assertEquals(noAttr, attrNone) assertEquals(noAttr, preAttrNull) assertEquals(noAttr, preAttrNone) - val xml1 = - val xml2 = - val xml3 = + val xml1: Elem = + val xml2: Elem = + val xml3: Elem = assertEquals(xml1, xml2) assertEquals(xml1, xml3) @@ -500,12 +498,12 @@ class XMLTestJVM { assertEquals("""""", .toString) } - import java.io.{ Console => _, _ } - import scala.xml.parsing._ @UnitTest - def dontLoop: Unit = { - val xml = " " - val sink = new PrintStream(new ByteArrayOutputStream()) + def dontLoop(): Unit = { + import java.io.{ Console => _, _ } + + val xml: String = " " + val sink: PrintStream = new PrintStream(new ByteArrayOutputStream()) Console.withOut(sink) { Console.withErr(sink) { ConstructingParser.fromSource(io.Source.fromString(xml), preserveWS = true).document().docElem @@ -514,59 +512,59 @@ class XMLTestJVM { } /** Default SAXParserFactory */ - val defaultParserFactory = javax.xml.parsers.SAXParserFactory.newInstance + val defaultParserFactory: javax.xml.parsers.SAXParserFactory = javax.xml.parsers.SAXParserFactory.newInstance @throws(classOf[org.xml.sax.SAXNotRecognizedException]) - def issue17UnrecognizedFeature: Unit = { + def issue17UnrecognizedFeature(): Unit = { assertTrue(defaultParserFactory.getFeature("foobar")) } @UnitTest - def issue17SecureProcessing: Unit = { + def issue17SecureProcessing(): Unit = { assertTrue(defaultParserFactory.getFeature("http://javax.xml.XMLConstants/feature/secure-processing")) } @UnitTest - def issue17ExternalGeneralEntities: Unit = { + def issue17ExternalGeneralEntities(): Unit = { assertTrue(defaultParserFactory.getFeature("http://xml.org/sax/features/external-general-entities")) } @UnitTest - def issue17LoadExternalDtd: Unit = { + def issue17LoadExternalDtd(): Unit = { assertTrue(defaultParserFactory.getFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd")) } @UnitTest - def issue17DisallowDoctypeDecl: Unit = { + def issue17DisallowDoctypeDecl(): Unit = { assertFalse(defaultParserFactory.getFeature("http://apache.org/xml/features/disallow-doctype-decl")) } @UnitTest - def issue17ExternalParameterEntities: Unit = { + def issue17ExternalParameterEntities(): Unit = { assertTrue(defaultParserFactory.getFeature("http://xml.org/sax/features/external-parameter-entities")) } @UnitTest - def issue17ResolveDtdUris: Unit = { + def issue17ResolveDtdUris(): Unit = { assertTrue(defaultParserFactory.getFeature("http://xml.org/sax/features/resolve-dtd-uris")) } @UnitTest - def issue17isXIncludeAware: Unit = { + def issue17isXIncludeAware(): Unit = { assertFalse(XML.parser.isXIncludeAware) } @UnitTest - def issue17isNamespaceAware: Unit = { + def issue17isNamespaceAware(): Unit = { assertFalse(XML.parser.isNamespaceAware) } @UnitTest - def issue28: Unit = { - val x = + def issue28(): Unit = { + val x: Elem = // val ns = new NamespaceBinding("x", "gaga", sc) // val x = Elem("x", "foo", e, ns) - val pp = new xml.PrettyPrinter(80, 2) + val pp: PrettyPrinter = new PrettyPrinter(80, 2) // This assertion passed assertEquals("""""", x.toString) // This was the bug, producing an errant xmlns attribute @@ -574,15 +572,15 @@ class XMLTestJVM { } @UnitTest( expected = classOf[scala.xml.SAXParseException] ) - def issue35: Unit = { - val broken = " suffix") roundtrip("prefix suffix") @@ -599,7 +597,7 @@ class XMLTestJVM { } @UnitTest - def cdataParsing: Unit = { + def cdataParsing(): Unit = { roundtrip(" suffix") roundtrip("prefix suffix") roundtrip("prefix suffix") @@ -612,7 +610,7 @@ class XMLTestJVM { def roundtripNodes(xml: String): Unit = assertEquals(xml, XML.loadStringNodes(xml).map(_.toString).mkString("")) @UnitTest - def xmlLoaderLoadNodes: Unit = { + def xmlLoaderLoadNodes(): Unit = { roundtripNodes("text") roundtripNodes("text") roundtripNodes("""" to this string buffer. */ - override def buildString(sb: StringBuilder) = + override def buildString(sb: StringBuilder): StringBuilder = sb append "" } diff --git a/shared/src/main/scala/scala/xml/Document.scala b/shared/src/main/scala/scala/xml/Document.scala index 0ff3ad2d8..e242794f8 100644 --- a/shared/src/main/scala/scala/xml/Document.scala +++ b/shared/src/main/scala/scala/xml/Document.scala @@ -92,13 +92,13 @@ class Document extends NodeSeq with Serializable { * then certain properties (indicated in their descriptions below) may * be unknown. If it is true, those properties are never unknown. */ - var allDeclarationsProcessed = false + var allDeclarationsProcessed: Boolean = false // methods for NodeSeq override def theSeq: Seq[Node] = this.docElem - override def canEqual(other: Any) = other match { + override def canEqual(other: Any): Boolean = other match { case _: Document => true case _ => false } diff --git a/shared/src/main/scala/scala/xml/Elem.scala b/shared/src/main/scala/scala/xml/Elem.scala index 20feb40a9..dcbe8f5a3 100755 --- a/shared/src/main/scala/scala/xml/Elem.scala +++ b/shared/src/main/scala/scala/xml/Elem.scala @@ -26,7 +26,7 @@ object Elem { def apply(prefix: String, label: String, attributes: MetaData, scope: NamespaceBinding, minimizeEmpty: Boolean, child: Node*): Elem = new Elem(prefix, label, attributes, scope, minimizeEmpty, child: _*) - def unapplySeq(n: Node) = n match { + def unapplySeq(n: Node) /* TODO type annotation */ = n match { case _: SpecialNode | _: Group => None case _ => Some((n.prefix, n.label, n.attributes, n.scope, n.child.toSeq)) } @@ -60,10 +60,10 @@ class Elem( override val child: Node* ) extends Node with Serializable { - final override def doCollectNamespaces = true - final override def doTransform = true + final override def doCollectNamespaces: Boolean = true + final override def doTransform: Boolean = true - override val attributes = MetaData.normalize(attributes1, scope) + override val attributes: MetaData = MetaData.normalize(attributes1, scope) if (prefix == "") throw new IllegalArgumentException("prefix of zero length, use null instead") @@ -106,5 +106,5 @@ class Elem( /** * Returns concatenation of `text(n)` for each child `n`. */ - override def text = (child map (_.text)).mkString + override def text: String = (child map (_.text)).mkString } diff --git a/shared/src/main/scala/scala/xml/EntityRef.scala b/shared/src/main/scala/scala/xml/EntityRef.scala index 17eb0543d..38f20689a 100644 --- a/shared/src/main/scala/scala/xml/EntityRef.scala +++ b/shared/src/main/scala/scala/xml/EntityRef.scala @@ -20,11 +20,11 @@ package xml * @param entityName the name of the entity reference, for example `amp`. */ case class EntityRef(entityName: String) extends SpecialNode { - final override def doCollectNamespaces = false - final override def doTransform = false - override def label = "#ENTITY" + final override def doCollectNamespaces: Boolean = false + final override def doTransform: Boolean = false + override def label: String = "#ENTITY" - override def text = entityName match { + override def text: String = entityName match { case "lt" => "<" case "gt" => ">" case "amp" => "&" @@ -39,7 +39,6 @@ case class EntityRef(entityName: String) extends SpecialNode { * @param sb the string buffer. * @return the modified string buffer `sb`. */ - override def buildString(sb: StringBuilder) = + override def buildString(sb: StringBuilder): StringBuilder = sb.append("&").append(entityName).append(";") - } diff --git a/shared/src/main/scala/scala/xml/Equality.scala b/shared/src/main/scala/scala/xml/Equality.scala index 716a912e1..11877f47e 100644 --- a/shared/src/main/scala/scala/xml/Equality.scala +++ b/shared/src/main/scala/scala/xml/Equality.scala @@ -63,7 +63,7 @@ object Equality { } def compareBlithely(x1: AnyRef, x2: AnyRef): Boolean = { if (x1 == null || x2 == null) - return (x1 eq x2) + return x1 eq x2 x2 match { case s: String => compareBlithely(x1, s) @@ -78,7 +78,7 @@ trait Equality extends scala.Equals { protected def basisForHashCode: Seq[Any] def strict_==(other: Equality): Boolean - def strict_!=(other: Equality) = !strict_==(other) + def strict_!=(other: Equality): Boolean = !strict_==(other) /** * We insist we're only equal to other `xml.Equality` implementors, @@ -96,18 +96,18 @@ trait Equality extends scala.Equals { * are final since clearly individual classes cannot be trusted * to maintain a semblance of order. */ - override def hashCode() = basisForHashCode.## - override def equals(other: Any) = doComparison(other, blithe = false) - final def xml_==(other: Any) = doComparison(other, blithe = true) - final def xml_!=(other: Any) = !xml_==(other) + override def hashCode(): Int = basisForHashCode.## + override def equals(other: Any): Boolean = doComparison(other, blithe = false) + final def xml_==(other: Any): Boolean = doComparison(other, blithe = true) + final def xml_!=(other: Any): Boolean = !xml_==(other) /** * The "blithe" parameter expresses the caller's unconcerned attitude * regarding the usual constraints on equals. The method is thereby * given carte blanche to declare any two things equal. */ - private def doComparison(other: Any, blithe: Boolean) = { - val strictlyEqual = other match { + private def doComparison(other: Any, blithe: Boolean): Boolean = { + val strictlyEqual: Boolean = other match { case x: AnyRef if this eq x => true case x: Equality => (x canEqual this) && (this strict_== x) case _ => false diff --git a/shared/src/main/scala/scala/xml/Group.scala b/shared/src/main/scala/scala/xml/Group.scala index 9ad9f6ff1..471979d4a 100644 --- a/shared/src/main/scala/scala/xml/Group.scala +++ b/shared/src/main/scala/scala/xml/Group.scala @@ -21,29 +21,29 @@ import scala.collection.Seq * @author Burak Emir */ final case class Group(nodes: Seq[Node]) extends Node { - override def theSeq = nodes + override def theSeq: Seq[Node] = nodes - override def canEqual(other: Any) = other match { + override def canEqual(other: Any): Boolean = other match { case x: Group => true case _ => false } - override def strict_==(other: Equality) = other match { + override def strict_==(other: Equality): Boolean = other match { case Group(xs) => nodes sameElements xs case _ => false } - override protected def basisForHashCode = nodes + override protected def basisForHashCode: Seq[Node] = nodes /** * Since Group is very much a hack it throws an exception if you * try to do anything with it. */ - private def fail(msg: String) = throw new UnsupportedOperationException("class Group does not support method '%s'" format msg) + private def fail(msg: String): Nothing = throw new UnsupportedOperationException("class Group does not support method '%s'" format msg) - override def label = fail("label") - override def attributes = fail("attributes") - override def namespace = fail("namespace") - override def child = fail("child") - def buildString(sb: StringBuilder) = fail("toString(StringBuilder)") + override def label: Nothing = fail("label") + override def attributes: Nothing = fail("attributes") + override def namespace: Nothing = fail("namespace") + override def child /* TODO type annotation */ = fail("child") + def buildString(sb: StringBuilder): Nothing = fail("toString(StringBuilder)") } diff --git a/shared/src/main/scala/scala/xml/MetaData.scala b/shared/src/main/scala/scala/xml/MetaData.scala index 06470c299..4607ea6c7 100644 --- a/shared/src/main/scala/scala/xml/MetaData.scala +++ b/shared/src/main/scala/scala/xml/MetaData.scala @@ -43,7 +43,7 @@ object MetaData { } else if (md.value eq null) { iterate(md.next, normalized_attribs, set) } else { - val key = getUniversalKey(md, scope) + val key: String = getUniversalKey(md, scope) if (set(key)) { iterate(md.next, normalized_attribs, set) } else { @@ -57,7 +57,7 @@ object MetaData { /** * returns key if md is unprefixed, pre+key is md is prefixed */ - def getUniversalKey(attrib: MetaData, scope: NamespaceBinding) = attrib match { + def getUniversalKey(attrib: MetaData, scope: NamespaceBinding): String = attrib match { case prefixed: PrefixedAttribute => scope.getURI(prefixed.pre) + prefixed.key case unprefixed: UnprefixedAttribute => unprefixed.key } @@ -134,7 +134,7 @@ abstract class MetaData /** if owner is the element of this metadata item, returns namespace */ def getNamespace(owner: Node): String - def hasNext = Null != next + def hasNext: Boolean = Null != next def length: Int = length(0) @@ -142,11 +142,11 @@ abstract class MetaData def isPrefixed: Boolean - override def canEqual(other: Any) = other match { + override def canEqual(other: Any): Boolean = other match { case _: MetaData => true case _ => false } - override def strict_==(other: Equality) = other match { + override def strict_==(other: Equality): Boolean = other match { case m: MetaData => this.asAttrMap == m.asAttrMap case _ => false } @@ -172,7 +172,7 @@ abstract class MetaData * Returns a String containing "prefix:key" if the first key is * prefixed, and "key" otherwise. */ - def prefixedKey = this match { + def prefixedKey: String = this match { case x: Attribute if x.isPrefixed => x.pre + ":" + key case _ => key } diff --git a/shared/src/main/scala/scala/xml/NamespaceBinding.scala b/shared/src/main/scala/scala/xml/NamespaceBinding.scala index 030358b9d..84c085f4e 100644 --- a/shared/src/main/scala/scala/xml/NamespaceBinding.scala +++ b/shared/src/main/scala/scala/xml/NamespaceBinding.scala @@ -52,18 +52,18 @@ case class NamespaceBinding(prefix: String, uri: String, parent: NamespaceBindin case Nil => stop case x :: xs => NamespaceBinding(x, this.getURI(x), fromPrefixList(xs)) } - val ps0 = prefixList(this).reverse - val ps = ps0.distinct + val ps0: List[String] = prefixList(this).reverse + val ps: List[String] = ps0.distinct if (ps.size == ps0.size) this else fromPrefixList(ps) } - override def canEqual(other: Any) = other match { + override def canEqual(other: Any): Boolean = other match { case _: NamespaceBinding => true case _ => false } - override def strict_==(other: Equality) = other match { + override def strict_==(other: Equality): Boolean = other match { case x: NamespaceBinding => (prefix == x.prefix) && (uri == x.uri) && (parent == x.parent) case _ => false } @@ -79,7 +79,7 @@ case class NamespaceBinding(prefix: String, uri: String, parent: NamespaceBindin private def doBuildString(sb: StringBuilder, stop: NamespaceBinding): Unit = { if (List(null, stop, TopScope).contains(this)) return - val s = " xmlns%s=\"%s\"".format( + val s: String = " xmlns%s=\"%s\"".format( if (prefix != null) ":" + prefix else "", if (uri != null) uri else "" ) diff --git a/shared/src/main/scala/scala/xml/Node.scala b/shared/src/main/scala/scala/xml/Node.scala index 6e68a084d..1b2716f5a 100755 --- a/shared/src/main/scala/scala/xml/Node.scala +++ b/shared/src/main/scala/scala/xml/Node.scala @@ -26,9 +26,9 @@ object Node { final def NoAttributes: MetaData = Null /** the empty namespace */ - val EmptyNamespace = "" + val EmptyNamespace: String = "" - def unapplySeq(n: Node) = Some((n.label, n.attributes, n.child.toSeq)) + def unapplySeq(n: Node) /* TODO type annotation */ = Some((n.label, n.attributes, n.child.toSeq)) } /** @@ -55,11 +55,11 @@ abstract class Node extends NodeSeq { /** * used internally. Atom/Molecule = -1 PI = -2 Comment = -3 EntityRef = -5 */ - def isAtom = this.isInstanceOf[Atom[_]] + def isAtom: Boolean = this.isInstanceOf[Atom[_]] /** The logic formerly found in typeTag$, as best I could infer it. */ - def doCollectNamespaces = true // if (tag >= 0) DO collect namespaces - def doTransform = true // if (tag < 0) DO NOT transform + def doCollectNamespaces: Boolean = true // if (tag >= 0) DO collect namespaces + def doTransform: Boolean = true // if (tag < 0) DO NOT transform /** * method returning the namespace bindings of this node. by default, this @@ -71,7 +71,7 @@ abstract class Node extends NodeSeq { /** * convenience, same as `getNamespace(this.prefix)` */ - def namespace = getNamespace(this.prefix) + def namespace: String = getNamespace(this.prefix) /** * Convenience method, same as `scope.getURI(pre)` but additionally @@ -139,7 +139,7 @@ abstract class Node extends NodeSeq { */ def descendant_or_self: List[Node] = this :: descendant - override def canEqual(other: Any) = other match { + override def canEqual(other: Any): Boolean = other match { case x: Group => false case x: Node => true case _ => false @@ -148,7 +148,7 @@ abstract class Node extends NodeSeq { override protected def basisForHashCode: Seq[Any] = prefix :: label :: attributes :: nonEmptyChildren.toList - override def strict_==(other: Equality) = other match { + override def strict_==(other: Equality): Boolean = other match { case _: Group => false case x: Node => (prefix == x.prefix) && diff --git a/shared/src/main/scala/scala/xml/NodeSeq.scala b/shared/src/main/scala/scala/xml/NodeSeq.scala index fe16be05a..89d81372b 100644 --- a/shared/src/main/scala/scala/xml/NodeSeq.scala +++ b/shared/src/main/scala/scala/xml/NodeSeq.scala @@ -13,8 +13,7 @@ package scala package xml -import scala.collection.{ mutable, immutable, AbstractSeq } -import mutable.{ Builder, ListBuffer } +import scala.collection.{mutable, immutable, AbstractSeq} import ScalaVersionSpecific.CBF import scala.language.implicitConversions import scala.collection.Seq @@ -25,9 +24,9 @@ import scala.collection.Seq * @author Burak Emir */ object NodeSeq { - final val Empty = fromSeq(Nil) + final val Empty: NodeSeq = fromSeq(Nil) def fromSeq(s: Seq[Node]): NodeSeq = new NodeSeq { - override def theSeq = s + override def theSeq: Seq[Node] = s } // --- @@ -38,7 +37,7 @@ object NodeSeq { implicit def canBuildFrom: CBF[Coll, Node, NodeSeq] = ScalaVersionSpecific.NodeSeqCBF // --- - def newBuilder: Builder[Node, NodeSeq] = new ListBuffer[Node] mapResult fromSeq + def newBuilder: mutable.Builder[Node, NodeSeq] = new mutable.ListBuffer[Node] mapResult fromSeq implicit def seqToNodeSeq(s: Seq[Node]): NodeSeq = fromSeq(s) } @@ -50,15 +49,15 @@ object NodeSeq { */ abstract class NodeSeq extends AbstractSeq[Node] with immutable.Seq[Node] with ScalaVersionSpecificNodeSeq with Equality with Serializable { def theSeq: Seq[Node] - override def length = theSeq.length - override def iterator = theSeq.iterator + override def length: Int = theSeq.length + override def iterator: Iterator[Node] = theSeq.iterator override def apply(i: Int): Node = theSeq(i) def apply(f: Node => Boolean): NodeSeq = filter(f) def xml_sameElements[A](that: Iterable[A]): Boolean = { - val these = this.iterator - val those = that.iterator + val these: Iterator[Node] = this.iterator + val those: Iterator[A] = that.iterator while (these.hasNext && those.hasNext) if (these.next() xml_!= those.next()) return false @@ -68,12 +67,12 @@ abstract class NodeSeq extends AbstractSeq[Node] with immutable.Seq[Node] with S override protected def basisForHashCode: Seq[Any] = theSeq - override def canEqual(other: Any) = other match { + override def canEqual(other: Any): Boolean = other match { case _: NodeSeq => true case _ => false } - override def strict_==(other: Equality) = other match { + override def strict_==(other: Equality): Boolean = other match { case x: NodeSeq => (length == x.length) && (theSeq sameElements x.theSeq) case _ => false } @@ -95,15 +94,15 @@ abstract class NodeSeq extends AbstractSeq[Node] with immutable.Seq[Node] with S * The document order is preserved. */ def \(that: String): NodeSeq = { - def fail = throw new IllegalArgumentException(that) - def atResult = { - lazy val y = this(0) - val attr = + def fail: Nothing = throw new IllegalArgumentException(that) + def atResult: NodeSeq = { + lazy val y: Node = this(0) + val attr: Option[Seq[Node]] = if (that.length == 1) fail else if (that(1) == '{') { - val i = that indexOf '}' + val i: Int = that indexOf '}' if (i == -1) fail - val (uri, key) = (that.substring(2, i), that.substring(i + 1, that.length())) + val (uri: String, key: String) = (that.substring(2, i), that.substring(i + 1, that.length())) if (uri == "" || key == "") fail else y.attribute(uri, key) } else y.attribute(that drop 1) @@ -114,7 +113,7 @@ abstract class NodeSeq extends AbstractSeq[Node] with immutable.Seq[Node] with S } } - def makeSeq(cond: (Node) => Boolean) = + def makeSeq(cond: Node => Boolean): NodeSeq = NodeSeq fromSeq (this flatMap (_.child) filter cond) that match { @@ -144,8 +143,8 @@ abstract class NodeSeq extends AbstractSeq[Node] with immutable.Seq[Node] with S * The document order is preserved. */ def \\(that: String): NodeSeq = { - def fail = throw new IllegalArgumentException(that) - def filt(cond: (Node) => Boolean) = this flatMap (_.descendant_or_self) filter cond + def fail: Nothing = throw new IllegalArgumentException(that) + def filt(cond: Node => Boolean): NodeSeq = this flatMap (_.descendant_or_self) filter cond that match { case "" => fail case "_" => filt(!_.isAtom) diff --git a/shared/src/main/scala/scala/xml/Null.scala b/shared/src/main/scala/scala/xml/Null.scala index 3800f185f..e7bf3627b 100644 --- a/shared/src/main/scala/scala/xml/Null.scala +++ b/shared/src/main/scala/scala/xml/Null.scala @@ -25,43 +25,43 @@ import scala.collection.Seq * @author Burak Emir */ case object Null extends MetaData { - override def iterator = Iterator.empty - override def size = 0 + override def iterator /* TODO type annotation */ = Iterator.empty + override def size: Int = 0 override def append(m: MetaData, scope: NamespaceBinding = TopScope): MetaData = m override def filter(f: MetaData => Boolean): MetaData = this - override def copy(next: MetaData) = next - override def getNamespace(owner: Node) = null + override def copy(next: MetaData): MetaData = next + override def getNamespace(owner: Node) /* TODO type annotation */ = null - override def hasNext = false - override def next = null - override def key = null - override def value = null - override def isPrefixed = false + override def hasNext: Boolean = false + override def next /* TODO type annotation */ = null + override def key /* TODO type annotation */ = null + override def value /* TODO type annotation */ = null + override def isPrefixed: Boolean = false - override def length = 0 - override def length(i: Int) = i + override def length: Int = 0 + override def length(i: Int): Int = i - override def strict_==(other: Equality) = other match { + override def strict_==(other: Equality): Boolean = other match { case x: MetaData => x.length == 0 case _ => false } override protected def basisForHashCode: Seq[Any] = Nil - override def apply(namespace: String, scope: NamespaceBinding, key: String) = null - override def apply(key: String) = + override def apply(namespace: String, scope: NamespaceBinding, key: String) /* TODO type annotation */ = null + override def apply(key: String) /* TODO type annotation */ = if (isNameStart(key.head)) null else throw new IllegalArgumentException("not a valid attribute name '" + key + "', so can never match !") - override protected def toString1(sb: StringBuilder) = () + override protected def toString1(sb: StringBuilder): Unit = () override protected def toString1(): String = "" override def toString(): String = "" override def buildString(sb: StringBuilder): StringBuilder = sb - override def wellformed(scope: NamespaceBinding) = true + override def wellformed(scope: NamespaceBinding): Boolean = true - override def remove(key: String) = this - override def remove(namespace: String, scope: NamespaceBinding, key: String) = this + override def remove(key: String) /* TODO type annotation */ = this + override def remove(namespace: String, scope: NamespaceBinding, key: String) /* TODO type annotation */ = this } diff --git a/shared/src/main/scala/scala/xml/PCData.scala b/shared/src/main/scala/scala/xml/PCData.scala index 0b85bfe88..372630ddc 100644 --- a/shared/src/main/scala/scala/xml/PCData.scala +++ b/shared/src/main/scala/scala/xml/PCData.scala @@ -40,7 +40,7 @@ class PCData(data: String) extends Atom[String](data) { * @author Burak Emir */ object PCData { - def apply(data: String) = new PCData(data) + def apply(data: String): PCData = new PCData(data) def unapply(other: Any): Option[String] = other match { case x: PCData => Some(x.data) case _ => None diff --git a/shared/src/main/scala/scala/xml/PrefixedAttribute.scala b/shared/src/main/scala/scala/xml/PrefixedAttribute.scala index eddea4156..fcbeaccf4 100644 --- a/shared/src/main/scala/scala/xml/PrefixedAttribute.scala +++ b/shared/src/main/scala/scala/xml/PrefixedAttribute.scala @@ -29,7 +29,7 @@ class PrefixedAttribute( override val value: Seq[Node], val next1: MetaData) extends Attribute { - override val next = if (value ne null) next1 else next1.remove(key) + override val next: MetaData = if (value ne null) next1 else next1.remove(key) /** same as this(pre, key, Text(value), next), or no attribute if value is null */ def this(pre: String, key: String, value: String, next: MetaData) = @@ -43,10 +43,10 @@ class PrefixedAttribute( * Returns a copy of this unprefixed attribute with the given * next field. */ - override def copy(next: MetaData) = + override def copy(next: MetaData): PrefixedAttribute = new PrefixedAttribute(pre, key, value, next) - override def getNamespace(owner: Node) = + override def getNamespace(owner: Node): String = owner.getNamespace(pre) /** forwards the call to next (because caller looks for unprefixed attribute */ @@ -64,5 +64,5 @@ class PrefixedAttribute( } object PrefixedAttribute { - def unapply(x: PrefixedAttribute) = Some((x.pre, x.key, x.value, x.next)) + def unapply(x: PrefixedAttribute) /* TODO type annotation */ = Some((x.pre, x.key, x.value, x.next)) } diff --git a/shared/src/main/scala/scala/xml/PrettyPrinter.scala b/shared/src/main/scala/scala/xml/PrettyPrinter.scala index 90b683ddb..261b05bf0 100755 --- a/shared/src/main/scala/scala/xml/PrettyPrinter.scala +++ b/shared/src/main/scala/scala/xml/PrettyPrinter.scala @@ -33,21 +33,21 @@ class PrettyPrinter(width: Int, step: Int, minimizeEmpty: Boolean) { def this(width: Int, step: Int) = this(width, step, minimizeEmpty = false) - val minimizeMode = if (minimizeEmpty) MinimizeMode.Always else MinimizeMode.Default + val minimizeMode: MinimizeMode.Value = if (minimizeEmpty) MinimizeMode.Always else MinimizeMode.Default class BrokenException() extends java.lang.Exception class Item case object Break extends Item { - override def toString = "\\" + override def toString: String = "\\" } case class Box(col: Int, s: String) extends Item case class Para(s: String) extends Item protected var items: List[Item] = Nil - protected var cur = 0 + protected var cur: Int = 0 - protected def reset() = { + protected def reset(): Unit = { cur = 0 items = Nil } @@ -56,10 +56,10 @@ class PrettyPrinter(width: Int, step: Int, minimizeEmpty: Boolean) { * Try to cut at whitespace. */ protected def cut(s: String, ind: Int): List[Item] = { - val tmp = width - cur + val tmp: Int = width - cur if (s.length <= tmp) return List(Box(ind, s)) - var i = s indexOf ' ' + var i: Int = s indexOf ' ' if (i > tmp || i == -1) throw new BrokenException() // cannot break var last: List[Int] = Nil @@ -69,7 +69,7 @@ class PrettyPrinter(width: Int, step: Int, minimizeEmpty: Boolean) { } var res: List[Item] = Nil while (Nil != last) try { - val b = Box(ind, s.substring(0, last.head)) + val b: Box = Box(ind, s.substring(0, last.head)) cur = ind res = b :: Break :: cut(s.substring(last.head, s.length), ind) // backtrack @@ -83,7 +83,7 @@ class PrettyPrinter(width: Int, step: Int, minimizeEmpty: Boolean) { /** * Try to make indented box, if possible, else para. */ - protected def makeBox(ind: Int, s: String) = + protected def makeBox(ind: Int, s: String): Unit = if (cur + s.length > width) { // fits in this line items ::= Box(ind, s) cur += s.length @@ -91,18 +91,18 @@ class PrettyPrinter(width: Int, step: Int, minimizeEmpty: Boolean) { catch { case _: BrokenException => makePara(ind, s) } // give up, para // dont respect indent in para, but afterwards - protected def makePara(ind: Int, s: String) = { + protected def makePara(ind: Int, s: String): Unit = { items = Break :: Para(s) :: Break :: items cur = ind } // respect indent - protected def makeBreak() = { // using wrapping here... + protected def makeBreak(): Unit = { // using wrapping here... items = Break :: items cur = 0 } - protected def leafTag(n: Node) = { + protected def leafTag(n: Node): String = { def mkLeaf(sb: StringBuilder): Unit = { sb append '<' n nameToString sb @@ -113,7 +113,7 @@ class PrettyPrinter(width: Int, step: Int, minimizeEmpty: Boolean) { } protected def startTag(n: Node, pscope: NamespaceBinding): (String, Int) = { - var i = 0 + var i: Int = 0 def mkStart(sb: StringBuilder): Unit = { sb append '<' n nameToString sb @@ -125,7 +125,7 @@ class PrettyPrinter(width: Int, step: Int, minimizeEmpty: Boolean) { (sbToString(mkStart), i) } - protected def endTag(n: Node) = { + protected def endTag(n: Node): String = { def mkEnd(sb: StringBuilder): Unit = { sb append " true case _ => false } n.child forall isLeaf } - protected def fits(test: String) = + protected def fits(test: String): Boolean = test.length < width - cur - private def doPreserve(node: Node) = + private def doPreserve(node: Node): Boolean = node.attribute(XML.namespace, XML.space).exists(_.toString == XML.preserve) protected def traverse(node: Node, pscope: NamespaceBinding, ind: Int): Unit = node match { @@ -157,8 +157,8 @@ class PrettyPrinter(width: Int, step: Int, minimizeEmpty: Boolean) { case g@Group(xs) => traverse(xs.iterator, pscope, ind) case _ => - val test = { - val sb = new StringBuilder() + val test: String = { + val sb: StringBuilder = new StringBuilder() Utility.serialize(node, pscope, sb, stripComments = false, minimizeTags = minimizeMode) if (doPreserve(node)) sb.toString else TextBuffer.fromString(sb.toString).toText(0).data @@ -166,11 +166,11 @@ class PrettyPrinter(width: Int, step: Int, minimizeEmpty: Boolean) { if (childrenAreLeaves(node) && fits(test)) { makeBox(ind, test) } else { - val ((stg, len2), etg) = + val ((stg: String, len2: Int), etg: String) = if (node.child.isEmpty && minimizeEmpty) { // force the tag to be self-closing - val firstAttribute = test.indexOf(' ') - val firstBreak = if (firstAttribute != -1) firstAttribute else test.lastIndexOf('/') + val firstAttribute: Int = test.indexOf(' ') + val firstBreak: Int = if (firstAttribute != -1) firstAttribute else test.lastIndexOf('/') ((test, firstBreak), "") } else { (startTag(node, pscope), endTag(node)) @@ -226,10 +226,10 @@ class PrettyPrinter(width: Int, step: Int, minimizeEmpty: Boolean) { } def format(n: Node, pscope: NamespaceBinding, sb: StringBuilder): Unit = { // entry point - var lastwasbreak = false + var lastwasbreak: Boolean = false reset() traverse(n, pscope, 0) - var cur = 0 + var cur: Int = 0 for (b <- items.reverse) b match { case Break => if (!lastwasbreak) sb.append('\n') // on windows: \r\n ? diff --git a/shared/src/main/scala/scala/xml/ProcInstr.scala b/shared/src/main/scala/scala/xml/ProcInstr.scala index 1d67825dd..7dbdab978 100644 --- a/shared/src/main/scala/scala/xml/ProcInstr.scala +++ b/shared/src/main/scala/scala/xml/ProcInstr.scala @@ -28,16 +28,16 @@ case class ProcInstr(target: String, proctext: String) extends SpecialNode { if (target.toLowerCase == "xml") throw new IllegalArgumentException(target + " is reserved") - final override def doCollectNamespaces = false - final override def doTransform = false + final override def doCollectNamespaces: Boolean = false + final override def doTransform: Boolean = false - final override def label = "#PI" - override def text = "" + final override def label: String = "#PI" + override def text: String = "" /** * appends "<?" target (" "+text)?+"?>" * to this stringbuffer. */ - override def buildString(sb: StringBuilder) = + override def buildString(sb: StringBuilder): StringBuilder = sb append "".format(target, if (proctext == "") "" else " " + proctext) } diff --git a/shared/src/main/scala/scala/xml/QNode.scala b/shared/src/main/scala/scala/xml/QNode.scala index 059297026..9b1e56e26 100644 --- a/shared/src/main/scala/scala/xml/QNode.scala +++ b/shared/src/main/scala/scala/xml/QNode.scala @@ -20,5 +20,5 @@ package xml * @author Burak Emir */ object QNode { - def unapplySeq(n: Node) = Some((n.scope.getURI(n.prefix), n.label, n.attributes, n.child.toSeq)) + def unapplySeq(n: Node) /* TODO type annotation */ = Some((n.scope.getURI(n.prefix), n.label, n.attributes, n.child.toSeq)) } diff --git a/shared/src/main/scala/scala/xml/SpecialNode.scala b/shared/src/main/scala/scala/xml/SpecialNode.scala index b10ce16d7..e9a4d007f 100644 --- a/shared/src/main/scala/scala/xml/SpecialNode.scala +++ b/shared/src/main/scala/scala/xml/SpecialNode.scala @@ -22,13 +22,13 @@ package xml abstract class SpecialNode extends Node { /** always empty */ - final override def attributes = Null + final override def attributes: Null.type = Null /** always Node.EmptyNamespace */ - final override def namespace = null + final override def namespace: scala.Null = null /** always empty */ - final override def child = Nil + final override def child /* TODO type annotation */ = Nil /** Append string representation to the given string buffer argument. */ def buildString(sb: StringBuilder): StringBuilder diff --git a/shared/src/main/scala/scala/xml/Text.scala b/shared/src/main/scala/scala/xml/Text.scala index 0232e69b1..a2085b0f2 100644 --- a/shared/src/main/scala/scala/xml/Text.scala +++ b/shared/src/main/scala/scala/xml/Text.scala @@ -37,7 +37,7 @@ class Text(data: String) extends Atom[String](data) { * @author Burak Emir */ object Text { - def apply(data: String) = new Text(data) + def apply(data: String): Text = new Text(data) def unapply(other: Any): Option[String] = other match { case x: Text => Some(x.data) case _ => None diff --git a/shared/src/main/scala/scala/xml/TextBuffer.scala b/shared/src/main/scala/scala/xml/TextBuffer.scala index d8aed3127..fc9e8ba9a 100644 --- a/shared/src/main/scala/scala/xml/TextBuffer.scala +++ b/shared/src/main/scala/scala/xml/TextBuffer.scala @@ -27,7 +27,7 @@ object TextBuffer { * character, and leading and trailing space will be removed completely. */ class TextBuffer { - val sb = new StringBuilder() + val sb: StringBuilder = new StringBuilder() /** * Appends this string to the text buffer, trimming whitespaces as needed. diff --git a/shared/src/main/scala/scala/xml/TopScope.scala b/shared/src/main/scala/scala/xml/TopScope.scala index 743df8532..0fcc2287f 100644 --- a/shared/src/main/scala/scala/xml/TopScope.scala +++ b/shared/src/main/scala/scala/xml/TopScope.scala @@ -20,7 +20,7 @@ package xml */ object TopScope extends NamespaceBinding(null, null, null) { - import XML.{ xml, namespace } + import XML.{xml, namespace} override def getURI(prefix1: String): String = if (prefix1 == xml) namespace else null @@ -28,8 +28,8 @@ object TopScope extends NamespaceBinding(null, null, null) { override def getPrefix(uri1: String): String = if (uri1 == namespace) xml else null - override def toString() = "" + override def toString(): String = "" - override def buildString(stop: NamespaceBinding) = "" - override def buildString(sb: StringBuilder, ignore: NamespaceBinding) = {} + override def buildString(stop: NamespaceBinding): String = "" + override def buildString(sb: StringBuilder, ignore: NamespaceBinding): Unit = () } diff --git a/shared/src/main/scala/scala/xml/Unparsed.scala b/shared/src/main/scala/scala/xml/Unparsed.scala index 80bde6873..0781018a1 100644 --- a/shared/src/main/scala/scala/xml/Unparsed.scala +++ b/shared/src/main/scala/scala/xml/Unparsed.scala @@ -37,6 +37,6 @@ class Unparsed(data: String) extends Atom[String](data) { * @author Burak Emir */ object Unparsed { - def apply(data: String) = new Unparsed(data) - def unapply(x: Unparsed) = Some(x.data) + def apply(data: String): Unparsed = new Unparsed(data) + def unapply(x: Unparsed): Some[String] = Some(x.data) } diff --git a/shared/src/main/scala/scala/xml/UnprefixedAttribute.scala b/shared/src/main/scala/scala/xml/UnprefixedAttribute.scala index 9a7b71be2..c33e5587f 100644 --- a/shared/src/main/scala/scala/xml/UnprefixedAttribute.scala +++ b/shared/src/main/scala/scala/xml/UnprefixedAttribute.scala @@ -25,8 +25,8 @@ class UnprefixedAttribute( override val value: Seq[Node], next1: MetaData) extends Attribute { - final override val pre = null - override val next = if (value ne null) next1 else next1.remove(key) + final override val pre: scala.Null = null + override val next: MetaData = if (value ne null) next1 else next1.remove(key) /** same as this(key, Text(value), next), or no attribute if value is null */ def this(key: String, value: String, next: MetaData) = @@ -37,7 +37,7 @@ class UnprefixedAttribute( this(key, value.orNull, next) /** returns a copy of this unprefixed attribute with the given next field*/ - override def copy(next: MetaData) = new UnprefixedAttribute(key, value, next) + override def copy(next: MetaData): UnprefixedAttribute = new UnprefixedAttribute(key, value, next) final override def getNamespace(owner: Node): String = null @@ -62,5 +62,5 @@ class UnprefixedAttribute( next(namespace, scope, key) } object UnprefixedAttribute { - def unapply(x: UnprefixedAttribute) = Some((x.key, x.value, x.next)) + def unapply(x: UnprefixedAttribute) /* TODO type annotation */ = Some((x.key, x.value, x.next)) } diff --git a/shared/src/main/scala/scala/xml/Utility.scala b/shared/src/main/scala/scala/xml/Utility.scala index d95931a8c..c812e4b6b 100755 --- a/shared/src/main/scala/scala/xml/Utility.scala +++ b/shared/src/main/scala/scala/xml/Utility.scala @@ -24,7 +24,7 @@ import scala.collection.Seq * @author Burak Emir */ object Utility extends AnyRef with parsing.TokenTests { - final val SU = '\u001A' + final val SU: Char = '\u001A' // [Martin] This looks dubious. We don't convert StringBuilders to // Strings anywhere else, why do it here? @@ -32,12 +32,12 @@ object Utility extends AnyRef with parsing.TokenTests { // helper for the extremely oft-repeated sequence of creating a // StringBuilder, passing it around, and then grabbing its String. - private[xml] def sbToString(f: (StringBuilder) => Unit): String = { - val sb = new StringBuilder + private[xml] def sbToString(f: StringBuilder => Unit): String = { + val sb: StringBuilder = new StringBuilder f(sb) sb.toString } - private[xml] def isAtomAndNotText(x: Node) = x.isAtom && !x.isInstanceOf[Text] + private[xml] def isAtomAndNotText(x: Node): Boolean = x.isAtom && !x.isInstanceOf[Text] /** * Trims an element - call this method, when you know that it is an @@ -50,7 +50,7 @@ object Utility extends AnyRef with parsing.TokenTests { */ def trim(x: Node): Node = x match { case Elem(pre, lab, md, scp, child@_*) => - val children = combineAdjacentTextNodes(child) flatMap trimProper + val children: Seq[Node] = combineAdjacentTextNodes(child) flatMap trimProper Elem(pre, lab, md, scp, children.isEmpty, children: _*) } @@ -67,7 +67,7 @@ object Utility extends AnyRef with parsing.TokenTests { */ def trimProper(x: Node): Seq[Node] = x match { case Elem(pre, lab, md, scp, child@_*) => - val children = combineAdjacentTextNodes(child) flatMap trimProper + val children: Seq[Node] = combineAdjacentTextNodes(child) flatMap trimProper Elem(pre, lab, md, scp, children.isEmpty, children: _*) case Text(s) => new TextBuffer().append(s).toText @@ -77,9 +77,9 @@ object Utility extends AnyRef with parsing.TokenTests { /** returns a sorted attribute list */ def sort(md: MetaData): MetaData = if ((md eq Null) || (md.next eq Null)) md else { - val key = md.key - val smaller = sort(md.filter { m => m.key < key }) - val greater = sort(md.filter { m => m.key > key }) + val key: String = md.key + val smaller: MetaData = sort(md.filter { m => m.key < key }) + val greater: MetaData = sort(md.filter { m => m.key > key }) smaller.foldRight (md copy greater) ((x, xs) => x copy xs) } @@ -89,7 +89,7 @@ object Utility extends AnyRef with parsing.TokenTests { */ def sort(n: Node): Node = n match { case Elem(pre, lab, md, scp, child@_*) => - val children = child map sort + val children: Seq[Node] = child map sort Elem(pre, lab, sort(md), scp, children.isEmpty, children: _*) case _ => n } @@ -104,15 +104,15 @@ object Utility extends AnyRef with parsing.TokenTests { * For reasons unclear escape and unescape are a long ways from * being logical inverses. */ - val pairs = Map( + val pairs: Map[String, Char] = Map( "lt" -> '<', "gt" -> '>', "amp" -> '&', "quot" -> '"', "apos" -> '\'' ) - val escMap = (pairs - "apos") map { case (s, c) => c -> ("&%s;" format s) } - val unescMap = pairs + val escMap: Map[Char, String] = (pairs - "apos") map { case (s, c) => c -> ("&%s;" format s) } + val unescMap: Map[String, Char] = pairs } import Escapes.{ escMap, unescMap } @@ -252,11 +252,11 @@ object Utility extends AnyRef with parsing.TokenTests { { if (children.isEmpty) () else if (children forall isAtomAndNotText) { // add space - val it = children.iterator - val f = it.next() + val it: Iterator[Node] = children.iterator + val f: Node = it.next() serialize(f, pscope, sb, stripComments, decodeEntities, preserveWhitespace, minimizeTags) while (it.hasNext) { - val x = it.next() + val x: Node = it.next() sb.append(' ') serialize(x, pscope, sb, stripComments, decodeEntities, preserveWhitespace, minimizeTags) } @@ -274,7 +274,7 @@ object Utility extends AnyRef with parsing.TokenTests { /** * Returns a hashcode for the given constituents of a node */ - def hashCode(pre: String, label: String, attribHashCode: Int, scpeHash: Int, children: Seq[Node]) = + def hashCode(pre: String, label: String, attribHashCode: Int, scpeHash: Int, children: Seq[Node]): Int = scala.util.hashing.MurmurHash3.orderedHash(label +: attribHashCode +: scpeHash +: children, pre.##) def appendQuoted(s: String): String = sbToString(appendQuoted(s, _)) @@ -283,8 +283,8 @@ object Utility extends AnyRef with parsing.TokenTests { * Appends "s" if string `s` does not contain ", * 's' otherwise. */ - def appendQuoted(s: String, sb: StringBuilder) = { - val ch = if (s contains '"') '\'' else '"' + def appendQuoted(s: String, sb: StringBuilder): StringBuilder = { + val ch: Char = if (s contains '"') '\'' else '"' sb.append(ch).append(s).append(ch) } @@ -304,7 +304,7 @@ object Utility extends AnyRef with parsing.TokenTests { def getName(s: String, index: Int): String = { if (index >= s.length) null else { - val xs = s drop index + val xs: String = s drop index if (xs.nonEmpty && isNameStart(xs.head)) xs takeWhile isNameChar else "" } @@ -315,13 +315,13 @@ object Utility extends AnyRef with parsing.TokenTests { * error message if it isn't. */ def checkAttributeValue(value: String): String = { - var i = 0 + var i: Int = 0 while (i < value.length) { value.charAt(i) match { case '<' => return "< not allowed in attribute value" case '&' => - val n = getName(value, i + 1) + val n: String = getName(value, i + 1) if (n eq null) return "malformed entity reference in attribute value [" + value + "]" i = i + n.length + 1 @@ -335,19 +335,19 @@ object Utility extends AnyRef with parsing.TokenTests { } def parseAttributeValue(value: String): Seq[Node] = { - val sb = new StringBuilder + val sb: StringBuilder = new StringBuilder var rfb: StringBuilder = null - val nb = new NodeBuffer() + val nb: NodeBuffer = new NodeBuffer() - val it = value.iterator + val it: Iterator[Char] = value.iterator while (it.hasNext) { - var c = it.next() + var c: Char = it.next() // entity! flush buffer into text node if (c == '&') { c = it.next() if (c == '#') { c = it.next() - val theChar = parseCharRef ({ () => c }, { () => c = it.next() }, { s => throw new RuntimeException(s) }, { s => throw new RuntimeException(s) }) + val theChar: String = parseCharRef ({ () => c }, { () => c = it.next() }, { s => throw new RuntimeException(s) }, { s => throw new RuntimeException(s) }) sb.append(theChar) } else { if (rfb eq null) rfb = new StringBuilder() @@ -357,7 +357,7 @@ object Utility extends AnyRef with parsing.TokenTests { rfb.append(c) c = it.next() } - val ref = rfb.toString() + val ref: String = rfb.toString() rfb.clear() unescape(ref, sb) match { case null => @@ -372,7 +372,7 @@ object Utility extends AnyRef with parsing.TokenTests { } else sb append c } if (sb.nonEmpty) { // flush buffer - val x = Text(sb.toString()) + val x: Text = Text(sb.toString()) if (nb.isEmpty) return x else @@ -389,9 +389,9 @@ object Utility extends AnyRef with parsing.TokenTests { * See [66] */ def parseCharRef(ch: () => Char, nextch: () => Unit, reportSyntaxError: String => Unit, reportTruncatedError: String => Unit): String = { - val hex = (ch() == 'x') && { nextch(); true } - val base = if (hex) 16 else 10 - var i = 0 + val hex: Boolean = (ch() == 'x') && { nextch(); true } + val base: Int = if (hex) 16 else 10 + var i: Int = 0 while (ch() != ';') { ch() match { case '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9' => diff --git a/shared/src/main/scala/scala/xml/XML.scala b/shared/src/main/scala/scala/xml/XML.scala index 531afcc97..9838d1505 100755 --- a/shared/src/main/scala/scala/xml/XML.scala +++ b/shared/src/main/scala/scala/xml/XML.scala @@ -14,20 +14,19 @@ package scala package xml import factory.XMLLoader -import java.io.{File, FileDescriptor, FileInputStream, FileOutputStream} -import java.io.{InputStream, Reader, StringReader} +import java.io.{File, FileDescriptor, FileInputStream, FileOutputStream, InputStream, Reader, StringReader, Writer} import java.nio.channels.Channels import scala.util.control.Exception.ultimately object Source { - def fromFile(file: File) = new InputSource(new FileInputStream(file)) - def fromFile(fd: FileDescriptor) = new InputSource(new FileInputStream(fd)) - def fromFile(name: String) = new InputSource(new FileInputStream(name)) + def fromFile(file: File): InputSource = new InputSource(new FileInputStream(file)) + def fromFile(fd: FileDescriptor): InputSource = new InputSource(new FileInputStream(fd)) + def fromFile(name: String): InputSource = new InputSource(new FileInputStream(name)) - def fromInputStream(is: InputStream) = new InputSource(is) - def fromReader(reader: Reader) = new InputSource(reader) - def fromSysId(sysID: String) = new InputSource(sysID) - def fromString(string: String) = fromReader(new StringReader(string)) + def fromInputStream(is: InputStream): InputSource = new InputSource(is) + def fromReader(reader: Reader): InputSource = new InputSource(reader) + def fromSysId(sysID: String): InputSource = new InputSource(sysID) + def fromString(string: String): InputSource = fromReader(new StringReader(string)) } /** @@ -38,18 +37,18 @@ object MinimizeMode extends Enumeration { * Minimize empty tags if they were originally empty when parsed, or if they were constructed * with [[scala.xml.Elem]]`#minimizeEmpty` == true */ - val Default = Value + val Default: Value = Value /** * Always minimize empty tags. Note that this may be problematic for XHTML, in which * case [[scala.xml.Xhtml]]`#toXhtml` should be used instead. */ - val Always = Value + val Always: Value = Value /** * Never minimize empty tags. */ - val Never = Value + val Never: Value = Value } /** @@ -60,13 +59,13 @@ object MinimizeMode extends Enumeration { * @author Burak Emir */ object XML extends XMLLoader[Elem] { - val xml = "xml" - val xmlns = "xmlns" - val namespace = "http://www.w3.org/XML/1998/namespace" - val preserve = "preserve" - val space = "space" - val lang = "lang" - val encoding = "UTF-8" + val xml: String = "xml" + val xmlns: String = "xmlns" + val namespace: String = "http://www.w3.org/XML/1998/namespace" + val preserve: String = "preserve" + val space: String = "space" + val lang: String = "lang" + val encoding: String = "UTF-8" /** Returns an XMLLoader whose load* methods will use the supplied SAXParser. */ def withSAXParser(p: SAXParser): XMLLoader[Elem] = @@ -97,8 +96,8 @@ object XML extends XMLLoader[Elem] { xmlDecl: Boolean = false, doctype: dtd.DocType = null): Unit = { - val fos = new FileOutputStream(filename) - val w = Channels.newWriter(fos.getChannel, enc) + val fos: FileOutputStream = new FileOutputStream(filename) + val w: Writer = Channels.newWriter(fos.getChannel, enc) ultimately(w.close())( write(w, node, enc, xmlDecl, doctype) diff --git a/shared/src/main/scala/scala/xml/Xhtml.scala b/shared/src/main/scala/scala/xml/Xhtml.scala index c0ec1d3b9..962a4d734 100644 --- a/shared/src/main/scala/scala/xml/Xhtml.scala +++ b/shared/src/main/scala/scala/xml/Xhtml.scala @@ -39,7 +39,7 @@ object Xhtml { * Elements which we believe are safe to minimize if minimizeTags is true. * See http://www.w3.org/TR/xhtml1/guidelines.html#C_3 */ - private val minimizableElements = + private val minimizableElements: List[String] = List("base", "meta", "link", "hr", "br", "param", "img", "area", "input", "col") def toXhtml( @@ -51,11 +51,11 @@ object Xhtml { preserveWhitespace: Boolean = false, minimizeTags: Boolean = true): Unit = { - def decode(er: EntityRef) = XhtmlEntities.entMap.get(er.entityName) match { + def decode(er: EntityRef): StringBuilder = XhtmlEntities.entMap.get(er.entityName) match { case Some(chr) if chr.toInt >= 128 => sb.append(chr) case _ => er.buildString(sb) } - def shortForm = + def shortForm: Boolean = minimizeTags && (x.child == null || x.child.isEmpty) && (minimizableElements contains x.label) @@ -99,7 +99,7 @@ object Xhtml { if (children.isEmpty) return - val doSpaces = children forall isAtomAndNotText // interleave spaces + val doSpaces: Boolean = children forall isAtomAndNotText // interleave spaces for (c <- children.take(children.length - 1)) { toXhtml(c, pscope, sb, stripComments, decodeEntities, preserveWhitespace, minimizeTags) if (doSpaces) sb append ' ' diff --git a/shared/src/main/scala/scala/xml/dtd/ContentModel.scala b/shared/src/main/scala/scala/xml/dtd/ContentModel.scala index 2f8506b8e..ad944b0e9 100644 --- a/shared/src/main/scala/scala/xml/dtd/ContentModel.scala +++ b/shared/src/main/scala/scala/xml/dtd/ContentModel.scala @@ -38,11 +38,11 @@ object ContentModel extends WordExp { } case class ElemName(name: String) extends Label { - override def toString = """ElemName("%s")""" format name + override def toString: String = """ElemName("%s")""" format name } - def isMixed(cm: ContentModel) = cond(cm) { case _: MIXED => true } - def containsText(cm: ContentModel) = (cm == PCDATA) || isMixed(cm) + def isMixed(cm: ContentModel): Boolean = cond(cm) { case _: MIXED => true } + def containsText(cm: ContentModel): Boolean = (cm == PCDATA) || isMixed(cm) def getLabels(r: RegExp): Set[String] = { def traverse(r: RegExp): Set[String] = r match { // !!! check for match translation problem @@ -105,11 +105,11 @@ case object ANY extends ContentModel { override def buildString(sb: StringBuilder): StringBuilder = sb.append("ANY") } sealed abstract class DFAContentModel extends ContentModel { - import ContentModel.{ ElemName, Translator } + import ContentModel.{ElemName, Translator} def r: RegExp lazy val dfa: DetWordAutom[ElemName] = { - val nfa = Translator.automatonFrom(r, 1) + val nfa: NondetWordAutom[ElemName] = Translator.automatonFrom(r, 1) new SubsetConstruction(nfa).determinize } } @@ -118,7 +118,7 @@ case class MIXED(override val r: RegExp) extends DFAContentModel { import ContentModel.Alt override def buildString(sb: StringBuilder): StringBuilder = { - val newAlt = r match { case Alt(rs@_*) => Alt(rs drop 1: _*) } + val newAlt: Alt = r match { case Alt(rs@_*) => Alt(rs drop 1: _*) } sb append "(#PCDATA|" ContentModel.buildString(newAlt: RegExp, sb) diff --git a/shared/src/main/scala/scala/xml/dtd/DTD.scala b/shared/src/main/scala/scala/xml/dtd/DTD.scala index 996e7f325..6c5772210 100644 --- a/shared/src/main/scala/scala/xml/dtd/DTD.scala +++ b/shared/src/main/scala/scala/xml/dtd/DTD.scala @@ -23,7 +23,7 @@ import scala.collection.Seq * @author Burak Emir */ abstract class DTD { - var externalID: ExternalID = null + var externalID: ExternalID = _ var decls: List[Decl] = Nil def notations: Seq[NotationDecl] = Nil def unparsedEntities: Seq[EntityDecl] = Nil @@ -32,7 +32,7 @@ abstract class DTD { var attr: mutable.Map[String, AttListDecl] = new mutable.HashMap[String, AttListDecl]() var ent: mutable.Map[String, EntityDecl] = new mutable.HashMap[String, EntityDecl]() - override def toString = + override def toString: String = "DTD [\n%s%s]".format( Option(externalID).getOrElse(""), decls.mkString("", "\n", "\n") diff --git a/shared/src/main/scala/scala/xml/dtd/Decl.scala b/shared/src/main/scala/scala/xml/dtd/Decl.scala index 80ebc20d8..0a1ded00e 100644 --- a/shared/src/main/scala/scala/xml/dtd/Decl.scala +++ b/shared/src/main/scala/scala/xml/dtd/Decl.scala @@ -109,14 +109,14 @@ sealed abstract class EntityDef { case class IntDef(value: String) extends EntityDef { private def validateValue(): Unit = { - var tmp = value - var ix = tmp indexOf '%' + var tmp: String = value + var ix: Int = tmp indexOf '%' while (ix != -1) { - val iz = tmp.indexOf(';', ix) + val iz: Int = tmp.indexOf(';', ix) if (iz == -1 && iz == ix + 1) throw new IllegalArgumentException("no % allowed in entity value, except for parameter-entity-references") else { - val n = tmp.substring(ix, iz) + val n: String = tmp.substring(ix, iz) if (!Utility.isName(n)) throw new IllegalArgumentException("internal entity def: \"" + n + "\" must be an XML Name") @@ -156,12 +156,12 @@ sealed abstract class DefaultDecl { case object REQUIRED extends DefaultDecl { override def toString(): String = "#REQUIRED" - override def buildString(sb: StringBuilder) = sb append "#REQUIRED" + override def buildString(sb: StringBuilder): StringBuilder = sb append "#REQUIRED" } case object IMPLIED extends DefaultDecl { override def toString(): String = "#IMPLIED" - override def buildString(sb: StringBuilder) = sb append "#IMPLIED" + override def buildString(sb: StringBuilder): StringBuilder = sb append "#IMPLIED" } case class DEFAULT(fixed: Boolean, attValue: String) extends DefaultDecl { diff --git a/shared/src/main/scala/scala/xml/dtd/DocType.scala b/shared/src/main/scala/scala/xml/dtd/DocType.scala index 62161a566..6a6c6e9e7 100644 --- a/shared/src/main/scala/scala/xml/dtd/DocType.scala +++ b/shared/src/main/scala/scala/xml/dtd/DocType.scala @@ -30,8 +30,8 @@ case class DocType(name: String, extID: ExternalID, intSubset: Seq[dtd.Decl]) { throw new IllegalArgumentException(name + " must be an XML Name") /** returns "<!DOCTYPE + name + extID? + ("["+intSubSet+"]")? >" */ - final override def toString = { - def intString = + final override def toString: String = { + def intString: String = if (intSubset.isEmpty) "" else intSubset.mkString("[", "", "]") diff --git a/shared/src/main/scala/scala/xml/dtd/ExternalID.scala b/shared/src/main/scala/scala/xml/dtd/ExternalID.scala index 7344e4034..2bd80c803 100644 --- a/shared/src/main/scala/scala/xml/dtd/ExternalID.scala +++ b/shared/src/main/scala/scala/xml/dtd/ExternalID.scala @@ -20,16 +20,16 @@ package dtd * @author Burak Emir */ sealed abstract class ExternalID extends parsing.TokenTests { - def quoted(s: String) = { - val c = if (s contains '"') '\'' else '"' + def quoted(s: String): String = { + val c: Char = if (s contains '"') '\'' else '"' c.toString + s + c } // public != null: PUBLIC " " publicLiteral " " [systemLiteral] // public == null: SYSTEM " " systemLiteral override def toString: String = { - lazy val quotedSystemLiteral = quoted(systemId) - lazy val quotedPublicLiteral = quoted(publicId) + lazy val quotedSystemLiteral: String = quoted(systemId) + lazy val quotedPublicLiteral: String = quoted(publicId) if (publicId == null) "SYSTEM " + quotedSystemLiteral else "PUBLIC " + quotedPublicLiteral + @@ -49,7 +49,7 @@ sealed abstract class ExternalID extends parsing.TokenTests { * @param systemId the system identifier literal */ case class SystemID(override val systemId: String) extends ExternalID { - override val publicId = null + override val publicId: scala.Null = null if (!checkSysID(systemId)) throw new IllegalArgumentException("can't use both \" and ' in systemId") @@ -70,13 +70,13 @@ case class PublicID(override val publicId: String, override val systemId: String throw new IllegalArgumentException("can't use both \" and ' in systemId") /** the constant "#PI" */ - def label = "#PI" + def label: String = "#PI" /** always empty */ - def attribute = Node.NoAttributes + def attribute: MetaData = Node.NoAttributes /** always empty */ - def child = Nil + def child: Nil.type = Nil } /** @@ -85,8 +85,8 @@ case class PublicID(override val publicId: String, override val systemId: String * @author Michael Bayne */ object NoExternalID extends ExternalID { - override val publicId = null - override val systemId = null + override val publicId /* TODO type annotation */ = null + override val systemId /* TODO type annotation */ = null - override def toString = "" + override def toString: String = "" } diff --git a/shared/src/main/scala/scala/xml/dtd/Tokens.scala b/shared/src/main/scala/scala/xml/dtd/Tokens.scala index 9d6542a16..48696af58 100644 --- a/shared/src/main/scala/scala/xml/dtd/Tokens.scala +++ b/shared/src/main/scala/scala/xml/dtd/Tokens.scala @@ -18,17 +18,17 @@ class Tokens { // Tokens - final val TOKEN_PCDATA = 0 - final val NAME = 1 - final val LPAREN = 3 - final val RPAREN = 4 - final val COMMA = 5 - final val STAR = 6 - final val PLUS = 7 - final val OPT = 8 - final val CHOICE = 9 - final val END = 10 - final val S = 13 + final val TOKEN_PCDATA: Int = 0 + final val NAME: Int = 1 + final val LPAREN: Int = 3 + final val RPAREN: Int = 4 + final val COMMA: Int = 5 + final val STAR: Int = 6 + final val PLUS: Int = 7 + final val OPT: Int = 8 + final val CHOICE: Int = 9 + final val END: Int = 10 + final val S: Int = 13 final def token2string(i: Int): String = i match { case 0 => "#PCDATA" diff --git a/shared/src/main/scala/scala/xml/dtd/ValidationException.scala b/shared/src/main/scala/scala/xml/dtd/ValidationException.scala index 127f5ae2e..9b521c8ab 100644 --- a/shared/src/main/scala/scala/xml/dtd/ValidationException.scala +++ b/shared/src/main/scala/scala/xml/dtd/ValidationException.scala @@ -20,26 +20,26 @@ case class ValidationException(e: String) extends Exception(e) * @author Burak Emir */ object MakeValidationException { - def fromFixedAttribute(k: String, value: String, actual: String) = + def fromFixedAttribute(k: String, value: String, actual: String): ValidationException = ValidationException("value of attribute " + k + " FIXED to \"" + value + "\", but document tries \"" + actual + "\"") - def fromNonEmptyElement() = + def fromNonEmptyElement(): ValidationException = ValidationException("element should be *empty*") - def fromUndefinedElement(label: String) = + def fromUndefinedElement(label: String): ValidationException = ValidationException("element \"" + label + "\" not allowed here") - def fromUndefinedAttribute(key: String) = + def fromUndefinedAttribute(key: String): ValidationException = ValidationException("attribute " + key + " not allowed here") - def fromMissingAttribute(allKeys: Set[String]) = { - val sb = new StringBuilder("missing value for REQUIRED attribute") + def fromMissingAttribute(allKeys: Set[String]): ValidationException = { + val sb: StringBuilder = new StringBuilder("missing value for REQUIRED attribute") if (allKeys.size > 1) sb.append('s') allKeys foreach (k => sb append "'%s'".format(k)) ValidationException(sb.toString()) } - def fromMissingAttribute(key: String, tpe: String) = + def fromMissingAttribute(key: String, tpe: String): ValidationException = ValidationException("missing value for REQUIRED attribute %s of type %s".format(key, tpe)) } diff --git a/shared/src/main/scala/scala/xml/dtd/impl/Base.scala b/shared/src/main/scala/scala/xml/dtd/impl/Base.scala index 4dffb7830..8180459be 100644 --- a/shared/src/main/scala/scala/xml/dtd/impl/Base.scala +++ b/shared/src/main/scala/scala/xml/dtd/impl/Base.scala @@ -29,41 +29,41 @@ private[dtd] abstract class Base { object Alt { /** `Alt( R,R,R* )`. */ - def apply(rs: _regexpT*) = + def apply(rs: _regexpT*): Alt = if (rs.size < 2) throw new SyntaxError("need at least 2 branches in Alt") else new Alt(rs: _*) // Can't enforce that statically without changing the interface // def apply(r1: _regexpT, r2: _regexpT, rs: _regexpT*) = new Alt(Seq(r1, r2) ++ rs: _*) - def unapplySeq(x: Alt) = Some(x.rs) + def unapplySeq(x: Alt): Some[Seq[_regexpT]] = Some(x.rs) } class Alt private (val rs: _regexpT*) extends RegExp { - final override val isNullable = rs exists (_.isNullable) + final override val isNullable: Boolean = rs exists (_.isNullable) } object Sequ { /** Sequ( R,R* ) */ - def apply(rs: _regexpT*) = if (rs.isEmpty) Eps else new Sequ(rs: _*) - def unapplySeq(x: Sequ) = Some(x.rs) + def apply(rs: _regexpT*): RegExp = if (rs.isEmpty) Eps else new Sequ(rs: _*) + def unapplySeq(x: Sequ): Some[Seq[_regexpT]] = Some(x.rs) } class Sequ private (val rs: _regexpT*) extends RegExp { - final override val isNullable = rs forall (_.isNullable) + final override val isNullable: Boolean = rs forall (_.isNullable) } case class Star(r: _regexpT) extends RegExp { - final override lazy val isNullable = true + final override lazy val isNullable: Boolean = true } // The empty Sequ. case object Eps extends RegExp { - final override lazy val isNullable = true - override def toString = "Eps" + final override lazy val isNullable: Boolean = true + override def toString: String = "Eps" } /** this class can be used to add meta information to regexps. */ class Meta(r1: _regexpT) extends RegExp { - final override val isNullable = r1.isNullable - def r = r1 + final override val isNullable: Boolean = r1.isNullable + def r: _regexpT = r1 } } diff --git a/shared/src/main/scala/scala/xml/dtd/impl/BaseBerrySethi.scala b/shared/src/main/scala/scala/xml/dtd/impl/BaseBerrySethi.scala index 84ea9fdb0..9d515938c 100644 --- a/shared/src/main/scala/scala/xml/dtd/impl/BaseBerrySethi.scala +++ b/shared/src/main/scala/scala/xml/dtd/impl/BaseBerrySethi.scala @@ -28,7 +28,7 @@ private[dtd] abstract class BaseBerrySethi { val lang: Base import lang.{ Alt, Eps, Meta, RegExp, Sequ, Star } - protected var pos = 0 + protected var pos: Int = 0 // results which hold all info for the NondetWordAutomaton protected var follow: mutable.HashMap[Int, Set[Int]] = _ @@ -41,12 +41,12 @@ private[dtd] abstract class BaseBerrySethi { final val emptySet: Set[Int] = Set() - private def doComp(r: RegExp, compFunction: RegExp => Set[Int]) = r match { + private def doComp(r: RegExp, compFunction: RegExp => Set[Int]): Set[Int] = r match { case x: Alt => (x.rs map compFirst).foldLeft(emptySet)(_ ++ _) case Eps => emptySet case x: Meta => compFunction(x.r) case x: Sequ => - val (l1, l2) = x.rs span (_.isNullable) + val (l1: Seq[lang._regexpT], l2: Seq[lang._regexpT]) = x.rs span (_.isNullable) ((l1 ++ (l2 take 1)) map compFunction).foldLeft(emptySet)(_ ++ _) case Star(t) => compFunction(t) case _ => throw new IllegalArgumentException("unexpected pattern " + r.getClass) @@ -67,7 +67,7 @@ private[dtd] abstract class BaseBerrySethi { follow(0) = if (rs.isEmpty) emptySet else rs.foldRight(Set(pos))((p, fol) => { - val first = compFollow1(fol, p) + val first: Set[Int] = compFollow1(fol, p) if (p.isNullable) fol ++ first else first @@ -85,7 +85,7 @@ private[dtd] abstract class BaseBerrySethi { case x: Star => compFollow1(fol1 ++ compFirst(x.r), x.r) case x: Sequ => x.rs.foldRight(fol1) { (p, fol) => - val first = compFollow1(fol, p) + val first: Set[Int] = compFollow1(fol, p) if (p.isNullable) fol ++ first else first diff --git a/shared/src/main/scala/scala/xml/dtd/impl/DetWordAutom.scala b/shared/src/main/scala/scala/xml/dtd/impl/DetWordAutom.scala index 26fd06e07..56df1f9f5 100644 --- a/shared/src/main/scala/scala/xml/dtd/impl/DetWordAutom.scala +++ b/shared/src/main/scala/scala/xml/dtd/impl/DetWordAutom.scala @@ -30,15 +30,15 @@ private[dtd] abstract class DetWordAutom[T <: AnyRef] { val delta: Array[scala.collection.mutable.Map[T, Int]] val default: Array[Int] - def isFinal(q: Int) = finals(q) != 0 - def isSink(q: Int) = delta(q).isEmpty && default(q) == q - def next(q: Int, label: T) = delta(q).getOrElse(label, default(q)) + def isFinal(q: Int): Boolean = finals(q) != 0 + def isSink(q: Int): Boolean = delta(q).isEmpty && default(q) == q + def next(q: Int, label: T): Int = delta(q).getOrElse(label, default(q)) - override def toString = { - val sb = new StringBuilder("[DetWordAutom nstates=") + override def toString: String = { + val sb: StringBuilder = new StringBuilder("[DetWordAutom nstates=") sb.append(nstates) sb.append(" finals=") - val map = finals.zipWithIndex.map(_.swap).toMap + val map: Map[Int, Int] = finals.zipWithIndex.map(_.swap).toMap sb.append(map.toString()) sb.append(" delta=\n") diff --git a/shared/src/main/scala/scala/xml/dtd/impl/Inclusion.scala b/shared/src/main/scala/scala/xml/dtd/impl/Inclusion.scala index 45d984ff0..67ea19e4b 100644 --- a/shared/src/main/scala/scala/xml/dtd/impl/Inclusion.scala +++ b/shared/src/main/scala/scala/xml/dtd/impl/Inclusion.scala @@ -29,30 +29,30 @@ private[dtd] trait Inclusion[A <: AnyRef] { /** * Returns true if `dfa1` is included in `dfa2`. */ - def inclusion(dfa1: DetWordAutom[A], dfa2: DetWordAutom[A]) = { + def inclusion(dfa1: DetWordAutom[A], dfa2: DetWordAutom[A]): Boolean = { - def encode(q1: Int, q2: Int) = 1 + q1 + q2 * dfa1.nstates - def decode2(c: Int) = (c - 1) / dfa1.nstates //integer division - def decode1(c: Int) = (c - 1) % dfa1.nstates + def encode(q1: Int, q2: Int): Int = 1 + q1 + q2 * dfa1.nstates + def decode2(c: Int): Int = (c - 1) / dfa1.nstates //integer division + def decode1(c: Int): Int = (c - 1) % dfa1.nstates - var q1 = 0 //dfa1.initstate; // == 0 - var q2 = 0 //dfa2.initstate; // == 0 + var q1: Int = 0 //dfa1.initstate; // == 0 + var q2: Int = 0 //dfa2.initstate; // == 0 - val max = 1 + dfa1.nstates * dfa2.nstates - val mark = new Array[Int](max) + val max: Int = 1 + dfa1.nstates * dfa2.nstates + val mark: Array[Int] = new Array[Int](max) - var result = true - var current = encode(q1, q2) - var last = current + var result: Boolean = true + var current: Int = encode(q1, q2) + var last: Int = current mark(last) = max // mark (q1,q2) while (current != 0 && result) { //Console.println("current = [["+q1+" "+q2+"]] = "+current); for (letter <- labels) { - val r1 = dfa1.next(q1, letter) - val r2 = dfa2.next(q2, letter) + val r1: Int = dfa1.next(q1, letter) + val r2: Int = dfa2.next(q2, letter) if (dfa1.isFinal(r1) && !dfa2.isFinal(r2)) result = false - val test = encode(r1, r2) + val test: Int = encode(r1, r2) //Console.println("test = [["+r1+" "+r2+"]] = "+test); if (mark(test) == 0) { mark(last) = test @@ -60,7 +60,7 @@ private[dtd] trait Inclusion[A <: AnyRef] { last = test } } - val ncurrent = mark(current) + val ncurrent: Int = mark(current) if (ncurrent != max) { q1 = decode1(ncurrent) q2 = decode2(ncurrent) diff --git a/shared/src/main/scala/scala/xml/dtd/impl/NondetWordAutom.scala b/shared/src/main/scala/scala/xml/dtd/impl/NondetWordAutom.scala index 306f64c0f..e12a72a2f 100644 --- a/shared/src/main/scala/scala/xml/dtd/impl/NondetWordAutom.scala +++ b/shared/src/main/scala/scala/xml/dtd/impl/NondetWordAutom.scala @@ -13,7 +13,7 @@ package scala package xml.dtd.impl -import scala.collection.{ immutable, mutable } +import scala.collection.{immutable, mutable} import scala.collection.Seq /** @@ -33,16 +33,16 @@ private[dtd] abstract class NondetWordAutom[T <: AnyRef] { val default: Array[immutable.BitSet] /** @return true if the state is final */ - final def isFinal(state: Int) = finals(state) > 0 + final def isFinal(state: Int): Boolean = finals(state) > 0 /** @return tag of final state */ - final def finalTag(state: Int) = finals(state) + final def finalTag(state: Int): Int = finals(state) /** @return true if the set of states contains at least one final state */ final def containsFinal(Q: immutable.BitSet): Boolean = Q exists isFinal /** @return true if there are no accepting states */ - final def isEmpty = (0 until nstates) forall (x => !isFinal(x)) + final def isEmpty: Boolean = (0 until nstates) forall (x => !isFinal(x)) /** @return a immutable.BitSet with the next states for given state and label */ def next(q: Int, a: T): immutable.BitSet = delta(q).getOrElse(a, default(q)) @@ -51,14 +51,14 @@ private[dtd] abstract class NondetWordAutom[T <: AnyRef] { def next(Q: immutable.BitSet, a: T): immutable.BitSet = next(Q, next(_, a)) def nextDefault(Q: immutable.BitSet): immutable.BitSet = next(Q, default) - private def next(Q: immutable.BitSet, f: (Int) => immutable.BitSet): immutable.BitSet = + private def next(Q: immutable.BitSet, f: Int => immutable.BitSet): immutable.BitSet = Q.toSet.map(f).foldLeft(immutable.BitSet.empty)(_ ++ _) - private def finalStates = 0 until nstates filter isFinal - override def toString = { + private def finalStates: immutable.Seq[Int] = 0 until nstates filter isFinal + override def toString: String = { - val finalString = Map(finalStates map (j => j -> finals(j)): _*).toString - val deltaString = (0 until nstates) + val finalString: String = Map(finalStates map (j => j -> finals(j)): _*).toString + val deltaString: String = (0 until nstates) .map(i => " %d->%s\n _>%s\n".format(i, delta(i), default(i))).mkString "[NondetWordAutom nstates=%d finals=%s delta=\n%s".format(nstates, finalString, deltaString) diff --git a/shared/src/main/scala/scala/xml/dtd/impl/SubsetConstruction.scala b/shared/src/main/scala/scala/xml/dtd/impl/SubsetConstruction.scala index 38c570223..7c73932a1 100644 --- a/shared/src/main/scala/scala/xml/dtd/impl/SubsetConstruction.scala +++ b/shared/src/main/scala/scala/xml/dtd/impl/SubsetConstruction.scala @@ -13,30 +13,31 @@ package scala package xml.dtd.impl -import scala.collection.{ mutable, immutable } +import scala.collection.{immutable, mutable} // TODO: still used in ContentModel -- @deprecated("This class will be removed", "2.10.0") private[dtd] class SubsetConstruction[T <: AnyRef](val nfa: NondetWordAutom[T]) { import nfa.labels - def selectTag(Q: immutable.BitSet, finals: Array[Int]) = + def selectTag(Q: immutable.BitSet, finals: Array[Int]): Int = (Q map finals filter (_ > 0)).min def determinize: DetWordAutom[T] = { // for assigning numbers to bitsets - val indexMap = mutable.Map[immutable.BitSet, Int]() - val invIndexMap = mutable.Map[Int, immutable.BitSet]() - var ix = 0 + val indexMap: mutable.Map[immutable.BitSet, Int] = mutable.Map[immutable.BitSet, Int]() + val invIndexMap: mutable.Map[Int, immutable.BitSet] = mutable.Map[Int, immutable.BitSet]() + var ix: Int = 0 // we compute the dfa with states = bitsets - val q0 = immutable.BitSet(0) // the set { 0 } - val sink = immutable.BitSet.empty // the set { } + val q0: immutable.BitSet = immutable.BitSet(0) // the set { 0 } + val sink: immutable.BitSet = immutable.BitSet.empty // the set { } - var states = Set(q0, sink) // initial set of sets - val delta = new mutable.HashMap[immutable.BitSet, mutable.HashMap[T, immutable.BitSet]] - val deftrans = mutable.Map(q0 -> sink, sink -> sink) // initial transitions + var states: Set[immutable.BitSet] = Set(q0, sink) // initial set of sets + val delta: mutable.HashMap[immutable.BitSet, mutable.HashMap[T, immutable.BitSet]] = + new mutable.HashMap[immutable.BitSet, mutable.HashMap[T, immutable.BitSet]] + val deftrans: mutable.Map[immutable.BitSet, immutable.BitSet] = mutable.Map(q0 -> sink, sink -> sink) // initial transitions val finals: mutable.Map[immutable.BitSet, Int] = mutable.Map() - var rest = immutable.List.empty[immutable.BitSet] + var rest: immutable.List[immutable.BitSet] = immutable.List.empty[immutable.BitSet] rest = q0 :: sink :: rest @@ -55,7 +56,7 @@ private[dtd] class SubsetConstruction[T <: AnyRef](val nfa: NondetWordAutom[T]) addFinal(q0) // initial state may also be a final state while (rest.nonEmpty) { - val P = rest.head + val P: immutable.BitSet = rest.head rest = rest.tail // assign a number to this bitset indexMap(P) = ix @@ -63,36 +64,36 @@ private[dtd] class SubsetConstruction[T <: AnyRef](val nfa: NondetWordAutom[T]) ix += 1 // make transition map - val Pdelta = new mutable.HashMap[T, immutable.BitSet] + val Pdelta: mutable.HashMap[T, immutable.BitSet] = new mutable.HashMap[T, immutable.BitSet] delta.update(P, Pdelta) labels foreach { label => - val Q = nfa.next(P, label) + val Q: immutable.BitSet = nfa.next(P, label) Pdelta.update(label, Q) add(Q) } // collect default transitions - val Pdef = nfa nextDefault P + val Pdef: immutable.BitSet = nfa nextDefault P deftrans(P) = Pdef add(Pdef) } // create DetWordAutom, using indices instead of sets - val nstatesR = states.size - val deltaR = new Array[mutable.Map[T, Int]](nstatesR) - val defaultR = new Array[Int](nstatesR) - val finalsR = new Array[Int](nstatesR) + val nstatesR: Int = states.size + val deltaR: Array[mutable.Map[T, Int]] = new Array[mutable.Map[T, Int]](nstatesR) + val defaultR: Array[Int] = new Array[Int](nstatesR) + val finalsR: Array[Int] = new Array[Int](nstatesR) for (Q <- states) { - val q = indexMap(Q) - val trans = delta(Q) - val transDef = deftrans(Q) - val qDef = indexMap(transDef) - val ntrans = new mutable.HashMap[T, Int]() + val q: Int = indexMap(Q) + val trans: mutable.Map[T, immutable.BitSet] = delta(Q) + val transDef: immutable.BitSet = deftrans(Q) + val qDef: Int = indexMap(transDef) + val ntrans: mutable.Map[T, Int] = new mutable.HashMap[T, Int]() for ((label, value) <- trans) { - val p = indexMap(value) + val p: Int = indexMap(value) if (p != qDef) ntrans.update(label, p) } @@ -104,10 +105,10 @@ private[dtd] class SubsetConstruction[T <: AnyRef](val nfa: NondetWordAutom[T]) finals foreach { case (k, v) => finalsR(indexMap(k)) = v } new DetWordAutom[T] { - override val nstates = nstatesR - override val delta = deltaR - override val default = defaultR - override val finals = finalsR + override val nstates: Int = nstatesR + override val delta: Array[mutable.Map[T, Int]] = deltaR + override val default: Array[Int] = defaultR + override val finals: Array[Int] = finalsR } } } diff --git a/shared/src/main/scala/scala/xml/dtd/impl/WordBerrySethi.scala b/shared/src/main/scala/scala/xml/dtd/impl/WordBerrySethi.scala index 19a5880df..2e0f5cb5b 100644 --- a/shared/src/main/scala/scala/xml/dtd/impl/WordBerrySethi.scala +++ b/shared/src/main/scala/scala/xml/dtd/impl/WordBerrySethi.scala @@ -13,7 +13,7 @@ package scala package xml.dtd.impl -import scala.collection.{ immutable, mutable } +import scala.collection.{immutable, mutable} import scala.collection.Seq /** @@ -98,7 +98,7 @@ private[dtd] abstract class WordBerrySethi extends BaseBerrySethi { } protected def makeTransition(src: Int, dest: Int, label: _labelT): Unit = { - val q = deltaq(src) + val q: mutable.Map[lang._labelT, List[Int]] = deltaq(src) q.update(label, dest :: q.getOrElse(label, Nil)) } @@ -148,22 +148,22 @@ private[dtd] abstract class WordBerrySethi extends BaseBerrySethi { if (x.isNullable) // initial state is final finals = finals.updated(0, finalTag) - val delta1 = deltaq.zipWithIndex.map(_.swap).toMap - val finalsArr = (0 until pos map (k => finals.getOrElse(k, 0))).toArray // 0 == not final + val delta1: immutable.Map[Int, mutable.HashMap[lang._labelT, List[Int]]] = deltaq.zipWithIndex.map(_.swap).toMap + val finalsArr: Array[Int] = (0 until pos map (k => finals.getOrElse(k, 0))).toArray // 0 == not final val deltaArr: Array[mutable.Map[_labelT, immutable.BitSet]] = (0 until pos map { x => mutable.HashMap(delta1(x).toSeq map { case (k, v) => k -> immutable.BitSet(v: _*) }: _*) }).toArray - val defaultArr = (0 until pos map (k => immutable.BitSet(defaultq(k): _*))).toArray + val defaultArr: Array[immutable.BitSet] = (0 until pos map (k => immutable.BitSet(defaultq(k): _*))).toArray new NondetWordAutom[_labelT] { - override val nstates = pos - override val labels = WordBerrySethi.this.labels.toList - override val finals = finalsArr - override val delta = deltaArr - override val default = defaultArr + override val nstates: Int = pos + override val labels: Seq[lang._labelT] = WordBerrySethi.this.labels.toList + override val finals: Array[Int] = finalsArr + override val delta: Array[mutable.Map[lang._labelT, immutable.BitSet]] = deltaArr + override val default: Array[immutable.BitSet] = defaultArr } case z => automatonFrom(Sequ(z.asInstanceOf[this.lang._regexpT]), finalTag) diff --git a/shared/src/main/scala/scala/xml/dtd/impl/WordExp.scala b/shared/src/main/scala/scala/xml/dtd/impl/WordExp.scala index a3974ced1..c5b07d7ff 100644 --- a/shared/src/main/scala/scala/xml/dtd/impl/WordExp.scala +++ b/shared/src/main/scala/scala/xml/dtd/impl/WordExp.scala @@ -49,12 +49,12 @@ private[dtd] abstract class WordExp extends Base { type _labelT <: Label case class Letter(a: _labelT) extends RegExp { - final override lazy val isNullable = false - var pos = -1 + final override lazy val isNullable: Boolean = false + var pos: Int = -1 } case class Wildcard() extends RegExp { - final override lazy val isNullable = false - var pos = -1 + final override lazy val isNullable: Boolean = false + var pos: Int = -1 } } diff --git a/shared/src/main/scala/scala/xml/factory/NodeFactory.scala b/shared/src/main/scala/scala/xml/factory/NodeFactory.scala index 93746e611..4f83c48b9 100644 --- a/shared/src/main/scala/scala/xml/factory/NodeFactory.scala +++ b/shared/src/main/scala/scala/xml/factory/NodeFactory.scala @@ -17,16 +17,16 @@ package factory import scala.collection.Seq trait NodeFactory[A <: Node] { - val ignoreComments = false - val ignoreProcInstr = false + val ignoreComments: Boolean = false + val ignoreProcInstr: Boolean = false /* default behaviour is to use hash-consing */ - val cache = new scala.collection.mutable.HashMap[Int, List[A]] + val cache: scala.collection.mutable.HashMap[Int, List[A]] = new scala.collection.mutable.HashMap[Int, List[A]] protected def create(pre: String, name: String, attrs: MetaData, scope: NamespaceBinding, children: Seq[Node]): A protected def construct(hash: Int, old: List[A], pre: String, name: String, attrSeq: MetaData, scope: NamespaceBinding, children: Seq[Node]): A = { - val el = create(pre, name, attrSeq, scope, children) + val el: A = create(pre, name, attrSeq, scope, children) cache.update(hash, el :: old) el } @@ -42,8 +42,8 @@ trait NodeFactory[A <: Node] { eqElements(n.child, children) def makeNode(pre: String, name: String, attrSeq: MetaData, scope: NamespaceBinding, children: Seq[Node]): A = { - val hash = Utility.hashCode(pre, name, attrSeq.##, scope.##, children) - def cons(old: List[A]) = construct(hash, old, pre, name, attrSeq, scope, children) + val hash: Int = Utility.hashCode(pre, name, attrSeq.##, scope.##, children) + def cons(old: List[A]): A = construct(hash, old, pre, name, attrSeq, scope, children) cache.get(hash) match { case Some(list) => // find structurally equal diff --git a/shared/src/main/scala/scala/xml/factory/XMLLoader.scala b/shared/src/main/scala/scala/xml/factory/XMLLoader.scala index 5cdc9461e..8e7dd7455 100644 --- a/shared/src/main/scala/scala/xml/factory/XMLLoader.scala +++ b/shared/src/main/scala/scala/xml/factory/XMLLoader.scala @@ -28,9 +28,9 @@ trait XMLLoader[T <: Node] { import scala.xml.Source._ def adapter: FactoryAdapter = new NoBindingFactoryAdapter() - private lazy val parserInstance = new ThreadLocal[SAXParser] { + private lazy val parserInstance: ThreadLocal[SAXParser] = new ThreadLocal[SAXParser] { override def initialValue: SAXParser = { - val parser = SAXParserFactory.newInstance() + val parser: SAXParserFactory = SAXParserFactory.newInstance() parser.setFeature("http://javax.xml.XMLConstants/feature/secure-processing", true) parser.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false) parser.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true) diff --git a/shared/src/main/scala/scala/xml/include/CircularIncludeException.scala b/shared/src/main/scala/scala/xml/include/CircularIncludeException.scala index 07a20e3f8..ecff559df 100644 --- a/shared/src/main/scala/scala/xml/include/CircularIncludeException.scala +++ b/shared/src/main/scala/scala/xml/include/CircularIncludeException.scala @@ -25,5 +25,4 @@ class CircularIncludeException(message: String) extends XIncludeException { * as its error detail message. */ def this() = this(null) - } diff --git a/shared/src/main/scala/scala/xml/include/XIncludeException.scala b/shared/src/main/scala/scala/xml/include/XIncludeException.scala index 89f42dcce..ddc1419fc 100644 --- a/shared/src/main/scala/scala/xml/include/XIncludeException.scala +++ b/shared/src/main/scala/scala/xml/include/XIncludeException.scala @@ -32,7 +32,7 @@ class XIncludeException(message: String) extends Exception(message) { */ def this() = this(null) - private var rootCause: Throwable = null + private var rootCause: Throwable = _ /** * When an `IOException`, `MalformedURLException` or other generic @@ -58,5 +58,4 @@ class XIncludeException(message: String) extends Exception(message) { * `XIncludeException` to be thrown */ def getRootCause(): Throwable = this.rootCause - } diff --git a/shared/src/main/scala/scala/xml/include/sax/EncodingHeuristics.scala b/shared/src/main/scala/scala/xml/include/sax/EncodingHeuristics.scala index 2d4573155..fe8b0e323 100644 --- a/shared/src/main/scala/scala/xml/include/sax/EncodingHeuristics.scala +++ b/shared/src/main/scala/scala/xml/include/sax/EncodingHeuristics.scala @@ -15,6 +15,7 @@ package xml package include.sax import java.io.InputStream +import scala.util.matching.Regex /** * `EncodingHeuristics` reads from a stream @@ -29,13 +30,13 @@ import java.io.InputStream object EncodingHeuristics { object EncodingNames { // UCS-4 isn't yet implemented in java releases anyway... - val bigUCS4 = "UCS-4" - val littleUCS4 = "UCS-4" - val unusualUCS4 = "UCS-4" - val bigUTF16 = "UTF-16BE" - val littleUTF16 = "UTF-16LE" - val utf8 = "UTF-8" - val default = utf8 + val bigUCS4: String = "UCS-4" + val littleUCS4: String = "UCS-4" + val unusualUCS4: String = "UCS-4" + val bigUTF16: String = "UTF-16BE" + val littleUTF16: String = "UTF-16LE" + val utf8: String = "UTF-8" + val default: String = utf8 } import EncodingNames._ @@ -50,13 +51,13 @@ object EncodingHeuristics { */ def readEncodingFromStream(in: InputStream): String = { var ret: String = null - val bytesToRead = 1024 // enough to read most XML encoding declarations - def resetAndRet = { in.reset(); ret } + val bytesToRead: Int = 1024 // enough to read most XML encoding declarations + def resetAndRet: String = { in.reset(); ret } // This may fail if there are a lot of space characters before the end // of the encoding declaration in mark bytesToRead - val bytes = (in.read, in.read, in.read, in.read) + val bytes: (Int, Int, Int, Int) = (in.read, in.read, in.read, in.read) // first look for byte order mark ret = bytes match { @@ -73,12 +74,12 @@ object EncodingHeuristics { return resetAndRet def readASCIIEncoding: String = { - val data = new Array[Byte](bytesToRead - 4) - val length = in.read(data, 0, bytesToRead - 4) + val data: Array[Byte] = new Array[Byte](bytesToRead - 4) + val length: Int = in.read(data, 0, bytesToRead - 4) // Use Latin-1 (ISO-8859-1) because all byte sequences are legal. - val declaration = new String(data, 0, length, "ISO-8859-1") - val regexp = """(?m).*?encoding\s*=\s*["'](.+?)['"]""".r + val declaration: String = new String(data, 0, length, "ISO-8859-1") + val regexp: Regex = """(?m).*?encoding\s*=\s*["'](.+?)['"]""".r regexp.findFirstMatchIn(declaration) match { case None => default case Some(md) => md.subgroups(0) diff --git a/shared/src/main/scala/scala/xml/include/sax/XIncludeFilter.scala b/shared/src/main/scala/scala/xml/include/sax/XIncludeFilter.scala index e7929d93d..c7b22125b 100644 --- a/shared/src/main/scala/scala/xml/include/sax/XIncludeFilter.scala +++ b/shared/src/main/scala/scala/xml/include/sax/XIncludeFilter.scala @@ -15,13 +15,11 @@ package xml package include.sax import scala.xml.include._ - import org.xml.sax.{Attributes, Locator, XMLReader} import org.xml.sax.helpers.{AttributesImpl, NamespaceSupport, XMLFilterImpl, XMLReaderFactory} import java.io.{BufferedInputStream, IOException, InputStreamReader, UnsupportedEncodingException} -import java.util.Stack -import java.net.{MalformedURLException, URL} +import java.net.{MalformedURLException, URL, URLConnection} /** * This is a SAX filter which resolves all XInclude include elements before @@ -72,10 +70,10 @@ import java.net.{MalformedURLException, URL} */ class XIncludeFilter extends XMLFilterImpl { - final val XINCLUDE_NAMESPACE = "http://www.w3.org/2001/XInclude" + final val XINCLUDE_NAMESPACE: String = "http://www.w3.org/2001/XInclude" - private val bases = new Stack[URL]() - private val locators = new Stack[Locator]() + private val bases: java.util.Stack[URL] = new java.util.Stack[URL]() + private val locators: java.util.Stack[Locator] = new java.util.Stack[Locator]() /* private EntityResolver resolver; @@ -92,7 +90,7 @@ class XIncludeFilter extends XMLFilterImpl { // there???? override def setDocumentLocator(locator: Locator): Unit = { locators push locator - val base = locator.getSystemId + val base: String = locator.getSystemId try { bases.push(new URL(base)) } catch { @@ -103,7 +101,7 @@ class XIncludeFilter extends XMLFilterImpl { } // necessary to throw away contents of non-empty XInclude elements - private var level = 0 + private var level: Int = 0 /** * This utility method returns true if and only if this reader is @@ -118,14 +116,14 @@ class XIncludeFilter extends XMLFilterImpl { def insideIncludeElement(): Boolean = level != 0 override def startElement(uri: String, localName: String, qName: String, atts1: Attributes): Unit = { - var atts = atts1 + var atts: Attributes = atts1 if (level == 0) { // We're not inside an xi:include element // Adjust bases stack by pushing either the new // value of xml:base or the base of the parent - val base = atts.getValue(NamespaceSupport.XMLNS, "base") - val parentBase = bases.peek() - var currentBase = parentBase + val base: String = atts.getValue(NamespaceSupport.XMLNS, "base") + val parentBase: URL = bases.peek() + var currentBase: URL = parentBase if (base != null) { try { currentBase = new URL(parentBase, base) @@ -139,17 +137,17 @@ class XIncludeFilter extends XMLFilterImpl { if (uri.equals(XINCLUDE_NAMESPACE) && localName.equals("include")) { // include external document - val href = atts.getValue("href") + val href: String = atts.getValue("href") // Verify that there is an href attribute if (href == null) { throw new SAXException("Missing href attribute") } - var parse = atts getValue "parse" + var parse: String = atts getValue "parse" if (parse == null) parse = "xml" if (parse equals "text") { - val encoding = atts getValue "encoding" + val encoding: String = atts getValue "encoding" includeTextDocument(href, encoding) } else if (parse equals "xml") { includeXMLDocument(href) @@ -162,7 +160,7 @@ class XIncludeFilter extends XMLFilterImpl { } else { if (atRoot) { // add xml:base attribute if necessary - val attsImpl = new AttributesImpl(atts) + val attsImpl: AttributesImpl = new AttributesImpl(atts) attsImpl.addAttribute(NamespaceSupport.XMLNS, "base", "xml:base", "CDATA", currentBase.toExternalForm) atts = attsImpl @@ -183,7 +181,7 @@ class XIncludeFilter extends XMLFilterImpl { } } - private var depth = 0 + private var depth: Int = 0 override def startDocument(): Unit = { level = 0 @@ -225,12 +223,12 @@ class XIncludeFilter extends XMLFilterImpl { // convenience method for error messages private def getLocation(): String = { - var locationString = "" - val locator = locators.peek() - var publicID = "" - var systemID = "" - var column = -1 - var line = -1 + var locationString: String = "" + val locator: Locator = locators.peek() + var publicID: String = "" + var systemID: String = "" + var column: Int = -1 + var line: Int = -1 if (locator != null) { publicID = locator.getPublicId systemID = locator.getSystemId @@ -257,25 +255,25 @@ class XIncludeFilter extends XMLFilterImpl { * or if the encoding is not recognized */ private def includeTextDocument(url: String, encoding1: String): Unit = { - var encoding = encoding1 + var encoding: String = encoding1 if (encoding == null || encoding.trim().equals("")) encoding = "UTF-8" var source: URL = null try { - val base = bases.peek() + val base: URL = bases.peek() source = new URL(base, url) } catch { case e: MalformedURLException => - val ex = new UnavailableResourceException("Unresolvable URL " + url + val ex: UnavailableResourceException = new UnavailableResourceException("Unresolvable URL " + url + getLocation()) ex.setRootCause(e) throw new SAXException("Unresolvable URL " + url + getLocation(), ex) } try { - val uc = source.openConnection() - val in = new BufferedInputStream(uc.getInputStream) - val encodingFromHeader = uc.getContentEncoding - var contentType = uc.getContentType + val uc: URLConnection = source.openConnection() + val in: BufferedInputStream = new BufferedInputStream(uc.getInputStream) + val encodingFromHeader: String = uc.getContentEncoding + var contentType: String = uc.getContentType if (encodingFromHeader != null) encoding = encodingFromHeader else { @@ -292,8 +290,8 @@ class XIncludeFilter extends XMLFilterImpl { } } } - val reader = new InputStreamReader(in, encoding) - val c = new Array[Char](1024) + val reader: InputStreamReader = new InputStreamReader(in, encoding) + val c: Array[Char] = new Array[Char](1024) var charsRead: Int = 0 // bogus init value while ({ { charsRead = reader.read(c, 0, 1024) @@ -310,7 +308,7 @@ class XIncludeFilter extends XMLFilterImpl { } - private var atRoot = false + private var atRoot: Boolean = false /** * This utility method reads a document at a specified URL @@ -323,11 +321,11 @@ class XIncludeFilter extends XMLFilterImpl { * be downloaded from the specified URL. */ private def includeXMLDocument(url: String): Unit = { - val source = + val source: URL = try new URL(bases.peek(), url) catch { case e: MalformedURLException => - val ex = new UnavailableResourceException("Unresolvable URL " + url + getLocation()) + val ex: UnavailableResourceException = new UnavailableResourceException("Unresolvable URL " + url + getLocation()) ex setRootCause e throw new SAXException("Unresolvable URL " + url + getLocation(), ex) } @@ -342,12 +340,12 @@ class XIncludeFilter extends XMLFilterImpl { } parser setContentHandler this - val resolver = this.getEntityResolver + val resolver: EntityResolver = this.getEntityResolver if (resolver != null) parser setEntityResolver resolver // save old level and base - val previousLevel = level + val previousLevel: Int = level this.level = 0 if (bases contains source) throw new SAXException( diff --git a/shared/src/main/scala/scala/xml/include/sax/XIncluder.scala b/shared/src/main/scala/scala/xml/include/sax/XIncluder.scala index 986b14364..061d4933a 100644 --- a/shared/src/main/scala/scala/xml/include/sax/XIncluder.scala +++ b/shared/src/main/scala/scala/xml/include/sax/XIncluder.scala @@ -26,9 +26,9 @@ import java.io.{ OutputStream, OutputStreamWriter, IOException } */ class XIncluder(outs: OutputStream, encoding: String) extends ContentHandler with LexicalHandler { - var out = new OutputStreamWriter(outs, encoding) + var out: OutputStreamWriter = new OutputStreamWriter(outs, encoding) - override def setDocumentLocator(locator: Locator): Unit = {} + override def setDocumentLocator(locator: Locator): Unit = () override def startDocument(): Unit = { try { @@ -49,18 +49,19 @@ class XIncluder(outs: OutputStream, encoding: String) extends ContentHandler wit } } - override def startPrefixMapping(prefix: String, uri: String): Unit = {} + override def startPrefixMapping(prefix: String, uri: String): Unit = () - override def endPrefixMapping(prefix: String): Unit = {} + override def endPrefixMapping(prefix: String): Unit = () - override def startElement(namespaceURI: String, localName: String, qualifiedName: String, atts: Attributes) = { + override def startElement(namespaceURI: String, localName: String, qualifiedName: String, atts: Attributes): Unit = { try { out.write("<" + qualifiedName) - var i = 0; while (i < atts.getLength) { + var i: Int = 0 + while (i < atts.getLength) { out.write(" ") out.write(atts.getQName(i)) out.write("='") - val value = atts.getValue(i) + val value: String = atts.getValue(i) // @todo Need to use character references if the encoding // can't support the character out.write(scala.xml.Utility.escape(value)) @@ -87,8 +88,9 @@ class XIncluder(outs: OutputStream, encoding: String) extends ContentHandler wit // encoding using character references???? override def characters(ch: Array[Char], start: Int, length: Int): Unit = { try { - var i = 0; while (i < length) { - val c = ch(start + i) + var i: Int = 0 + while (i < length) { + val c: Char = ch(start + i) if (c == '&') out.write("&") else if (c == '<') out.write("<") // This next fix is normally not necessary. @@ -135,7 +137,7 @@ class XIncluder(outs: OutputStream, encoding: String) extends ContentHandler wit inDTD = true // if this is the source document, output a DOCTYPE declaration if (entities.isEmpty) { - var id = "" + var id: String = "" if (publicID != null) id = " PUBLIC \"" + publicID + "\" \"" + systemID + '"' else if (systemID != null) id = " SYSTEM \"" + systemID + '"' try { @@ -146,7 +148,7 @@ class XIncluder(outs: OutputStream, encoding: String) extends ContentHandler wit } } } - override def endDTD(): Unit = {} + override def endDTD(): Unit = () override def startEntity(name: String): Unit = { entities = name :: entities @@ -156,12 +158,12 @@ class XIncluder(outs: OutputStream, encoding: String) extends ContentHandler wit entities = entities.tail } - override def startCDATA(): Unit = {} - override def endCDATA(): Unit = {} + override def startCDATA(): Unit = () + override def endCDATA(): Unit = () // Just need this reference so we can ask if a comment is // inside an include element or not - private var filter: XIncludeFilter = null + private var filter: XIncludeFilter = _ def setFilter(filter: XIncludeFilter): Unit = { this.filter = filter diff --git a/shared/src/main/scala/scala/xml/package.scala b/shared/src/main/scala/scala/xml/package.scala index d25a80e27..80fbb5f15 100644 --- a/shared/src/main/scala/scala/xml/package.scala +++ b/shared/src/main/scala/scala/xml/package.scala @@ -74,7 +74,7 @@ package scala * transform XML data with a [[scala.xml.transform.RuleTransformer]]. */ package object xml { - val XercesClassName = "org.apache.xerces.parsers.SAXParser" + val XercesClassName: String = "org.apache.xerces.parsers.SAXParser" type SAXException = org.xml.sax.SAXException type SAXParseException = org.xml.sax.SAXParseException diff --git a/shared/src/main/scala/scala/xml/parsing/ConstructingHandler.scala b/shared/src/main/scala/scala/xml/parsing/ConstructingHandler.scala index 4e0000f6c..226668219 100755 --- a/shared/src/main/scala/scala/xml/parsing/ConstructingHandler.scala +++ b/shared/src/main/scala/scala/xml/parsing/ConstructingHandler.scala @@ -26,10 +26,8 @@ abstract class ConstructingHandler extends MarkupHandler { pscope: NamespaceBinding, empty: Boolean, nodes: NodeSeq): NodeSeq = Elem(pre, label, attrs, pscope, empty, nodes: _*) - override def procInstr(pos: Int, target: String, txt: String) = - ProcInstr(target, txt) - - override def comment(pos: Int, txt: String) = Comment(txt) - override def entityRef(pos: Int, n: String) = EntityRef(n) - override def text(pos: Int, txt: String) = Text(txt) + override def procInstr(pos: Int, target: String, txt: String): ProcInstr = ProcInstr(target, txt) + override def comment(pos: Int, txt: String): Comment = Comment(txt) + override def entityRef(pos: Int, n: String): EntityRef = EntityRef(n) + override def text(pos: Int, txt: String): Text = Text(txt) } diff --git a/shared/src/main/scala/scala/xml/parsing/ConstructingParser.scala b/shared/src/main/scala/scala/xml/parsing/ConstructingParser.scala index cbc8aa583..994ec87b5 100644 --- a/shared/src/main/scala/scala/xml/parsing/ConstructingParser.scala +++ b/shared/src/main/scala/scala/xml/parsing/ConstructingParser.scala @@ -18,10 +18,10 @@ import java.io.File import scala.io.Source object ConstructingParser { - def fromFile(inp: File, preserveWS: Boolean) = + def fromFile(inp: File, preserveWS: Boolean): ConstructingParser = new ConstructingParser(Source.fromFile(inp), preserveWS).initialize - def fromSource(inp: Source, preserveWS: Boolean) = + def fromSource(inp: Source, preserveWS: Boolean): ConstructingParser = new ConstructingParser(inp, preserveWS).initialize } diff --git a/shared/src/main/scala/scala/xml/parsing/DefaultMarkupHandler.scala b/shared/src/main/scala/scala/xml/parsing/DefaultMarkupHandler.scala index a8d3b493f..03ee009d0 100755 --- a/shared/src/main/scala/scala/xml/parsing/DefaultMarkupHandler.scala +++ b/shared/src/main/scala/scala/xml/parsing/DefaultMarkupHandler.scala @@ -18,14 +18,13 @@ package parsing abstract class DefaultMarkupHandler extends MarkupHandler { override def elem(pos: Int, pre: String, label: String, attrs: MetaData, - scope: NamespaceBinding, empty: Boolean, args: NodeSeq) = NodeSeq.Empty + scope: NamespaceBinding, empty: Boolean, args: NodeSeq): NodeSeq = NodeSeq.Empty - override def procInstr(pos: Int, target: String, txt: String) = NodeSeq.Empty + override def procInstr(pos: Int, target: String, txt: String): NodeSeq = NodeSeq.Empty override def comment(pos: Int, comment: String): NodeSeq = NodeSeq.Empty - override def entityRef(pos: Int, n: String) = NodeSeq.Empty - - override def text(pos: Int, txt: String) = NodeSeq.Empty + override def entityRef(pos: Int, n: String): NodeSeq = NodeSeq.Empty + override def text(pos: Int, txt: String): NodeSeq = NodeSeq.Empty } diff --git a/shared/src/main/scala/scala/xml/parsing/FactoryAdapter.scala b/shared/src/main/scala/scala/xml/parsing/FactoryAdapter.scala index eaa43afd0..689932b24 100644 --- a/shared/src/main/scala/scala/xml/parsing/FactoryAdapter.scala +++ b/shared/src/main/scala/scala/xml/parsing/FactoryAdapter.scala @@ -21,13 +21,13 @@ import org.xml.sax.ext.DefaultHandler2 // can be mixed into FactoryAdapter if desired trait ConsoleErrorHandler extends DefaultHandler2 { // ignore warning, crimson warns even for entity resolution! - override def warning(ex: SAXParseException): Unit = {} + override def warning(ex: SAXParseException): Unit = () override def error(ex: SAXParseException): Unit = printError("Error", ex) override def fatalError(ex: SAXParseException): Unit = printError("Fatal Error", ex) protected def printError(errtype: String, ex: SAXParseException): Unit = Console.withOut(Console.err) { - val s = "[%s]:%d:%d: %s".format( + val s: String = "[%s]:%d:%d: %s".format( errtype, ex.getLineNumber, ex.getColumnNumber, ex.getMessage) Console.println(s) Console.flush() @@ -139,10 +139,10 @@ abstract class FactoryAdapter extends DefaultHandler2 with factory.XMLLoader[Nod else if (!normalizeWhitespace) buffer.appendAll(ch, offset, length) // normalizing whitespace is not compliant, but useful else { - var it = ch.slice(offset, offset + length).iterator + var it: Iterator[Char] = ch.slice(offset, offset + length).iterator while (it.hasNext) { - val c = it.next() - val isSpace = c.isWhitespace + val c: Char = it.next() + val isSpace: Boolean = c.isWhitespace buffer append (if (isSpace) ' ' else c) if (isSpace) it = it dropWhile (_.isWhitespace) @@ -163,10 +163,11 @@ abstract class FactoryAdapter extends DefaultHandler2 with factory.XMLLoader[Nod */ override def endCDATA(): Unit = captureText() - private def splitName(s: String): (String, String) = { - val idx = s indexOf ':' - if (idx < 0) (null, s) - else (s take idx, s drop (idx + 1)) + // TODO move into Utility + private def splitName(s: String): (Option[String], String) = { + val idx: Int = s indexOf ':' + if (idx < 0) (None, s) + else (Some(s take idx), s drop (idx + 1)) } /* ContentHandler methods */ @@ -189,7 +190,7 @@ abstract class FactoryAdapter extends DefaultHandler2 with factory.XMLLoader[Nod tagStack = curTag :: tagStack curTag = qname - val localName = splitName(qname)._2 + val localName: String = splitName(qname)._2 capture = nodeContainsText(localName) hStack = null :: hStack @@ -199,16 +200,16 @@ abstract class FactoryAdapter extends DefaultHandler2 with factory.XMLLoader[Nod else scopeStack.head for (i <- (0 until attributes.getLength).reverse) { - val qname = attributes getQName i - val value = attributes getValue i - val (pre, key) = splitName(qname) + val qname: String = attributes getQName i + val value: String = attributes getValue i + val (pre: Option[String], key: String) = splitName(qname) def nullIfEmpty(s: String): String = if (s == "") null else s - if (pre == "xmlns" || (pre == null && qname == "xmlns")) { - val arg = if (pre == null) null else key + if (pre.contains("xmlns") || (pre.isEmpty && qname == "xmlns")) { + val arg: String = if (pre.isEmpty) null else key scpe = NamespaceBinding(arg, nullIfEmpty(value), scpe) } else - m = Attribute(Option(pre), key, Text(value), m) + m = Attribute(pre, key, Text(value), m) } // Add namespace bindings for the prefix mappings declared by this element @@ -253,21 +254,21 @@ abstract class FactoryAdapter extends DefaultHandler2 with factory.XMLLoader[Nod */ override def endElement(uri: String, _localName: String, qname: String): Unit = { captureText() - val metaData = attribStack.head + val metaData: MetaData = attribStack.head attribStack = attribStack.tail // reverse order to get it right - val v = hStack.takeWhile(_ != null).reverse + val v: List[Node] = hStack.takeWhile(_ != null).reverse hStack = hStack.dropWhile(_ != null) match { case null :: hs => hs case hs => hs } - val (pre, localName) = splitName(qname) - val scp = scopeStack.head + val (pre: Option[String], localName: String) = splitName(qname) + val scp: NamespaceBinding = scopeStack.head scopeStack = scopeStack.tail // create element - rootElem = createNode(pre, localName, metaData, scp, v) + rootElem = createNode(pre.orNull, localName, metaData, scp, v) hStack = rootElem :: hStack curTag = tagStack.head tagStack = tagStack.tail diff --git a/shared/src/main/scala/scala/xml/parsing/MarkupHandler.scala b/shared/src/main/scala/scala/xml/parsing/MarkupHandler.scala index 88e30d048..065e834ba 100755 --- a/shared/src/main/scala/scala/xml/parsing/MarkupHandler.scala +++ b/shared/src/main/scala/scala/xml/parsing/MarkupHandler.scala @@ -114,7 +114,7 @@ abstract class MarkupHandler { edef match { case _: ExtDef if !isValidating => // ignore (cf REC-xml 4.4.1) case _ => - val y = f(name, edef) + val y: EntityDecl = f(name, edef) decls ::= y ent.update(name, y) } diff --git a/shared/src/main/scala/scala/xml/parsing/MarkupParser.scala b/shared/src/main/scala/scala/xml/parsing/MarkupParser.scala index 4a9d53524..de56029dd 100755 --- a/shared/src/main/scala/scala/xml/parsing/MarkupParser.scala +++ b/shared/src/main/scala/scala/xml/parsing/MarkupParser.scala @@ -40,9 +40,9 @@ trait MarkupParser extends MarkupParserCommon with TokenTests { override type NamespaceType = NamespaceBinding override def truncatedError(msg: String): Nothing = throw FatalError(msg) - override def errorNoEnd(tag: String) = throw FatalError("expected closing tag of " + tag) + override def errorNoEnd(tag: String): Nothing = throw FatalError("expected closing tag of " + tag) - override def xHandleError(that: Char, msg: String) = reportSyntaxError(msg) + override def xHandleError(that: Char, msg: String): Unit = reportSyntaxError(msg) val input: Source @@ -62,17 +62,17 @@ trait MarkupParser extends MarkupParserCommon with TokenTests { // https://github.com/scala/scala-xml/issues/541 ; the broader access is necessary, // for now anyway, to work around https://github.com/lampepfl/dotty/issues/13096 private[parsing] class WithLookAhead(underlying: Source) extends Source { - private val queue = scala.collection.mutable.Queue[Char]() + private val queue: scala.collection.mutable.Queue[Char] = scala.collection.mutable.Queue[Char]() def lookahead(): BufferedIterator[Char] = { - val iter = queue.iterator ++ new Iterator[Char] { - override def hasNext = underlying.hasNext - override def next() = { val x = underlying.next(); queue += x; x } + val iter: Iterator[Char] = queue.iterator ++ new Iterator[Char] { + override def hasNext: Boolean = underlying.hasNext + override def next(): Char = { val x: Char = underlying.next(); queue += x; x } } iter.buffered } - override val iter = new Iterator[Char] { - override def hasNext = underlying.hasNext || queue.nonEmpty - override def next() = if (queue.nonEmpty) queue.dequeue() else underlying.next() + override val iter: Iterator[Char] = new Iterator[Char] { + override def hasNext: Boolean = underlying.hasNext || queue.nonEmpty + override def next(): Char = if (queue.nonEmpty) queue.dequeue() else underlying.next() } } @@ -80,7 +80,7 @@ trait MarkupParser extends MarkupParserCommon with TokenTests { case curInputWLA: WithLookAhead => curInputWLA.lookahead() case _ => - val newInput = new WithLookAhead(curInput) + val newInput: WithLookAhead = new WithLookAhead(curInput) curInput = newInput newInput.lookahead() } @@ -95,7 +95,7 @@ trait MarkupParser extends MarkupParserCommon with TokenTests { var pos: Int = _ /* used when reading external subset */ - var extIndex = -1 + var extIndex: Int = -1 /** holds temporary values of pos */ // Note: if marked as an override, this causes a "...cannot override a mutable variable" error with Scala 3; @@ -113,7 +113,7 @@ trait MarkupParser extends MarkupParserCommon with TokenTests { lastChRead = curInput.next() pos = curInput.pos } else { - val ilen = inpStack.length + val ilen: Int = inpStack.length //Console.println(" ilen = "+ilen+ " extIndex = "+extIndex); if ((ilen != extIndex) && (ilen > 0)) { /* for external source, inpStack == Nil ! need notify of eof! */ @@ -129,11 +129,11 @@ trait MarkupParser extends MarkupParserCommon with TokenTests { } /** character buffer, for names */ - protected val cbuf = new StringBuilder() + protected val cbuf: StringBuilder = new StringBuilder() - var dtd: DTD = null + var dtd: DTD = _ - protected var doc: Document = null + protected var doc: Document = _ override def eof: Boolean = { ch; reachedEof } @@ -149,7 +149,7 @@ trait MarkupParser extends MarkupParserCommon with TokenTests { def xmlProcInstr(): MetaData = { xToken("xml") xSpace() - val (md, scp) = xAttributes(TopScope) + val (md: MetaData, scp: NamespaceBinding) = xAttributes(TopScope) if (scp != TopScope) reportSyntaxError("no xmlns definitions here, please.") xToken('?') @@ -165,8 +165,8 @@ trait MarkupParser extends MarkupParserCommon with TokenTests { var info_enc: Option[String] = None var info_stdl: Option[Boolean] = None - val m = xmlProcInstr() - var n = 0 + val m: MetaData = xmlProcInstr() + var n: Int = 0 if (isProlog) xSpaceOpt() @@ -201,7 +201,7 @@ trait MarkupParser extends MarkupParserCommon with TokenTests { } if (m.length - n != 0) { - val s = if (isProlog) "SDDecl? " else "" + val s: String = if (isProlog) "SDDecl? " else "" reportSyntaxError("VersionInfo EncodingDecl? %sor '?>' expected!" format s) } @@ -252,13 +252,13 @@ trait MarkupParser extends MarkupParserCommon with TokenTests { children = content(TopScope) // DTD handled as side effect } else { - val ts = new NodeBuffer() + val ts: NodeBuffer = new NodeBuffer() content1(TopScope, ts) // DTD handled as side effect ts &+ content(TopScope) children = NodeSeq.fromSeq(ts) } //println("[MarkupParser::document] children now: "+children.toList) - var elemCount = 0 + var elemCount: Int = 0 var theNode: Node = null for (c <- children) c match { case _: ProcInstr => @@ -283,7 +283,7 @@ trait MarkupParser extends MarkupParserCommon with TokenTests { } /** append Unicode character to name buffer*/ - protected def putChar(c: Char) = cbuf append c + protected def putChar(c: Char): StringBuilder = cbuf append c /** * As the current code requires you to call nextch once manually @@ -294,7 +294,7 @@ trait MarkupParser extends MarkupParserCommon with TokenTests { this } - override protected def ch_returning_nextch: Char = { val res = ch; nextch(); res } + override protected def ch_returning_nextch: Char = { val res: Char = ch; nextch(); res } override def mkAttributes(name: String, pscope: NamespaceBinding): AttributesType = if (isNameStart (ch)) xAttributes(pscope) @@ -322,17 +322,17 @@ trait MarkupParser extends MarkupParserCommon with TokenTests { var scope: NamespaceBinding = pscope var aMap: MetaData = Null while (isNameStart(ch)) { - val qname = xName + val qname: String = xName xEQ() // side effect - val value = xAttributeValue() + val value: String = xAttributeValue() Utility.prefix(qname) match { case Some("xmlns") => - val prefix = qname.substring(6 /*xmlns:*/ , qname.length) + val prefix: String = qname.substring(6 /*xmlns:*/ , qname.length) scope = NamespaceBinding(prefix, value, scope) case Some(prefix) => - val key = qname.substring(prefix.length + 1, qname.length) + val key: String = qname.substring(prefix.length + 1, qname.length) aMap = new PrefixedAttribute(prefix, key, Text(value), aMap) case _ => @@ -360,14 +360,14 @@ trait MarkupParser extends MarkupParserCommon with TokenTests { * }}} */ def xEntityValue(): String = { - val endch = ch + val endch: Char = ch nextch() while (ch != endch && !eof) { putChar(ch) nextch() } nextch() - val str = cbuf.toString() + val str: String = cbuf.toString() cbuf.setLength(0) str } @@ -449,10 +449,10 @@ trait MarkupParser extends MarkupParserCommon with TokenTests { * }}} */ def content(pscope: NamespaceBinding): NodeSeq = { - val ts = new NodeBuffer - var exit = eof + val ts: NodeBuffer = new NodeBuffer + var exit: Boolean = eof // todo: optimize seq repr. - def done = NodeSeq.fromSeq(ts.toList) + def done: NodeSeq = NodeSeq.fromSeq(ts.toList) while (!exit) { tmppos = pos @@ -473,11 +473,11 @@ trait MarkupParser extends MarkupParserCommon with TokenTests { nextch(); ch match { case '#' => // CharacterRef nextch() - val theChar = handle.text(tmppos, xCharRef(() => ch, () => nextch())) + val theChar: NodeSeq = handle.text(tmppos, xCharRef(() => ch, () => nextch())) xToken(';') ts &+ theChar case _ => // EntityRef - val n = xName + val n: String = xName xToken(';') if (unescape contains n) { @@ -503,14 +503,14 @@ trait MarkupParser extends MarkupParserCommon with TokenTests { nextch() xToken("YSTEM") xSpace() - val sysID = systemLiteral() + val sysID: String = systemLiteral() SystemID(sysID) case 'P' => nextch(); xToken("UBLIC") xSpace() - val pubID = pubidLiteral() + val pubID: String = pubidLiteral() xSpace() - val sysID = systemLiteral() + val sysID: String = systemLiteral() PublicID(pubID, sysID) } @@ -527,7 +527,7 @@ trait MarkupParser extends MarkupParserCommon with TokenTests { reportSyntaxError("unexpected character (DOCTYPE already defined") xToken("DOCTYPE") xSpace() - val n = xName + val n: String = xName xSpaceOpt() //external ID if ('S' == ch || 'P' == ch) { @@ -580,27 +580,28 @@ trait MarkupParser extends MarkupParserCommon with TokenTests { * }}} */ def element1(pscope: NamespaceBinding): NodeSeq = { - val pos = this.pos - val (qname, (aMap, scope)) = xTag(pscope) - val (pre, local) = Utility.prefix(qname) match { - case Some(p) => (p, qname drop p.length + 1) - case _ => (null, qname) - } - val ts = { + val pos: Int = this.pos + val (qname: String, (aMap: MetaData, scope: NamespaceBinding)) = xTag(pscope) + // TODO move into Utility + val (pre: Option[String], local: String) = Utility.prefix(qname) match { + case Some(p) => (Some(p), qname drop p.length + 1) + case _ => (None, qname) + } + val ts: NodeSeq = { if (ch == '/') { // empty element xToken("/>") - handle.elemStart(pos, pre, local, aMap, scope) + handle.elemStart(pos, pre.orNull, local, aMap, scope) NodeSeq.Empty } else { // element with content xToken('>') - handle.elemStart(pos, pre, local, aMap, scope) - val tmp = content(scope) + handle.elemStart(pos, pre.orNull, local, aMap, scope) + val tmp: NodeSeq = content(scope) xEndTag(qname) tmp } } - val res = handle.elem(pos, pre, local, aMap, scope, ts == NodeSeq.Empty, ts) - handle.elemEnd(pos, pre, local) + val res: NodeSeq = handle.elem(pos, pre.orNull, local, aMap, scope, ts == NodeSeq.Empty, ts) + handle.elemEnd(pos, pre.orNull, local) res } @@ -610,14 +611,14 @@ trait MarkupParser extends MarkupParserCommon with TokenTests { * precondition: `xEmbeddedBlock == false` (we are not in a scala block) */ private def xText: String = { - var exit = false + var exit: Boolean = false while (!exit) { putChar(ch) nextch() exit = eof || (ch == '<') || (ch == '&') } - val str = cbuf.toString + val str: String = cbuf.toString cbuf.setLength(0) str } @@ -630,7 +631,7 @@ trait MarkupParser extends MarkupParserCommon with TokenTests { * }}} */ def systemLiteral(): String = { - val endch = ch + val endch: Char = ch if (ch != '\'' && ch != '"') reportSyntaxError("quote ' or \" expected") nextch() @@ -639,7 +640,7 @@ trait MarkupParser extends MarkupParserCommon with TokenTests { nextch() } nextch() - val str = cbuf.toString() + val str: String = cbuf.toString() cbuf.setLength(0) str } @@ -650,7 +651,7 @@ trait MarkupParser extends MarkupParserCommon with TokenTests { * }}} */ def pubidLiteral(): String = { - val endch = ch + val endch: Char = ch if (ch != '\'' && ch != '"') reportSyntaxError("quote ' or \" expected") nextch() @@ -662,7 +663,7 @@ trait MarkupParser extends MarkupParserCommon with TokenTests { nextch() } nextch() - val str = cbuf.toString + val str: String = cbuf.toString cbuf.setLength(0) str } @@ -685,11 +686,11 @@ trait MarkupParser extends MarkupParserCommon with TokenTests { markupDecl() } - def markupDecl1() = { - def doInclude() = { + def markupDecl1(): Any = { + def doInclude(): Unit = { xToken('['); while (']' != ch && !eof) markupDecl(); nextch() // ']' } - def doIgnore() = { + def doIgnore(): Unit = { xToken('['); while (']' != ch && !eof) nextch(); nextch() // ']' } if ('?' == ch) { @@ -723,13 +724,13 @@ trait MarkupParser extends MarkupParserCommon with TokenTests { ch match { case '%' => nextch() - val ent = xName + val ent: String = xName xToken(';') xSpaceOpt() push(ent) xSpaceOpt() - val stmt = xName + val stmt: String = xName xSpaceOpt() stmt match { @@ -765,7 +766,7 @@ trait MarkupParser extends MarkupParserCommon with TokenTests { def markupDecl(): Unit = ch match { case '%' => // parameter entity reference nextch() - val ent = xName + val ent: String = xName xToken(';') if (!isValidating) handle.peReference(ent) // n-v: just create PE-reference @@ -799,7 +800,7 @@ trait MarkupParser extends MarkupParserCommon with TokenTests { def elementDecl(): Unit = { xToken("EMENT") xSpace() - val n = xName + val n: String = xName xSpace() while ('>' != ch && !eof) { //Console.println("["+ch+"]") @@ -808,7 +809,7 @@ trait MarkupParser extends MarkupParserCommon with TokenTests { } //Console.println("END["+ch+"]") nextch() - val cmstr = cbuf.toString() + val cmstr: String = cbuf.toString() cbuf.setLength(0) handle.elemDecl(n, cmstr) } @@ -818,16 +819,16 @@ trait MarkupParser extends MarkupParserCommon with TokenTests { * ' != ch && !eof) { - val aname = xName + val aname: String = xName xSpace() // could be enumeration (foo,bar) parse this later :-/ while ('"' != ch && '\'' != ch && '#' != ch && '<' != ch) { @@ -835,7 +836,7 @@ trait MarkupParser extends MarkupParserCommon with TokenTests { cbuf.append(ch) nextch() } - val atpe = cbuf.toString + val atpe: String = cbuf.toString cbuf.setLength(0) val defdecl: DefaultDecl = ch match { @@ -867,8 +868,8 @@ trait MarkupParser extends MarkupParserCommon with TokenTests { * //sy - val extID = externalID() + val extID: ExternalID = externalID() if (isParameterEntity) { xSpaceOpt() xToken('>') @@ -890,7 +891,7 @@ trait MarkupParser extends MarkupParserCommon with TokenTests { if ('>' != ch) { xToken("NDATA") xSpace() - val notat = xName + val notat: String = xName xSpaceOpt() xToken('>') handle.unparsedEntityDecl(n, extID, notat) @@ -901,7 +902,7 @@ trait MarkupParser extends MarkupParserCommon with TokenTests { } case '"' | '\'' => - val av = xEntityValue() + val av: String = xEntityValue() xSpaceOpt() xToken('>') if (isParameterEntity) @@ -920,18 +921,18 @@ trait MarkupParser extends MarkupParserCommon with TokenTests { def notationDecl(): Unit = { xToken("OTATION") xSpace() - val notat = xName + val notat: String = xName xSpace() - val extID = if (ch == 'S') { + val extID: ExternalID = if (ch == 'S') { externalID() } else if (ch == 'P') { /* PublicID (without system, only used in NOTATION) */ nextch() xToken("UBLIC") xSpace() - val pubID = pubidLiteral() + val pubID: String = pubidLiteral() xSpaceOpt() - val sysID = if (ch != '>') + val sysID: String = if (ch != '>') systemLiteral() else null diff --git a/shared/src/main/scala/scala/xml/parsing/MarkupParserCommon.scala b/shared/src/main/scala/scala/xml/parsing/MarkupParserCommon.scala index c967a5f02..2606b98ff 100644 --- a/shared/src/main/scala/scala/xml/parsing/MarkupParserCommon.scala +++ b/shared/src/main/scala/scala/xml/parsing/MarkupParserCommon.scala @@ -23,7 +23,7 @@ import Utility.SU * All members should be accessed through those. */ private[scala] trait MarkupParserCommon extends TokenTests { - protected def unreachable = truncatedError("Cannot be reached.") + protected def unreachable: Nothing = truncatedError("Cannot be reached.") // type HandleType // MarkupHandler, SymbolicXMLBuilder type InputType // Source, CharArrayReader @@ -41,7 +41,7 @@ private[scala] trait MarkupParserCommon extends TokenTests { * [44] EmptyElemTag ::= '<' Name { S Attribute } [S] */ protected def xTag(pscope: NamespaceType): (String, AttributesType) = { - val name = xName + val name: String = xName xSpaceOpt() (name, mkAttributes(name, pscope)) @@ -53,7 +53,7 @@ private[scala] trait MarkupParserCommon extends TokenTests { * see [15] */ def xProcInstr: ElementType = { - val n = xName + val n: String = xName xSpaceOpt() xTakeUntil(mkProcInstr(_, n, _), () => tmppos, "?>") } @@ -63,7 +63,7 @@ private[scala] trait MarkupParserCommon extends TokenTests { * @param endCh either `'` or `"` */ def xAttributeValue(endCh: Char): String = { - val buf = new StringBuilder + val buf: StringBuilder = new StringBuilder while (ch != endCh && !eof) { // well-formedness constraint if (ch == '<') reportSyntaxError("'<' not allowed in attrib value") @@ -76,13 +76,13 @@ private[scala] trait MarkupParserCommon extends TokenTests { } def xAttributeValue(): String = { - val str = xAttributeValue(ch_returning_nextch) + val str: String = xAttributeValue(ch_returning_nextch) // well-formedness constraint normalizeAttributeValue(str) } private def takeUntilChar(it: Iterator[Char], end: Char): String = { - val buf = new StringBuilder + val buf: StringBuilder = new StringBuilder while (it.hasNext) it.next() match { case `end` => return buf.toString case ch => buf append ch @@ -117,7 +117,7 @@ private[scala] trait MarkupParserCommon extends TokenTests { else if (!isNameStart(ch)) return errorAndResult("name expected, but char '%s' cannot start a name" format ch, "") - val buf = new StringBuilder + val buf: StringBuilder = new StringBuilder while ({ buf append ch_returning_nextch ; isNameChar(ch)}) () @@ -128,7 +128,7 @@ private[scala] trait MarkupParserCommon extends TokenTests { } else buf.toString } - private def attr_unescape(s: String) = s match { + private def attr_unescape(s: String): String = s match { case "lt" => "<" case "gt" => ">" case "amp" => "&" @@ -143,8 +143,8 @@ private[scala] trait MarkupParserCommon extends TokenTests { * see spec 3.3.3 */ private def normalizeAttributeValue(attval: String): String = { - val buf = new StringBuilder - val it = attval.iterator.buffered + val buf: StringBuilder = new StringBuilder + val it: BufferedIterator[Char] = attval.iterator.buffered while (it.hasNext) buf append (it.next() match { case ' ' | '\t' | '\n' | '\r' => " " @@ -167,7 +167,7 @@ private[scala] trait MarkupParserCommon extends TokenTests { Utility.parseCharRef(ch, nextch, reportSyntaxError, truncatedError) def xCharRef(it: Iterator[Char]): String = { - var c = it.next() + var c: Char = it.next() Utility.parseCharRef(() => c, () => { c = it.next() }, reportSyntaxError, truncatedError) } @@ -211,13 +211,13 @@ private[scala] trait MarkupParserCommon extends TokenTests { def xToken(that: Seq[Char]): Unit = { that foreach xToken } /** scan [S] '=' [S]*/ - def xEQ() = { xSpaceOpt(); xToken('='); xSpaceOpt() } + def xEQ(): Unit = { xSpaceOpt(); xToken('='); xSpaceOpt() } /** skip optional space S? */ - def xSpaceOpt() = while (isSpace(ch) && !eof) nextch() + def xSpaceOpt(): Unit = while (isSpace(ch) && !eof) nextch() /** scan [3] S ::= (#x20 | #x9 | #xD | #xA)+ */ - def xSpace() = + def xSpace(): Unit = if (isSpace(ch)) { nextch(); xSpaceOpt() } else xHandleError(ch, "whitespace expected") @@ -226,7 +226,7 @@ private[scala] trait MarkupParserCommon extends TokenTests { /** Execute body with a variable saved and restored after execution */ def saving[A, B](getter: A, setter: A => Unit)(body: => B): B = { - val saved = getter + val saved: A = getter try body finally setter(saved) } @@ -241,9 +241,9 @@ private[scala] trait MarkupParserCommon extends TokenTests { positioner: () => PositionType, until: String): T = { - val sb = new StringBuilder - val head = until.head - val rest = until.tail + val sb: StringBuilder = new StringBuilder + val head: Char = until.head + val rest: String = until.tail while (!eof) { if (ch == head && peek(rest)) diff --git a/shared/src/main/scala/scala/xml/parsing/NoBindingFactoryAdapter.scala b/shared/src/main/scala/scala/xml/parsing/NoBindingFactoryAdapter.scala index 9e5e0a5c0..bd57b40c7 100644 --- a/shared/src/main/scala/scala/xml/parsing/NoBindingFactoryAdapter.scala +++ b/shared/src/main/scala/scala/xml/parsing/NoBindingFactoryAdapter.scala @@ -23,7 +23,7 @@ import factory.NodeFactory */ class NoBindingFactoryAdapter extends FactoryAdapter with NodeFactory[Elem] { /** True. Every XML node may contain text that the application needs */ - override def nodeContainsText(label: String) = true + override def nodeContainsText(label: String): Boolean = true /** From NodeFactory. Constructs an instance of scala.xml.Elem -- TODO: deprecate as in Elem */ override protected def create(pre: String, label: String, attrs: MetaData, scope: NamespaceBinding, children: Seq[Node]): Elem = diff --git a/shared/src/main/scala/scala/xml/parsing/TokenTests.scala b/shared/src/main/scala/scala/xml/parsing/TokenTests.scala index 8b8a539a4..ec3ad851a 100644 --- a/shared/src/main/scala/scala/xml/parsing/TokenTests.scala +++ b/shared/src/main/scala/scala/xml/parsing/TokenTests.scala @@ -38,8 +38,8 @@ trait TokenTests { final def isSpace(cs: Seq[Char]): Boolean = cs.nonEmpty && (cs forall isSpace) /** These are 99% sure to be redundant but refactoring on the safe side. */ - def isAlpha(c: Char) = (c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z') - def isAlphaDigit(c: Char) = isAlpha(c) || (c >= '0' && c <= '9') + def isAlpha(c: Char): Boolean = (c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z') + def isAlphaDigit(c: Char): Boolean = isAlpha(c) || (c >= '0' && c <= '9') /** * {{{ @@ -48,7 +48,7 @@ trait TokenTests { * }}} * See [4] and [4a] of Appendix B of XML 1.0 specification. */ - def isNameChar(ch: Char) = { + def isNameChar(ch: Char): Boolean = { import java.lang.Character._ // The constants represent groups Mc, Me, Mn, Lm, and Nd. @@ -70,7 +70,7 @@ trait TokenTests { * We do not allow a name to start with `:`. * See [4] and Appendix B of XML 1.0 specification */ - def isNameStart(ch: Char) = { + def isNameStart(ch: Char): Boolean = { import java.lang.Character._ getType(ch).toByte match { @@ -87,7 +87,7 @@ trait TokenTests { * }}} * See [5] of XML 1.0 specification. */ - def isName(s: String) = + def isName(s: String): Boolean = s.nonEmpty && isNameStart(s.head) && (s.tail forall isNameChar) def isPubIDChar(ch: Char): Boolean = @@ -102,13 +102,13 @@ trait TokenTests { * * @param ianaEncoding The IANA encoding name. */ - def isValidIANAEncoding(ianaEncoding: Seq[Char]) = { - def charOK(c: Char) = isAlphaDigit(c) || ("._-" contains c) + def isValidIANAEncoding(ianaEncoding: Seq[Char]): Boolean = { + def charOK(c: Char): Boolean = isAlphaDigit(c) || ("._-" contains c) ianaEncoding.nonEmpty && isAlpha(ianaEncoding.head) && (ianaEncoding.tail forall charOK) } - def checkSysID(s: String) = List('"', '\'') exists (c => !(s contains c)) - def checkPubID(s: String) = s forall isPubIDChar + def checkSysID(s: String): Boolean = List('"', '\'') exists (c => !(s contains c)) + def checkPubID(s: String): Boolean = s forall isPubIDChar } diff --git a/shared/src/main/scala/scala/xml/parsing/XhtmlEntities.scala b/shared/src/main/scala/scala/xml/parsing/XhtmlEntities.scala index c3649f8c6..ff593d3e2 100644 --- a/shared/src/main/scala/scala/xml/parsing/XhtmlEntities.scala +++ b/shared/src/main/scala/scala/xml/parsing/XhtmlEntities.scala @@ -21,7 +21,7 @@ import scala.xml.dtd.{ IntDef, ParsedEntityDecl } * */ object XhtmlEntities { - val entList = List(("quot", 34), ("amp", 38), ("lt", 60), ("gt", 62), ("nbsp", 160), ("iexcl", 161), ("cent", 162), ("pound", 163), ("curren", 164), ("yen", 165), + val entList: List[(String, Int)] = List(("quot", 34), ("amp", 38), ("lt", 60), ("gt", 62), ("nbsp", 160), ("iexcl", 161), ("cent", 162), ("pound", 163), ("curren", 164), ("yen", 165), ("euro", 8364), ("brvbar", 166), ("sect", 167), ("uml", 168), ("copy", 169), ("ordf", 170), ("laquo", 171), ("shy", 173), ("reg", 174), ("trade", 8482), ("macr", 175), ("deg", 176), ("plusmn", 177), ("sup2", 178), ("sup3", 179), ("acute", 180), ("micro", 181), ("para", 182), ("middot", 183), ("cedil", 184), ("sup1", 185), ("ordm", 186), ("raquo", 187), ("frac14", 188), ("frac12", 189), ("frac34", 190), ("iquest", 191), ("times", 215), ("divide", 247), @@ -51,8 +51,8 @@ object XhtmlEntities { val entMap: Map[String, Char] = Map.empty[String, Char] ++ entList.map { case (name, value) => (name, value.toChar) } - val entities = entList. + val entities: List[(String, ParsedEntityDecl)] = entList. map { case (name, value) => (name, ParsedEntityDecl(name, IntDef(value.toChar.toString))) } - def apply() = entities + def apply(): List[(String, ParsedEntityDecl)] = entities } diff --git a/shared/src/main/scala/scala/xml/parsing/XhtmlParser.scala b/shared/src/main/scala/scala/xml/parsing/XhtmlParser.scala index b21ddec75..accc65d6b 100644 --- a/shared/src/main/scala/scala/xml/parsing/XhtmlParser.scala +++ b/shared/src/main/scala/scala/xml/parsing/XhtmlParser.scala @@ -23,7 +23,7 @@ import scala.io.Source * @author (c) David Pollak, 2007 WorldWide Conferencing, LLC. */ class XhtmlParser(override val input: Source) extends ConstructingHandler with MarkupParser with ExternalSources { - override val preserveWS = true + override val preserveWS: Boolean = true ent ++= XhtmlEntities() } diff --git a/shared/src/main/scala/scala/xml/transform/BasicTransformer.scala b/shared/src/main/scala/scala/xml/transform/BasicTransformer.scala index 397c5fb31..ebbc92a54 100644 --- a/shared/src/main/scala/scala/xml/transform/BasicTransformer.scala +++ b/shared/src/main/scala/scala/xml/transform/BasicTransformer.scala @@ -21,8 +21,8 @@ import scala.collection.Seq * * @author Burak Emir */ -abstract class BasicTransformer extends Function1[Node, Node] { - protected def unchanged(n: Node, ns: Seq[Node]) = +abstract class BasicTransformer extends (Node => Node) { + protected def unchanged(n: Node, ns: Seq[Node]): Boolean = ns.length == 1 && (ns.head == n) /** @@ -37,7 +37,7 @@ abstract class BasicTransformer extends Function1[Node, Node] { * otherwise a new sequence of concatenated results. */ def transform(ns: Seq[Node]): Seq[Node] = { - val changed = ns flatMap transform + val changed: Seq[Node] = ns flatMap transform if (changed.length != ns.length || changed.zip(ns).exists(p => p._1 != p._2)) changed else ns } @@ -46,8 +46,8 @@ abstract class BasicTransformer extends Function1[Node, Node] { if (n.doTransform) n match { case Group(xs) => Group(transform(xs)) // un-group the hack Group tag case _ => - val ch = n.child - val nch = transform(ch) + val ch: Seq[Node] = n.child + val nch: Seq[Node] = transform(ch) if (ch eq nch) n else Elem(n.prefix, n.label, n.attributes, n.scope, nch.isEmpty, nch: _*) @@ -56,7 +56,7 @@ abstract class BasicTransformer extends Function1[Node, Node] { } override def apply(n: Node): Node = { - val seq = transform(n) + val seq: Seq[Node] = transform(n) if (seq.length > 1) throw new UnsupportedOperationException("transform must return single node for root") else seq.head diff --git a/shared/src/main/scala/scala/xml/transform/RuleTransformer.scala b/shared/src/main/scala/scala/xml/transform/RuleTransformer.scala index 45fddc1f4..657b1b73c 100644 --- a/shared/src/main/scala/scala/xml/transform/RuleTransformer.scala +++ b/shared/src/main/scala/scala/xml/transform/RuleTransformer.scala @@ -17,7 +17,7 @@ package transform import scala.collection.Seq class RuleTransformer(rules: RewriteRule*) extends BasicTransformer { - private val transformers = rules.map(new NestingTransformer(_)) + private val transformers: Seq[NestingTransformer] = rules.map(new NestingTransformer(_)) override def transform(n: Node): Seq[Node] = { if (transformers.isEmpty) n else transformers.tail.foldLeft(transformers.head.transform(n)) { (res, transformer) => transformer.transform(res) } diff --git a/shared/src/test/scala-2.x/scala/xml/ShouldCompile.scala b/shared/src/test/scala-2.x/scala/xml/ShouldCompile.scala index 2a0d621c8..21f06210f 100644 --- a/shared/src/test/scala-2.x/scala/xml/ShouldCompile.scala +++ b/shared/src/test/scala-2.x/scala/xml/ShouldCompile.scala @@ -5,6 +5,6 @@ package scala.xml // t1626 object o { - val n = + val n: Elem = n.namespace == null } diff --git a/shared/src/test/scala-2.x/scala/xml/TransformersTest.scala b/shared/src/test/scala-2.x/scala/xml/TransformersTest.scala index ae1ae1463..c67453e0e 100644 --- a/shared/src/test/scala-2.x/scala/xml/TransformersTest.scala +++ b/shared/src/test/scala-2.x/scala/xml/TransformersTest.scala @@ -8,8 +8,7 @@ import org.junit.Assert.assertEquals class TransformersTest { - - def transformer = new RuleTransformer(new RewriteRule { + def transformer: RuleTransformer = new RuleTransformer(new RewriteRule { override def transform(n: Node): NodeSeq = n match { case { _* } => case n => n @@ -17,17 +16,17 @@ class TransformersTest { }) @Test - def transform = // SI-2124 + def transform(): Unit = // SI-2124 assertEquals(transformer.transform(

),

) @Test - def transformNamespaced = // SI-2125 + def transformNamespaced(): Unit = // SI-2125 assertEquals(transformer.transform(

), Group(

)) @Test - def rewriteRule = { // SI-2276 + def rewriteRule(): Unit = { // SI-2276 val inputXml: Node = @@ -45,7 +44,7 @@ class TransformersTest { } } - val ruleTransformer = new RuleTransformer(t1) + val ruleTransformer: RuleTransformer = new RuleTransformer(t1) JUnitAssertsForXML.assertEquals(ruleTransformer(inputXml).toString, // TODO: why do we need toString? @@ -58,10 +57,10 @@ class TransformersTest { } @Test - def preserveReferentialComplexityInLinearComplexity = { // SI-4528 - var i = 0 + def preserveReferentialComplexityInLinearComplexity(): Unit = { // SI-4528 + var i: Int = 0 - val xmlNode =

Hello Example

+ val xmlNode: Elem =

Hello Example

new RuleTransformer(new RewriteRule { override def transform(n: Node): Seq[Node] = { @@ -78,15 +77,15 @@ class TransformersTest { } @Test - def appliesRulesRecursivelyOnPreviousChanges = { // #257 - def add(outer: Elem, inner: Node) = new RewriteRule { + def appliesRulesRecursivelyOnPreviousChanges(): Unit = { // #257 + def add(outer: Elem, inner: Node): RewriteRule = new RewriteRule { override def transform(n: Node): Seq[Node] = n match { case e: Elem if e.label == outer.label => e.copy(child = e.child ++ inner) case other => other } } - def transformer = new RuleTransformer(add(, ), add(, )) + def transformer: RuleTransformer = new RuleTransformer(add(, ), add(, )) assertEquals(, transformer()) } diff --git a/shared/src/test/scala-2.x/scala/xml/XMLTest2x.scala b/shared/src/test/scala-2.x/scala/xml/XMLTest2x.scala index 21835506f..f844165aa 100644 --- a/shared/src/test/scala-2.x/scala/xml/XMLTest2x.scala +++ b/shared/src/test/scala-2.x/scala/xml/XMLTest2x.scala @@ -13,19 +13,19 @@ class XMLTest2x {
@UnitTest - def wsdl = { + def wsdl(): Unit = { assertEquals(""" """, wsdlTemplate3("service3") toString) } @UnitTest - def t5154: Unit = { + def t5154(): Unit = { // extra space made the pattern OK - def f = {{3}} match { case {{3}} => true } + def f: Boolean = {{3}} match { case {{3}} => true } // lack of space used to error: illegal start of simple pattern - def g = {{3}} match { case {{3}} => true } + def g: Boolean = {{3}} match { case {{3}} => true } assertTrue(f) assertTrue(g) diff --git a/shared/src/test/scala/scala/xml/AttributeTest.scala b/shared/src/test/scala/scala/xml/AttributeTest.scala index 4e151224e..bae4be959 100644 --- a/shared/src/test/scala/scala/xml/AttributeTest.scala +++ b/shared/src/test/scala/scala/xml/AttributeTest.scala @@ -6,21 +6,22 @@ import org.junit.Assert.assertEquals class AttributeTest { @Test - def unprefixedAttribute: Unit = { - val x = new UnprefixedAttribute("foo","bar", Null) + def unprefixedAttribute(): Unit = { + val x: UnprefixedAttribute = new UnprefixedAttribute("foo","bar", Null) assertEquals(Some(Text("bar")), x.get("foo")) assertEquals(Text("bar"), x("foo")) assertEquals(None, x.get("no_foo")) assertEquals(null, x("no_foo")) - val y = x.remove("foo") + val y: MetaData = x.remove("foo") assertEquals(Null, y) - val z = new UnprefixedAttribute("foo", null:NodeSeq, x) + val z: UnprefixedAttribute = new UnprefixedAttribute("foo", null:NodeSeq, x) assertEquals(None, z.get("foo")) - var appended = x append x append x append x - var len = 0; while (appended ne Null) { + var appended: MetaData = x append x append x append x + var len: Int = 0 + while (appended ne Null) { appended = appended.next len = len + 1 } @@ -28,154 +29,154 @@ class AttributeTest { } @Test - def attributeWithOption: Unit = { - val x = new UnprefixedAttribute("foo", Some(Text("bar")), Null) + def attributeWithOption(): Unit = { + val x: UnprefixedAttribute = new UnprefixedAttribute("foo", Some(Text("bar")), Null) assertEquals(Some(Text("bar")), x.get("foo")) assertEquals(Text("bar"), x("foo")) assertEquals(None, x.get("no_foo")) assertEquals(null, x("no_foo")) - val attr1 = Some(Text("foo value")) - val attr2 = None - val y = + val attr1: Option[Text] = Some(Text("foo value")) + val attr2: Option[Text] = None + val y: Elem = assertEquals(Some(Text("foo value")), y.attributes.get("foo")) assertEquals(Text("foo value"), y.attributes("foo")) assertEquals(None, y.attributes.get("bar")) assertEquals(null, y.attributes("bar")) - val z = new UnprefixedAttribute("foo", None, x) + val z: UnprefixedAttribute = new UnprefixedAttribute("foo", None, x) assertEquals(None, z.get("foo")) } @Test - def attributeOrder: Unit = { - val x = + def attributeOrder(): Unit = { + val x: Elem = assertEquals("""""", x.toString) } - def attributeToString: Unit = { + def attributeToString(): Unit = { val expected: String = """""" assertEquals(expected, .toString) assertEquals(expected, .toString) } @Test - def attributeOperator: Unit = { - val xml = + def attributeOperator(): Unit = { + val xml: Elem = assertEquals("apple", xml \@ "bar") } @Test - def attributePathRootNoAttribute: Unit = { - val xml = + def attributePathRootNoAttribute(): Unit = { + val xml: Elem = assertEquals(NodeSeq.Empty, xml \ "@bar") } @Test(expected=classOf[IllegalArgumentException]) - def attributePathIllegalEmptyAttribute: Unit = { - val xml = + def attributePathIllegalEmptyAttribute(): Unit = { + val xml: Elem = xml \ "@" } @Test - def attributePathRootWithOneAttribute: Unit = { - val xml = + def attributePathRootWithOneAttribute(): Unit = { + val xml: Elem = assertEquals(Group(Text("apple")), xml \ "@bar") // assertEquals(NodeSeq.fromSeq(Seq(Text("apple"))), xml \ "@bar") } @Test - def attributePathRootWithMissingAttributes: Unit = { - val xml = + def attributePathRootWithMissingAttributes(): Unit = { + val xml: Elem = assertEquals(NodeSeq.Empty, xml \ "@oops") } @Test - def attributePathDuplicateAttribute: Unit = { - val xml = Elem(null, "foo", + def attributePathDuplicateAttribute(): Unit = { + val xml: Elem = Elem(null, "foo", Attribute("bar", Text("apple"), - Attribute("bar", Text("orange"), Null)), TopScope, true) + Attribute("bar", Text("orange"), Null)), TopScope, minimizeEmpty = true) assertEquals(Group(Text("apple")), xml \ "@bar") } @Test - def attributePathDescendantAttributes: Unit = { - val xml = + def attributePathDescendantAttributes(): Unit = { + val xml: Elem = assertEquals(NodeSeq.fromSeq(Seq(Text("1"), Text("2"))), xml \\ "@bar") } @Test - def attributeDescendantPathChildAttributes: Unit = { - val xml = + def attributeDescendantPathChildAttributes(): Unit = { + val xml: Elem = assertEquals(NodeSeq.fromSeq(Seq(Text("1"), Text("2"))), xml \ "b" \\ "@bar") } @Test - def attributeDescendantPathDescendantAttributes: Unit = { - val xml = + def attributeDescendantPathDescendantAttributes(): Unit = { + val xml: Elem = assertEquals(NodeSeq.fromSeq(Seq(Text("1"), Text("2"))), xml \\ "b" \\ "@bar") } @Test - def attributeChildDescendantPathDescendantAttributes: Unit = { - val xml = + def attributeChildDescendantPathDescendantAttributes(): Unit = { + val xml: Elem = assertEquals(NodeSeq.fromSeq(Seq(Text("1"), Text("2"))), xml \ "a" \\ "@bar") } @Test - def attributeDescendantDescendantPathDescendantAttributes: Unit = { - val xml = + def attributeDescendantDescendantPathDescendantAttributes(): Unit = { + val xml: Elem = assertEquals(NodeSeq.fromSeq(Seq(Text("1"), Text("2"))), xml \\ "b" \\ "@bar") } @Test(expected=classOf[IllegalArgumentException]) - def attributePathDescendantIllegalEmptyAttribute: Unit = { - val xml = + def attributePathDescendantIllegalEmptyAttribute(): Unit = { + val xml: Elem = xml \\ "@" } @Test - def attributePathNoDescendantAttributes: Unit = { - val xml = + def attributePathNoDescendantAttributes(): Unit = { + val xml: Elem = assertEquals(NodeSeq.Empty, xml \\ "@oops") } @Test - def attributePathOneChildWithAttributes: Unit = { - val xml = > + def attributePathOneChildWithAttributes(): Unit = { + val xml: Elem = > assertEquals(Group(Seq(Text("1"))), xml \ "b" \ "@bar") } @Test - def attributePathTwoChildrenWithAttributes: Unit = { - val xml = - val b = xml \ "b" + def attributePathTwoChildrenWithAttributes(): Unit = { + val xml: Elem = + val b: NodeSeq = xml \ "b" assertEquals(2, b.length.toLong) assertEquals(NodeSeq.fromSeq(Seq(, )), b) - val barFail = b \ "@bar" - val barList = b.map(_ \ "@bar") + val barFail: NodeSeq = b \ "@bar" + val barList: Seq[NodeSeq] = b.map(_ \ "@bar") assertEquals(NodeSeq.Empty, barFail) assertEquals(List(Group(Seq(Text("1"))), Group(Seq(Text("2")))), barList) } @Test(expected=classOf[IllegalArgumentException]) - def invalidAttributeFailForOne: Unit = { + def invalidAttributeFailForOne(): Unit = { \ "@" } @Test(expected=classOf[IllegalArgumentException]) - def invalidAttributeFailForMany: Unit = { + def invalidAttributeFailForMany(): Unit = { .child \ "@" } @Test(expected=classOf[IllegalArgumentException]) - def invalidEmptyAttributeFailForOne: Unit = { + def invalidEmptyAttributeFailForOne(): Unit = { \@ "" } @Test(expected=classOf[IllegalArgumentException]) - def invalidEmptyAttributeFailForMany: Unit = { + def invalidEmptyAttributeFailForMany(): Unit = { .child \@ "" } } diff --git a/shared/src/test/scala/scala/xml/CommentTest.scala b/shared/src/test/scala/scala/xml/CommentTest.scala index b1a6cfe34..7ad4fd695 100644 --- a/shared/src/test/scala/scala/xml/CommentTest.scala +++ b/shared/src/test/scala/scala/xml/CommentTest.scala @@ -6,23 +6,23 @@ import org.junit.Test final class CommentTest { @Test(expected=classOf[IllegalArgumentException]) - def invalidCommentWithTwoDashes: Unit = { + def invalidCommentWithTwoDashes(): Unit = { Comment("invalid--comment") } @Test(expected=classOf[IllegalArgumentException]) - def invalidCommentWithFinalDash: Unit = { + def invalidCommentWithFinalDash(): Unit = { Comment("invalid comment-") } @Test - def validCommentWithDash: Unit = { + def validCommentWithDash(): Unit = { val valid: String = "valid-comment" assertEquals(s"", Comment(valid).toString) } @Test - def validEmptyComment: Unit = { + def validEmptyComment(): Unit = { val valid: String = "" assertEquals(s"", Comment(valid).toString) } diff --git a/shared/src/test/scala/scala/xml/JUnitAssertsForXML.scala b/shared/src/test/scala/scala/xml/JUnitAssertsForXML.scala index 374ed704d..4eedd88fe 100644 --- a/shared/src/test/scala/scala/xml/JUnitAssertsForXML.scala +++ b/shared/src/test/scala/scala/xml/JUnitAssertsForXML.scala @@ -4,5 +4,4 @@ object JUnitAssertsForXML { private[xml] def assertEquals(expected: String, actual: NodeSeq): Unit = org.junit.Assert.assertEquals(expected, actual.toString) - } diff --git a/shared/src/test/scala/scala/xml/MetaDataTest.scala b/shared/src/test/scala/scala/xml/MetaDataTest.scala index 44c9454d6..039382fad 100644 --- a/shared/src/test/scala/scala/xml/MetaDataTest.scala +++ b/shared/src/test/scala/scala/xml/MetaDataTest.scala @@ -6,22 +6,22 @@ import org.junit.Assert.assertEquals class MetaDataTest { @Test - def absentElementPrefixed1: Unit = { + def absentElementPrefixed1(): Unit = { // type ascription to help overload resolution pick the right variant assertEquals(null: Object, Null("za://foo.com", TopScope, "bar")) assertEquals(null, Null("bar")) } @Test - def absentElementPrefixed2: Unit = { + def absentElementPrefixed2(): Unit = { assertEquals(Option.empty, Null.get("za://foo.com", TopScope, "bar" )) assertEquals(Option.empty, Null.get("bar")) } @Test - def presentElement1: Unit = { - val x = new PrefixedAttribute("zo","bar", new Atom(42), Null) - val s = NamespaceBinding("zo","za://foo.com", TopScope) + def presentElement1(): Unit = { + val x: PrefixedAttribute = new PrefixedAttribute("zo","bar", new Atom(42), Null) + val s: NamespaceBinding = NamespaceBinding("zo","za://foo.com", TopScope) assertEquals(new Atom(42), x("za://foo.com", s, "bar" )) assertEquals(null, x("bar")) assertEquals(Some(new Atom(42)), x.get("za://foo.com", s, "bar")) @@ -29,10 +29,10 @@ class MetaDataTest { } @Test - def presentElement2: Unit = { - val s = NamespaceBinding("zo","za://foo.com", TopScope) - val x1 = new PrefixedAttribute("zo","bar", new Atom(42), Null) - val x = new UnprefixedAttribute("bar","meaning", x1) + def presentElement2(): Unit = { + val s: NamespaceBinding = NamespaceBinding("zo","za://foo.com", TopScope) + val x1: PrefixedAttribute = new PrefixedAttribute("zo","bar", new Atom(42), Null) + val x: UnprefixedAttribute = new UnprefixedAttribute("bar","meaning", x1) assertEquals(null, x(null, s, "bar")) assertEquals(Text("meaning"), x("bar")) assertEquals(None, x.get(null, s, "bar" )) @@ -40,25 +40,24 @@ class MetaDataTest { } @Test - def attributeExtractor: Unit = { - def domatch(x:Node): Node = { + def attributeExtractor(): Unit = { + def domatch(x: Node): Node = { x match { case Node("foo", md @ UnprefixedAttribute(_, value, _), _*) if value.nonEmpty => md("bar")(0) case _ => new Atom(3) } } - val z = - val z2 = + val z: Elem = + val z2: Elem = assertEquals(Text("gar"), domatch(z)) assertEquals(new Atom(3), domatch(z2)) } @Test - def reverseTest: Unit = { + def reverseTest(): Unit = { assertEquals("", Null.reverse.toString) assertEquals(""" b="c"""", .attributes.reverse.toString) assertEquals(""" d="e" b="c"""", .attributes.reverse.toString) } - } diff --git a/shared/src/test/scala/scala/xml/NodeBufferTest.scala b/shared/src/test/scala/scala/xml/NodeBufferTest.scala index 93fcb7a5f..5b3e69eb7 100644 --- a/shared/src/test/scala/scala/xml/NodeBufferTest.scala +++ b/shared/src/test/scala/scala/xml/NodeBufferTest.scala @@ -6,8 +6,8 @@ import org.junit.Assert.assertEquals class NodeBufferTest { @Test - def testToString: Unit = { - val nodeBuffer = new NodeBuffer + def testToString(): Unit = { + val nodeBuffer: NodeBuffer = new NodeBuffer assertEquals("NodeBuffer()", nodeBuffer.toString) } } diff --git a/shared/src/test/scala/scala/xml/NodeSeqTest.scala b/shared/src/test/scala/scala/xml/NodeSeqTest.scala index 8fa427363..d639855ce 100644 --- a/shared/src/test/scala/scala/xml/NodeSeqTest.scala +++ b/shared/src/test/scala/scala/xml/NodeSeqTest.scala @@ -1,43 +1,44 @@ package scala.xml import scala.xml.NodeSeq.seqToNodeSeq - import org.junit.Test import org.junit.Assert.assertEquals import org.junit.Assert.fail +import scala.collection.immutable + class NodeSeqTest { @Test - def testAppend: Unit = { // Bug #392. + def testAppend(): Unit = { // Bug #392. val a: NodeSeq = Hello - val b = Hi + val b: Elem = Hi a ++ Hi match { case res: NodeSeq => assertEquals(2, res.size.toLong) case res: Seq[Node] => fail("Should be NodeSeq was Seq[Node]") // Unreachable code? } val res: NodeSeq = a ++ b - val exp = NodeSeq.fromSeq(Seq(Hello, Hi)) + val exp: NodeSeq = NodeSeq.fromSeq(Seq(Hello, Hi)) assertEquals(exp, res) } @Test - def testAppendedAll: Unit = { // Bug #392. + def testAppendedAll(): Unit = { // Bug #392. val a: NodeSeq = Hello - val b = Hi + val b: Elem = Hi a :+ Hi match { case res: Seq[Node] => assertEquals(2, res.size.toLong) case res: NodeSeq => fail("Should be Seq[Node] was NodeSeq") // Unreachable code? } val res: NodeSeq = a :+ b - val exp = NodeSeq.fromSeq(Seq(Hello, Hi)) + val exp: NodeSeq = NodeSeq.fromSeq(Seq(Hello, Hi)) assertEquals(exp, res) } @Test - def testPrepended: Unit = { + def testPrepended(): Unit = { val a: NodeSeq = Hello - val b = Hi + val b: Elem = Hi a +: Hi match { case res: Seq[Node] => assertEquals(2, res.size.toLong) case res: NodeSeq => fail("Should be Seq[Node] was NodeSeq") // Unreachable code? @@ -50,21 +51,21 @@ class NodeSeqTest { } @Test - def testPrependedAll: Unit = { + def testPrependedAll(): Unit = { val a: NodeSeq = Hello - val b = Hi - val c = Hey + val b: Elem = Hi + val c: Elem = Hey a ++: Hi ++: Hey match { case res: Seq[Node] => assertEquals(3, res.size.toLong) case res: NodeSeq => fail("Should be Seq[Node] was NodeSeq") // Unreachable code? } val res: NodeSeq = a ++: b ++: c - val exp = NodeSeq.fromSeq(Seq(Hello, Hi, Hey)) + val exp: NodeSeq = NodeSeq.fromSeq(Seq(Hello, Hi, Hey)) assertEquals(exp, res) } @Test - def testMap: Unit = { + def testMap(): Unit = { val a: NodeSeq = Hello val exp: NodeSeq = Seq(Hi) assertEquals(exp, a.map(_ => Hi)) @@ -72,7 +73,7 @@ class NodeSeqTest { } @Test - def testFlatMap: Unit = { + def testFlatMap(): Unit = { val a: NodeSeq = Hello val exp: NodeSeq = Seq(Hi) assertEquals(exp, a.flatMap(_ => Seq(Hi))) @@ -81,8 +82,8 @@ class NodeSeqTest { } @Test - def testStringProjection: Unit = { - val a = + def testStringProjection(): Unit = { + val a: Elem = b @@ -93,7 +94,7 @@ class NodeSeqTest { c - val res = for { + val res: Seq[String] = for { b <- a \ "b" c <- b.child e <- (c \ "e").headOption diff --git a/shared/src/test/scala/scala/xml/PCDataTest.scala b/shared/src/test/scala/scala/xml/PCDataTest.scala index 78fd494fb..3dce2f60c 100644 --- a/shared/src/test/scala/scala/xml/PCDataTest.scala +++ b/shared/src/test/scala/scala/xml/PCDataTest.scala @@ -5,33 +5,23 @@ import org.junit.Assert.assertEquals class PCDataTest { - @Test - def emptyTest = { - val pcdata = new PCData("") - assertEquals("", pcdata.toString) + def check(pcdata: String, expected: String): Unit = { + val actual: PCData = new PCData(pcdata) + assertEquals(expected, actual.toString) } @Test - def bracketTest = { - val pcdata = new PCData("[]") - assertEquals("", pcdata.toString) - } + def emptyTest(): Unit = check("", "") @Test - def hellaBracketingTest = { - val pcdata = new PCData("[[[[[[[[]]]]]]]]") - assertEquals("", pcdata.toString) - } + def bracketTest(): Unit = check("[]", "") @Test - def simpleNestingTest = { - val pcdata = new PCData("]]>") - assertEquals("]]>", pcdata.toString) - } + def hellaBracketingTest(): Unit = check("[[[[[[[[]]]]]]]]", "") @Test - def recursiveNestingTest = { - val pcdata = new PCData("") - assertEquals("]]>", pcdata.toString) - } + def simpleNestingTest(): Unit = check("]]>", "]]>") + + @Test + def recursiveNestingTest(): Unit = check("", "]]>") } diff --git a/shared/src/test/scala/scala/xml/PatternMatchingTest.scala b/shared/src/test/scala/scala/xml/PatternMatchingTest.scala index b2892c9cb..d2d809c93 100644 --- a/shared/src/test/scala/scala/xml/PatternMatchingTest.scala +++ b/shared/src/test/scala/scala/xml/PatternMatchingTest.scala @@ -7,39 +7,39 @@ import org.junit.Assert.assertEquals class PatternMatchingTest { @Test - def unprefixedAttribute: Unit = { - val li = List("1", "2", "3", "4") + def unprefixedAttribute(): Unit = { + val li: List[String] = List("1", "2", "3", "4") assertTrue(matchSeq(li)) assertTrue(matchList(li)) } - def matchSeq(args: Seq[String]) = args match { + def matchSeq(args: Seq[String]): Boolean = args match { case Seq(a, b, c, d @ _*) => true } - def matchList(args: List[String]) = + def matchList(args: List[String]): Boolean = Elem(null, "bla", Null, TopScope, minimizeEmpty = true, args.map { x => Text(x) }: _*) match { case Elem(_, _, _, _, Text("1"), _*) => true } @Test - def simpleNode = + def simpleNode(): Unit = assertTrue( match { case => true }) @Test - def nameSpaced = + def nameSpaced(): Unit = assertTrue( match { case => true }) - val cx = - crazy text world - + val cx: Elem = + crazy text world + @Test - def nodeContents = { + def nodeContents(): Unit = { assertTrue(Utility.trim(cx) match { case n @ crazy text world if (n \ "@foo") xml_== "bar" => true }) @@ -47,13 +47,12 @@ class PatternMatchingTest { case n @ crazy text world if (n \ "@foo") xml_== "bar" => true }) assertTrue( match { - case scala.xml.QNode("gaga", "foo", md, child @ _*) => true + case QNode("gaga", "foo", md, child @ _*) => true }) assertTrue( match { - case scala.xml.Node("foo", md, child @ _*) => true + case Node("foo", md, child @ _*) => true }) - } object SafeNodeSeq { @@ -67,10 +66,8 @@ class PatternMatchingTest { } @Test - def nodeSeq = { // t0646 - import scala.xml.NodeSeq - - val books = + def nodeSeq(): Unit = { // t0646 + val books: Elem = Blabla Blubabla @@ -90,7 +87,7 @@ class PatternMatchingTest { } @Test - def SI_4124 = { + def SI_4124(): Unit = { val body: Node = hi assertTrue((body: AnyRef, "foo") match { diff --git a/shared/src/test/scala/scala/xml/PrintEmptyElementsTest.scala b/shared/src/test/scala/scala/xml/PrintEmptyElementsTest.scala index a1d9b11cc..e61e195d7 100644 --- a/shared/src/test/scala/scala/xml/PrintEmptyElementsTest.scala +++ b/shared/src/test/scala/scala/xml/PrintEmptyElementsTest.scala @@ -6,7 +6,7 @@ import JUnitAssertsForXML.assertEquals class PrintEmptyElementsTest { @Test - def representEmptyXMLElementsInShortForm: Unit = { + def representEmptyXMLElementsInShortForm(): Unit = { val expected: String = """| | @@ -29,27 +29,26 @@ class PrintEmptyElementsTest { } @Test - def programmaticLong: Unit = { + def programmaticLong(): Unit = { assertEquals(" ", - Elem(null, "emptiness", Null, TopScope, false) ++ Text(" ") ++ Comment("programmatic long")) + Elem(null, "emptiness", Null, TopScope, minimizeEmpty = false) ++ Text(" ") ++ Comment("programmatic long")) } @Test - def programmaticShort: Unit = { + def programmaticShort(): Unit = { assertEquals(" ", - Elem(null, "vide", Null, TopScope, true) ++ Text(" ") ++ Comment("programmatic short")) + Elem(null, "vide", Null, TopScope, minimizeEmpty = true) ++ Text(" ") ++ Comment("programmatic short")) } @Test - def programmaticShortWithAttribute: Unit = { + def programmaticShortWithAttribute(): Unit = { assertEquals(""" """, - Elem(null, "elem", Attribute("attr", Text("value"), Null), TopScope, true) ++ Text(" ") ++ Comment ("programmatic short with attribute")) + Elem(null, "elem", Attribute("attr", Text("value"), Null), TopScope, minimizeEmpty = true) ++ Text(" ") ++ Comment ("programmatic short with attribute")) } @Test - def programmaticLongWithAttribute: Unit = { + def programmaticLongWithAttribute(): Unit = { assertEquals(""" """, - Elem(null, "elem2", Attribute("attr2", Text("value2"), Null), TopScope, false) ++ Text(" ") ++ Comment ("programmatic long with attribute")) + Elem(null, "elem2", Attribute("attr2", Text("value2"), Null), TopScope, minimizeEmpty = false) ++ Text(" ") ++ Comment ("programmatic long with attribute")) } - } diff --git a/shared/src/test/scala/scala/xml/Properties.scala b/shared/src/test/scala/scala/xml/Properties.scala index 92a819903..b160e3023 100644 --- a/shared/src/test/scala/scala/xml/Properties.scala +++ b/shared/src/test/scala/scala/xml/Properties.scala @@ -14,6 +14,6 @@ package scala package xml object Properties extends util.PropertiesTrait { - override protected def propCategory = "scala-xml" - override protected def pickJarBasedOn = classOf[scala.xml.Node] + override protected def propCategory: String = "scala-xml" + override protected def pickJarBasedOn: Class[Node] = classOf[Node] } diff --git a/shared/src/test/scala/scala/xml/ShouldCompile.scala b/shared/src/test/scala/scala/xml/ShouldCompile.scala index e394b4b90..12c1e841b 100644 --- a/shared/src/test/scala/scala/xml/ShouldCompile.scala +++ b/shared/src/test/scala/scala/xml/ShouldCompile.scala @@ -17,15 +17,15 @@ class Foo { // t2281 class t2281A { - def f(x: Boolean) = if (x)

else
+ def f(x: Boolean): Seq[Node] = if (x)

else
} class t2281B { def splitSentences(text: String): ArrayBuffer[String] = { - val outarr = new ArrayBuffer[String] - var outstr = new StringBuffer - var prevspace = false - val ctext = text.replaceAll("\n+", "\n") + val outarr: ArrayBuffer[String] = new ArrayBuffer[String] + var outstr: StringBuffer = new StringBuffer + var prevspace: Boolean = false + val ctext: String = text.replaceAll("\n+", "\n") ctext foreach { c => outstr append c if (c == '.' || c == '!' || c == '?' || c == '\n' || c == ':' || c == ';' || (prevspace && c == '-')) { @@ -43,15 +43,15 @@ class t2281B { outarr } - def spanForSentence(x: String, picktext: String) = + def spanForSentence(x: String, picktext: String): Seq[Node] = if (x == "\n\n") {

} else { { x } } - def selectableSentences(text: String, picktext: String) = { - val sentences = splitSentences(text) + def selectableSentences(text: String, picktext: String): ArrayBuffer[Seq[Node]] = { + val sentences: ArrayBuffer[String] = splitSentences(text) sentences.map(x => spanForSentence(x, picktext)) } } @@ -62,7 +62,7 @@ object SI_5858 { } class Floozy { - def fooz(x: Node => String) = {} + def fooz(x: Node => String): Unit = () def foo(m: Node): Unit = fooz { case Elem(_, _, _, _, n, _*) if n == m => "gaga" } @@ -82,7 +82,7 @@ object guardedMatch { // SI-3705 // SI-6897 object shouldCompile { - val html = (null: Any) match { + val html: Seq[Node] = (null: Any) match { case 1 => case 2 =>

} diff --git a/shared/src/test/scala/scala/xml/UtilityTest.scala b/shared/src/test/scala/scala/xml/UtilityTest.scala index 73d4a85a4..219dbdd2a 100644 --- a/shared/src/test/scala/scala/xml/UtilityTest.scala +++ b/shared/src/test/scala/scala/xml/UtilityTest.scala @@ -9,45 +9,45 @@ import org.junit.Assert.assertNotEquals class UtilityTest { @Test - def isNameStart: Unit = { + def isNameStart(): Unit = { assertTrue(Utility.isNameStart('b')) assertTrue(Utility.isNameStart(':')) } @Test - def trim: Unit = { - val x = - - - val y = xml.Utility.trim(x) + def trim(): Unit = { + val x: Elem = + + + val y: Node = Utility.trim(x) assertTrue(y match { case => true }) - val x2 = + val x2: Elem = a b b a - val y2 = xml.Utility.trim(x2) + val y2: Node = Utility.trim(x2) assertTrue(y2 match { case a b b a => true }) } @Test - def aposEscaping: Unit = { - val z = '' - val z1 = z.toString + def aposEscaping(): Unit = { + val z: Elem = '' + val z1: String = z.toString assertEquals("''", z1) } @Test - def sort: Unit = { - assertEquals("", xml.Utility.sort(.attributes).toString) - assertEquals(""" b="c"""", xml.Utility.sort(.attributes).toString) - val q = xml.Utility.sort() - assertEquals(" a=\"2\" g=\"3\" j=\"2\" oo=\"2\"", xml.Utility.sort(q.attributes).toString) - val pp = new xml.PrettyPrinter(80,5) + def sort(): Unit = { + assertEquals("", Utility.sort(.attributes).toString) + assertEquals(""" b="c"""", Utility.sort(.attributes).toString) + val q: Node = Utility.sort() + assertEquals(" a=\"2\" g=\"3\" j=\"2\" oo=\"2\"", Utility.sort(q.attributes).toString) + val pp: PrettyPrinter = new PrettyPrinter(80,5) assertEquals("", pp.format(q)) } @Test - def issue777: Unit = { + def issue777(): Unit = { @@ -55,14 +55,14 @@ class UtilityTest { } @Test - def issue90: Unit = { - val x = + def issue90(): Unit = { + val x: Elem = assertEquals("", Utility.serialize(x, minimizeTags = MinimizeMode.Always).toString) } @Test - def issue183: Unit = { - val x = + def issue183(): Unit = { + val x: Elem = assertEquals("", Utility.serialize(x, stripComments = true).toString) assertEquals("", Utility.serialize(x, stripComments = false).toString) } @@ -81,7 +81,7 @@ class UtilityTest { Utility.Escapes.escMap.keys.toSeq @Test - def escapePrintablesTest: Unit = { + def escapePrintablesTest(): Unit = { for { char <- printableAscii.diff(escapedChars) } yield { @@ -90,7 +90,7 @@ class UtilityTest { } @Test - def escapeEscapablesTest: Unit = { + def escapeEscapablesTest(): Unit = { for { char <- escapedChars } yield { @@ -99,7 +99,7 @@ class UtilityTest { } @Test - def escapeAsciiControlCharsTest: Unit = { + def escapeAsciiControlCharsTest(): Unit = { /* Escapes that Scala (Java) doesn't support. * \u0007 -> \a (bell) @@ -107,18 +107,18 @@ class UtilityTest { * \u000B -> \v (vertical tab) * \u007F -> DEL (delete) */ - val input = " \u0007\b\u001B\f\n\r\t\u000B\u007F" + val input: String = " \u0007\b\u001B\f\n\r\t\u000B\u007F" - val expect = " \n\r\t\u007F" + val expect: String = " \n\r\t\u007F" - val result = Utility.escape(input) + val result: String = Utility.escape(input) assertEquals(printfc(expect), printfc(result)) // Pretty, assertEquals(expect, result) // but verify. } @Test - def escapeUnicodeExtendedControlCodesTest: Unit = { + def escapeUnicodeExtendedControlCodesTest(): Unit = { for { char <- '\u0080' to '\u009f' // Extended control codes (C1) } yield { @@ -127,7 +127,7 @@ class UtilityTest { } @Test - def escapeUnicodeTwoBytesTest: Unit = { + def escapeUnicodeTwoBytesTest(): Unit = { for { char <- '\u00A0' to '\u07FF' // Two bytes (cont.) } yield { @@ -136,7 +136,7 @@ class UtilityTest { } @Test - def escapeUnicodeThreeBytesTest: Unit = { + def escapeUnicodeThreeBytesTest(): Unit = { for { char <- '\u0800' to '\uFFFF' // Three bytes } yield { @@ -151,7 +151,7 @@ class UtilityTest { * * Or think of `printf("%c", i)` in C, but a little better. */ - def printfc(str: String) = { + def printfc(str: String): String = { str.map(prettyChar).mkString } @@ -197,26 +197,26 @@ class UtilityTest { (key: Char) => key.toString } - def issue73StartsWithAndEndsWithWSInFirst: Unit = { - val x =
{Text(" My name is ")}{Text("Harry")}
+ def issue73StartsWithAndEndsWithWSInFirst(): Unit = { + val x: Elem =
{Text(" My name is ")}{Text("Harry")}
assertEquals(
My name is Harry
, Utility.trim(x)) } @Test - def issue73EndsWithWSInLast: Unit = { - val x =
{Text("My name is ")}{Text("Harry ")}
+ def issue73EndsWithWSInLast(): Unit = { + val x: Elem =
{Text("My name is ")}{Text("Harry ")}
assertEquals(
My name is Harry
, Utility.trim(x)) } @Test - def issue73HasWSInMiddle: Unit = { - val x =
{Text("My name is")}{Text(" ")}{Text("Harry")}
+ def issue73HasWSInMiddle(): Unit = { + val x: Elem =
{Text("My name is")}{Text(" ")}{Text("Harry")}
assertEquals(
My name is Harry
, Utility.trim(x)) } @Test - def issue73HasWSEverywhere: Unit = { - val x =
{Text(" My name ")}{Text(" is ")}{Text(" Harry ")}
+ def issue73HasWSEverywhere(): Unit = { + val x: Elem =
{Text(" My name ")}{Text(" is ")}{Text(" Harry ")}
assertEquals(
My name is Harry
, Utility.trim(x)) } } diff --git a/shared/src/test/scala/scala/xml/XMLEmbeddingTest.scala b/shared/src/test/scala/scala/xml/XMLEmbeddingTest.scala index 398ab6dde..746513ee1 100644 --- a/shared/src/test/scala/scala/xml/XMLEmbeddingTest.scala +++ b/shared/src/test/scala/scala/xml/XMLEmbeddingTest.scala @@ -6,13 +6,12 @@ import org.junit.Assert.assertEquals class XMLEmbeddingTest { @Test - def basic: Unit = { - val ya = {{ + def basic(): Unit = { + val ya: Elem = {{ assertEquals("{", ya.text) - val ua = }} + val ua: Elem = }} assertEquals("}", ua.text) - val za = {{}}{{}}{{}} + val za: Elem = {{}}{{}}{{}} assertEquals("{}{}{}", za.text) } - } diff --git a/shared/src/test/scala/scala/xml/XMLSyntaxTest.scala b/shared/src/test/scala/scala/xml/XMLSyntaxTest.scala index 700709f29..9f873abc3 100644 --- a/shared/src/test/scala/scala/xml/XMLSyntaxTest.scala +++ b/shared/src/test/scala/scala/xml/XMLSyntaxTest.scala @@ -14,37 +14,37 @@ class XMLSyntaxTest { @Test def test1(): Unit = { - val xNull = {null} // these used to be Atom(unit), changed to empty children + val xNull: Elem = {null} // these used to be Atom(unit), changed to empty children assertTrue(xNull.child sameElements Nil) - val x0 = {} // these used to be Atom(unit), changed to empty children - val x00 = { } // dto. - val xa = { "world" } + val x0: Elem = {} // these used to be Atom(unit), changed to empty children + val x00: Elem = { } // dto. + val xa: Elem = { "world" } assertTrue(x0.child sameElements Nil) assertTrue(x00.child sameElements Nil) assertEquals("world", handle[String](xa)) - val xb = { 1.5 } + val xb: Elem = { 1.5 } assertEquals(1.5, handle[Double](xb), 0.0) - val xc = { 5 } + val xc: Elem = { 5 } assertEquals(5, handle[Int](xc).toLong) - val xd = { true } + val xd: Elem = { true } assertEquals(true, handle[Boolean](xd)) - val xe = { 5:Short } + val xe: Elem = { 5:Short } assertEquals((5:Short).toLong, handle[Short](xe).toLong) - val xf = { val x = 27; x } + val xf: Elem = { val x = 27; x } assertEquals(27, handle[Int](xf).toLong) - val xg = { List(1,2,3,4) } + val xg: Elem = { List(1,2,3,4) } assertEquals("1 2 3 4", xg.toString) assertFalse(xg.child.map(_.isInstanceOf[Text]).exists(identity)) - val xh = { for(x <- List(1,2,3,4) if x % 2 == 0) yield x } + val xh: Elem = { for(x <- List(1,2,3,4) if x % 2 == 0) yield x } assertEquals("2 4", xh.toString) assertFalse(xh.child.map(_.isInstanceOf[Text]).exists(identity)) } @@ -55,12 +55,11 @@ class XMLSyntaxTest { @Test def test2(): Unit = { val x1: Option[Seq[Node]] = Some(hello) - val n1 = + val n1: Elem = assertEquals(x1, n1.attribute("key")) val x2: Option[Seq[Node]] = None - val n2 = + val n2: Elem = assertEquals(x2, n2.attribute("key")) } - } diff --git a/shared/src/test/scala/scala/xml/XMLTest.scala b/shared/src/test/scala/scala/xml/XMLTest.scala index f57aeb2fa..4de79b799 100644 --- a/shared/src/test/scala/scala/xml/XMLTest.scala +++ b/shared/src/test/scala/scala/xml/XMLTest.scala @@ -6,45 +6,45 @@ import org.junit.{Test => UnitTest} import org.junit.Assert.assertTrue import org.junit.Assert.assertFalse import org.junit.Assert.assertEquals -// import scala.xml.parsing.ConstructingParser import java.io.StringWriter import scala.collection.Iterable import scala.collection.Seq +import scala.xml.dtd.{DocType, PublicID} import scala.xml.Utility.sort object XMLTest { - val e: scala.xml.MetaData = Null //Node.NoAttributes - val sc: scala.xml.NamespaceBinding = TopScope + val e: MetaData = Null //Node.NoAttributes + val sc: NamespaceBinding = TopScope } class XMLTest { @UnitTest - def nodeSeq: Unit = { - val p = - - - - + def nodeSeq(): Unit = { + val p: Elem = + + + + - val pelems_1 = for (x <- p \ "bar"; y <- p \ "baz") yield { + val pelems_1: NodeSeq = for (x <- p \ "bar"; y <- p \ "baz") yield { Text(x.attributes("value").toString + y.attributes("bazValue").toString + "!") } - val pelems_2 = NodeSeq.fromSeq(List(Text("38!"), Text("58!"))) + val pelems_2: NodeSeq = NodeSeq.fromSeq(List(Text("38!"), Text("58!"))) assertTrue(pelems_1 sameElements pelems_2) assertTrue(Text("8") sameElements (p \\ "@bazValue")) } @UnitTest - def queryBooks: Unit = { - val books = + def queryBooks(): Unit = { + val books: Elem = Blabla Blubabla Baaaaaaalabla - val reviews = + val reviews: Elem = Blabla @@ -66,7 +66,7 @@ class XMLTest { - val results1 = new scala.xml.PrettyPrinter(80, 5).formatNodes( + val results1: String = new PrettyPrinter(80, 5).formatNodes( for { t <- books \\ "title" r <- reviews \\ "entry" if (r \ "title") xml_== t @@ -74,7 +74,7 @@ class XMLTest { { t } { r \ "remarks" } ) - val results1Expected = """ + val results1Expected: String = """ | Blabla | Hallo Welt. | @@ -87,17 +87,16 @@ class XMLTest { assertEquals(results1Expected, results1) { - val actual = for (t @ Blabla <- NodeSeq.fromSeq(books.child).toList) + val actual: List[Node] = for (t @ Blabla <- NodeSeq.fromSeq(books.child).toList) yield t - val expected = List(Blabla) + val expected: List[Elem] = List(Blabla) assertEquals(expected, actual) } - } @UnitTest - def queryPhoneBook: Unit = { - val phoneBook = + def queryPhoneBook(): Unit = { + val phoneBook: Elem = This is thephonebook @@ -112,7 +111,7 @@ class XMLTest {
- val addrBook = + val addrBook: Elem = This is theaddressbook @@ -127,7 +126,7 @@ class XMLTest {
- val actual: String = new scala.xml.PrettyPrinter(80, 5).formatNodes( + val actual: String = new PrettyPrinter(80, 5).formatNodes( for { t <- addrBook \\ "entry" r <- phoneBook \\ "entry" if (t \ "name") xml_== (r \ "name") @@ -135,32 +134,33 @@ class XMLTest { { t.child } { r \ "phone" } ) - val expected = """| - | John - | Elm Street - | Dolphin City - | +41 21 693 68 67 - | +41 79 602 23 23 - |""".stripMargin + val expected: String = + """| + | John + | Elm Street + | Dolphin City + | +41 21 693 68 67 + | +41 79 602 23 23 + |""".stripMargin assertEquals(expected, actual) } @UnitTest(expected=classOf[IllegalArgumentException]) - def failEmptyStringChildren: Unit = { + def failEmptyStringChildren(): Unit = { \ "" } @UnitTest(expected=classOf[IllegalArgumentException]) - def failEmptyStringDescendants: Unit = { + def failEmptyStringDescendants(): Unit = { \\ "" } @UnitTest - def namespaces: Unit = { - val cuckoo = - - - + def namespaces(): Unit = { + val cuckoo: Elem = + + + assertEquals("http://cuckoo.com", cuckoo.namespace) for (n <- cuckoo \ "_") { assertEquals("http://cuckoo.com", n.namespace) @@ -168,11 +168,11 @@ class XMLTest { } @UnitTest - def namespacesWithNestedXmls: Unit = { - val foo = - val bar = {foo} - val expected = """""" - val actual = bar.toString + def namespacesWithNestedXmls(): Unit = { + val foo: Elem = + val bar: Elem = {foo} + val expected: String = """""" + val actual: String = bar.toString assertEquals(expected, actual) } @@ -180,7 +180,7 @@ class XMLTest { scala.xml.Elem.apply(prefix, label, attributes, scope, minimizeEmpty = true, child: _*) @UnitTest - def groupNode = { + def groupNode(): Unit = { val zx1: Node = Group { } val zy1: Node = { zx1 } assertEquals("", zy1.toString) @@ -188,39 +188,39 @@ class XMLTest { assertEquals("", Group { List(, zy1, zx1) }.toString) - val zz1 = + val zz1: Group = assertTrue(zx1 xml_== zz1) assertTrue(zz1.length == 3) } @UnitTest - def dodgyNamespace = { - val x = + def dodgyNamespace(): Unit = { + val x: Elem = assertTrue(x.toString.matches(".*xmlns:dog=\"http://dog.com\".*")) } - val ax = - - + val ax: Elem = + + - val cx = - crazy text world - + val cx: Elem = + crazy text world + - val bx = + val bx: Elem = @UnitTest - def XmlEx = { + def XmlEx(): Unit = { assertTrue((ax \ "@foo") xml_== "bar") // uses NodeSeq.view! - assertTrue((ax \ "@foo") xml_== xml.Text("bar")) // dto. + assertTrue((ax \ "@foo") xml_== Text("bar")) // dto. assertTrue((bx \ "@foo") xml_== "bar&x") // dto. - assertTrue((bx \ "@foo") xml_sameElements List(xml.Text("bar&x"))) + assertTrue((bx \ "@foo") xml_sameElements List(Text("bar&x"))) assertTrue("" == bx.toString) } @UnitTest - def XmlEy: Unit = { + def XmlEy(): Unit = { assertTrue((ax \ "@{the namespace from outer space}foo") xml_== "baz") assertTrue((cx \ "@{the namespace from outer space}foo") xml_== "baz") @@ -246,15 +246,15 @@ class XMLTest { } @UnitTest - def comment = + def comment(): Unit = assertEquals("", toString) @UnitTest - def weirdElem = + def weirdElem(): Unit = assertEquals("", toString) @UnitTest - def escape = + def escape(): Unit = assertEquals(""" "Come, come again, whoever you are, come! Heathen, fire worshipper or idolatrous, come! @@ -268,23 +268,23 @@ Ours is the portal of hope, come as you are." Mevlana Celaleddin Rumi]]> toString) // this guy will escaped, and rightly so @UnitTest - def unparsed2 = { - object myBreak extends scala.xml.Unparsed("
") + def unparsed2(): Unit = { + object myBreak extends Unparsed("
") assertEquals("
", { myBreak } toString) // shows use of unparsed } @UnitTest - def justDontFail = { + def justDontFail(): Unit = { match { - case scala.xml.QNode("gaga", "foo", md, child @ _*) => + case QNode("gaga", "foo", md, child @ _*) => } match { - case scala.xml.Node("foo", md, child @ _*) => + case Node("foo", md, child @ _*) => } } - def f(s: String) = { + def f(s: String): Elem = { { for (item <- s split ',') yield { item } @@ -293,7 +293,7 @@ Ours is the portal of hope, come as you are." } @UnitTest - def nodeBuffer = + def nodeBuffer(): Unit = assertEquals( """ abc @@ -313,7 +313,7 @@ Ours is the portal of hope, come as you are." @UnitTest - def wsdl = { + def wsdl(): Unit = { assertEquals(""" """, wsdlTemplate1("service1") toString) assertEquals(""" @@ -323,30 +323,28 @@ Ours is the portal of hope, come as you are." } @UnitTest - def t547: Unit = { + def t547(): Unit = { // ambiguous toString problem from #547 - val atom: scala.xml.Atom[Unit] = new scala.xml.Atom(()) + val atom: Atom[Unit] = new Atom(()) assertEquals(().toString, atom.toString) } @UnitTest - def t1079 = assertFalse( == ) - - import dtd.{ DocType, PublicID } + def t1079(): Unit = assertFalse( == ) @UnitTest - def t1620 = { - val dt = DocType("foo", PublicID("-//Foo Corp//DTD 1.0//EN", "foo.dtd"), Seq()) - var pw = new StringWriter() - XML.write(pw, , "utf-8", true, dt) + def t1620(): Unit = { + val dt: DocType = DocType("foo", PublicID("-//Foo Corp//DTD 1.0//EN", "foo.dtd"), Seq()) + var pw: StringWriter = new StringWriter() + XML.write(pw, , "utf-8", xmlDecl = true, dt) pw.flush() assertEquals(""" """, pw.toString) pw = new StringWriter() - val dt2 = DocType("foo", PublicID("-//Foo Corp//DTD 1.0//EN", null), Seq()) - XML.write(pw, , "utf-8", true, dt2) + val dt2: DocType = DocType("foo", PublicID("-//Foo Corp//DTD 1.0//EN", null), Seq()) + XML.write(pw, , "utf-8", xmlDecl = true, dt2) pw.flush() assertEquals(""" @@ -354,11 +352,11 @@ Ours is the portal of hope, come as you are." } @UnitTest - def t1773 = { - val xs = List( + def t1773(): Unit = { + val xs: List[Elem] = List(
, , - { xml.NodeSeq.Empty }, + { NodeSeq.Empty }, { "" }, { if (true) "" else "I like turtles" }) @@ -366,7 +364,7 @@ Ours is the portal of hope, come as you are." } @UnitTest - def t3886 = { + def t3886(): Unit = { assertTrue( == ) assertTrue( != ) assertTrue( != ) @@ -377,7 +375,7 @@ Ours is the portal of hope, come as you are." } @UnitTest - def t4124: Unit = { + def t4124(): Unit = { val body: Node = hi assertEquals("hi", ((body: AnyRef, "foo"): @unchecked) match { case (node: Node, "bar") => "bye" @@ -401,7 +399,7 @@ Ours is the portal of hope, come as you are." } @UnitTest - def t5052: Unit = { + def t5052(): Unit = { assertTrue( xml_== ) assertTrue( xml_== ) assertTrue( xml_== ) @@ -409,8 +407,8 @@ Ours is the portal of hope, come as you are." } @UnitTest - def t5115 = { - def assertHonorsIterableContract(i: Iterable[_]) = assertEquals(i.size.toLong, i.iterator.size.toLong) + def t5115(): Unit = { + def assertHonorsIterableContract(i: Iterable[_]): Unit = assertEquals(i.size.toLong, i.iterator.size.toLong) assertHonorsIterableContract(.attributes) assertHonorsIterableContract(.attributes) @@ -423,24 +421,24 @@ Ours is the portal of hope, come as you are." } @UnitTest - def t5843: Unit = { - val foo = scala.xml.Attribute(null, "foo", "1", scala.xml.Null) - val bar = scala.xml.Attribute(null, "bar", "2", foo) - val ns = scala.xml.NamespaceBinding(null, "uri", scala.xml.TopScope) + def t5843(): Unit = { + val foo: Attribute = Attribute(null, "foo", "1", Null) + val bar: Attribute = Attribute(null, "bar", "2", foo) + val ns: NamespaceBinding = NamespaceBinding(null, "uri", TopScope) assertEquals(""" foo="1"""", foo toString) - assertEquals(null, scala.xml.TopScope.getURI(foo.pre)) + assertEquals(null, TopScope.getURI(foo.pre)) assertEquals(""" bar="2"""", bar remove "foo" toString) assertEquals(""" foo="1"""", bar remove "bar" toString) - assertEquals(""" bar="2"""", bar remove (null, scala.xml.TopScope, "foo") toString) - assertEquals(""" foo="1"""", bar remove (null, scala.xml.TopScope, "bar") toString) + assertEquals(""" bar="2"""", bar remove (null, TopScope, "foo") toString) + assertEquals(""" foo="1"""", bar remove (null, TopScope, "bar") toString) assertEquals(""" bar="2" foo="1"""", bar toString) assertEquals(""" bar="2" foo="1"""", bar remove (null, ns, "foo") toString) assertEquals(""" bar="2" foo="1"""", bar remove (null, ns, "bar") toString) } @UnitTest - def t7074: Unit = { + def t7074(): Unit = { assertEquals("""""", sort() toString) assertEquals("""""", sort() toString) assertEquals("""""", sort() toString) @@ -453,20 +451,20 @@ Ours is the portal of hope, come as you are." } @UnitTest - def attributes = { - val noAttr = - val attrNull = - val attrNone = - val preAttrNull = - val preAttrNone = + def attributes(): Unit = { + val noAttr: Elem = + val attrNull: Elem = + val attrNone: Elem = + val preAttrNull: Elem = + val preAttrNone: Elem = assertEquals(noAttr, attrNull) assertEquals(noAttr, attrNone) assertEquals(noAttr, preAttrNull) assertEquals(noAttr, preAttrNone) - val xml1 = - val xml2 = - val xml3 = + val xml1: Elem = + val xml2: Elem = + val xml3: Elem = assertEquals(xml1, xml2) assertEquals(xml1, xml3) @@ -487,11 +485,11 @@ Ours is the portal of hope, come as you are." } @UnitTest - def issue28: Unit = { - val x = + def issue28(): Unit = { + val x: Elem = // val ns = new NamespaceBinding("x", "gaga", sc) // val x = Elem("x", "foo", e, ns) - val pp = new xml.PrettyPrinter(80, 2) + val pp: PrettyPrinter = new PrettyPrinter(80, 2) // This assertion passed assertEquals("""""", x.toString) // This was the bug, producing an errant xmlns attribute @@ -499,35 +497,35 @@ Ours is the portal of hope, come as you are." } @UnitTest - def nodeSeqNs: Unit = { - val x = { + def nodeSeqNs(): Unit = { + val x: NodeBuffer = { } - val pp = new PrettyPrinter(80, 2) - val expected = """""" + val pp: PrettyPrinter = new PrettyPrinter(80, 2) + val expected: String = """""" assertEquals(expected, pp.formatNodes(x)) } @UnitTest - def nodeStringBuilder: Unit = { - val x = { + def nodeStringBuilder(): Unit = { + val x: Elem = { } - val pp = new PrettyPrinter(80, 2) - val expected = """""" - val sb = new StringBuilder + val pp: PrettyPrinter = new PrettyPrinter(80, 2) + val expected: String = """""" + val sb: StringBuilder = new StringBuilder pp.format(x, sb) assertEquals(expected, sb.toString) } @UnitTest - def i1976: Unit = { - val node = { "whatever " } + def i1976(): Unit = { + val node: Elem = { "whatever " } assertEquals("whatever ", node.child.text) } @UnitTest - def i6547: Unit = { + def i6547(): Unit = { } } diff --git a/shared/src/test/scala/scala/xml/dtd/DeclTest.scala b/shared/src/test/scala/scala/xml/dtd/DeclTest.scala index a41542897..5b01fb2fc 100644 --- a/shared/src/test/scala/scala/xml/dtd/DeclTest.scala +++ b/shared/src/test/scala/scala/xml/dtd/DeclTest.scala @@ -7,7 +7,7 @@ import org.junit.Assert.assertEquals class DeclTest { @Test - def elemDeclToString: Unit = { + def elemDeclToString(): Unit = { assertEquals( "", ElemDecl("x", PCDATA).toString @@ -15,14 +15,14 @@ class DeclTest { } @Test - def attListDeclToString: Unit = { + def attListDeclToString(): Unit = { - val expected = + val expected: String = """|""".stripMargin - val actual = AttListDecl("x", + val actual: String = AttListDecl("x", List( AttrDecl("y", "CDATA", REQUIRED), AttrDecl("z", "CDATA", REQUIRED) @@ -33,7 +33,7 @@ class DeclTest { } @Test - def parsedEntityDeclToString: Unit = { + def parsedEntityDeclToString(): Unit = { assertEquals( """""", ParsedEntityDecl("foo", ExtDef(SystemID("bar"))).toString diff --git a/shared/src/test/scala/scala/xml/parsing/PiParsingTest.scala b/shared/src/test/scala/scala/xml/parsing/PiParsingTest.scala index cca701b31..6bbff668a 100644 --- a/shared/src/test/scala/scala/xml/parsing/PiParsingTest.scala +++ b/shared/src/test/scala/scala/xml/parsing/PiParsingTest.scala @@ -6,15 +6,14 @@ import scala.xml.JUnitAssertsForXML.assertEquals class PiParsingTest { @Test - def piNoWSLiteral: Unit = { - val expected = "ab" + def piNoWSLiteral(): Unit = { + val expected: String = "ab" assertEquals(expected, ab) } @Test - def piLiteral: Unit = { - val expected = " a b " + def piLiteral(): Unit = { + val expected: String = " a b " assertEquals(expected, a b ) } - } diff --git a/shared/src/test/scala/scala/xml/parsing/Ticket0632Test.scala b/shared/src/test/scala/scala/xml/parsing/Ticket0632Test.scala index 8adbd2503..b35bc4d36 100644 --- a/shared/src/test/scala/scala/xml/parsing/Ticket0632Test.scala +++ b/shared/src/test/scala/scala/xml/parsing/Ticket0632Test.scala @@ -6,24 +6,23 @@ import scala.xml.JUnitAssertsForXML.assertEquals class Ticket0632Test { @Test - def singleAmp: Unit = { - val expected = "" + def singleAmp(): Unit = { + val expected: String = "" assertEquals(expected, ) assertEquals(expected, ) } @Test - def oneAndHalfAmp: Unit = { - val expected = "" + def oneAndHalfAmp(): Unit = { + val expected: String = "" assertEquals(expected, ) assertEquals(expected, ) } @Test - def doubleAmp: Unit = { - val expected = "" + def doubleAmp(): Unit = { + val expected: String = "" assertEquals(expected, ) assertEquals(expected, ) } - } From 8ab7fd3ae75d5c78f503245da332416cea63d118 Mon Sep 17 00:00:00 2001 From: Mike McGann Date: Wed, 15 Mar 2023 15:43:23 -0400 Subject: [PATCH 649/789] Fix infinite loop caused by unclosed character ref Resolves #306 If parseCharRef is called for an unclosed character reference it will get caught in an infinite loop if the end of file is reached. Add a check to exit the loop when an EOF is encountered. --- shared/src/main/scala/scala/xml/Utility.scala | 4 ++-- shared/src/test/scala/scala/xml/UtilityTest.scala | 11 +++++++++++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/shared/src/main/scala/scala/xml/Utility.scala b/shared/src/main/scala/scala/xml/Utility.scala index c812e4b6b..ad39b9947 100755 --- a/shared/src/main/scala/scala/xml/Utility.scala +++ b/shared/src/main/scala/scala/xml/Utility.scala @@ -392,7 +392,7 @@ object Utility extends AnyRef with parsing.TokenTests { val hex: Boolean = (ch() == 'x') && { nextch(); true } val base: Int = if (hex) 16 else 10 var i: Int = 0 - while (ch() != ';') { + while (ch() != ';' && ch() != 0) { ch() match { case '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9' => i = i * base + ch().asDigit @@ -410,6 +410,6 @@ object Utility extends AnyRef with parsing.TokenTests { } nextch() } - new String(Array(i), 0, 1) + if (i != 0) new String(Array(i), 0, 1) else "" } } diff --git a/shared/src/test/scala/scala/xml/UtilityTest.scala b/shared/src/test/scala/scala/xml/UtilityTest.scala index 219dbdd2a..2307aef4a 100644 --- a/shared/src/test/scala/scala/xml/UtilityTest.scala +++ b/shared/src/test/scala/scala/xml/UtilityTest.scala @@ -219,4 +219,15 @@ class UtilityTest { val x: Elem =
{Text(" My name ")}{Text(" is ")}{Text(" Harry ")}
assertEquals(
My name is Harry
, Utility.trim(x)) } + + @Test + def issue306InvalidUnclosedEntity(): Unit = { + val entity = "&# test " + val it: Iterator[Char] = entity.iterator + var c = it.next() + val next = () => if (it.hasNext) c = it.next() else c = 0.asInstanceOf[Char] + val result = Utility.parseCharRef({ () => c }, next, _ => {}, _ => {}) + assertEquals("", result) + } + } From deaa3a6c6f6957697340bf690b528038e302517a Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Wed, 22 Mar 2023 19:35:40 +0000 Subject: [PATCH 650/789] Update junit-runtime, nscplugin, ... to 0.4.12 --- project/plugins.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/plugins.sbt b/project/plugins.sbt index 03d3022b8..9fc720ad8 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -2,5 +2,5 @@ addSbtPlugin("org.scala-lang.modules" % "sbt-scala-module" % "3.0.1") addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.2.0") addSbtPlugin("org.portable-scala" % "sbt-scala-native-crossproject" % "1.2.0") addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.13.0") -addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.4.10") +addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.4.12") addSbtPlugin("de.heikoseeberger" % "sbt-header" % "5.9.0") From 018fa4afccc276a6acc7a133b989539026c4b367 Mon Sep 17 00:00:00 2001 From: Mike McGann Date: Mon, 27 Mar 2023 08:56:24 -0400 Subject: [PATCH 651/789] Rename test method --- shared/src/test/scala/scala/xml/UtilityTest.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shared/src/test/scala/scala/xml/UtilityTest.scala b/shared/src/test/scala/scala/xml/UtilityTest.scala index 2307aef4a..87384d3e4 100644 --- a/shared/src/test/scala/scala/xml/UtilityTest.scala +++ b/shared/src/test/scala/scala/xml/UtilityTest.scala @@ -221,7 +221,7 @@ class UtilityTest { } @Test - def issue306InvalidUnclosedEntity(): Unit = { + def issue306InvalidUnclosedCharRef(): Unit = { val entity = "&# test " val it: Iterator[Char] = entity.iterator var c = it.next() From 16374df8d9c7b5d74c695f8584caf3b26c86a20c Mon Sep 17 00:00:00 2001 From: Leonid Dubinsky Date: Sun, 26 Mar 2023 15:12:47 -0400 Subject: [PATCH 652/789] cleanup - fix some dangling ScalaDoc references - drop `()` after `toString` and a few other methods - replace unused pattern variables with `_` - remove code duplication in name-splitting --- build.sbt | 2 +- jvm/src/test/scala/scala/xml/XMLTest.scala | 5 +- .../src/main/scala/scala/xml/Attribute.scala | 12 +-- .../src/main/scala/scala/xml/Equality.scala | 4 +- shared/src/main/scala/scala/xml/Group.scala | 2 +- .../src/main/scala/scala/xml/MetaData.scala | 8 +- shared/src/main/scala/scala/xml/Node.scala | 8 +- shared/src/main/scala/scala/xml/NodeSeq.scala | 6 +- shared/src/main/scala/scala/xml/Null.scala | 7 +- .../main/scala/scala/xml/PrettyPrinter.scala | 6 +- .../main/scala/scala/xml/SpecialNode.scala | 2 +- .../src/main/scala/scala/xml/TopScope.scala | 2 +- shared/src/main/scala/scala/xml/Utility.scala | 25 +++--- shared/src/main/scala/scala/xml/XML.scala | 2 +- .../src/main/scala/scala/xml/dtd/Decl.scala | 8 +- .../main/scala/scala/xml/dtd/DocType.scala | 2 +- .../main/scala/scala/xml/dtd/ExternalID.scala | 2 +- .../scala/xml/dtd/ValidationException.scala | 2 +- .../scala/xml/dtd/impl/BaseBerrySethi.scala | 2 +- .../scala/xml/dtd/impl/DetWordAutom.scala | 2 +- .../scala/xml/dtd/impl/WordBerrySethi.scala | 2 +- .../scala/scala/xml/factory/XMLLoader.scala | 4 +- .../scala/xml/include/XIncludeException.scala | 2 +- .../xml/include/sax/XIncludeFilter.scala | 37 +++++---- .../scala/xml/include/sax/XIncluder.scala | 2 +- .../scala/xml/parsing/FactoryAdapter.scala | 13 +--- .../scala/xml/parsing/MarkupHandler.scala | 8 +- .../scala/xml/parsing/MarkupParser.scala | 14 ++-- .../test/scala-2.x/scala/xml/XMLTest2x.scala | 2 +- .../test/scala/scala/xml/NodeSeqTest.scala | 8 +- shared/src/test/scala/scala/xml/XMLTest.scala | 76 +++++++++---------- 31 files changed, 131 insertions(+), 146 deletions(-) diff --git a/build.sbt b/build.sbt index 734920dda..4814321e5 100644 --- a/build.sbt +++ b/build.sbt @@ -150,7 +150,7 @@ lazy val xml = crossProject(JSPlatform, JVMPlatform, NativePlatform) retrieveDir, log ) - .fold(w => throw w.resolveException, identity(_)) + .fold(w => throw w.resolveException, identity) val jarPath = cp .find(_.toString.contains("junit-plugin")) .getOrElse(throw new Exception("Can't find Scala Native junit-plugin jar")) diff --git a/jvm/src/test/scala/scala/xml/XMLTest.scala b/jvm/src/test/scala/scala/xml/XMLTest.scala index a8f4dd826..196085f4d 100644 --- a/jvm/src/test/scala/scala/xml/XMLTest.scala +++ b/jvm/src/test/scala/scala/xml/XMLTest.scala @@ -33,7 +33,7 @@ class XMLTestJVM { def equality(): Unit = { val c: Node = new Node { override def label: String = "hello" - override def hashCode(): Int = + override def hashCode: Int = Utility.hashCode(prefix, label, this.attributes.hashCode(), scope.hashCode(), child) override def child: Seq[Node] = Elem(null, "world", e, sc) //def attributes = e @@ -54,7 +54,6 @@ class XMLTestJVM { Elem(null, "author", e, sc, Text("Peter Buneman")), Elem(null, "author", e, sc, Text("Dan Suciu")), Elem(null, "title", e, sc, Text("Data on ze web"))), x2p) - } @UnitTest @@ -640,7 +639,7 @@ class XMLTestJVM { parserFactory.setNamespaceAware(namespaceAware) parserFactory.setXIncludeAware(namespaceAware) - assertEquals(xml, XML.withSAXParser(parserFactory.newSAXParser).loadString(xml).toString()) + assertEquals(xml, XML.withSAXParser(parserFactory.newSAXParser).loadString(xml).toString) } @UnitTest diff --git a/shared/src/main/scala/scala/xml/Attribute.scala b/shared/src/main/scala/scala/xml/Attribute.scala index 8e41dc1cc..26d079c11 100644 --- a/shared/src/main/scala/scala/xml/Attribute.scala +++ b/shared/src/main/scala/scala/xml/Attribute.scala @@ -65,10 +65,10 @@ trait Attribute extends MetaData { override def remove(key: String): MetaData = if (!isPrefixed && this.key == key) next - else copy(next remove key) + else copy(next.remove(key)) override def remove(namespace: String, scope: NamespaceBinding, key: String): MetaData = - if (this.key == key && (scope getURI pre) == namespace) next + if (this.key == key && scope.getURI(pre) == namespace) next else copy(next.remove(namespace, scope, key)) override def isPrefixed: Boolean = pre != null @@ -76,8 +76,8 @@ trait Attribute extends MetaData { override def getNamespace(owner: Node): String override def wellformed(scope: NamespaceBinding): Boolean = { - val arg: String = if (isPrefixed) scope getURI pre else null - (next(arg, scope, key) == null) && (next wellformed scope) + val arg: String = if (isPrefixed) scope.getURI(pre) else null + (next(arg, scope, key) == null) && next.wellformed(scope) } /** Returns an iterator on attributes */ @@ -98,9 +98,9 @@ trait Attribute extends MetaData { if (value == null) return if (isPrefixed) - sb append pre append ':' + sb.append(pre).append(':') - sb append key append '=' + sb.append(key).append('=') val sb2: StringBuilder = new StringBuilder() Utility.sequenceToXML(value, TopScope, sb2, stripComments = true) Utility.appendQuoted(sb2.toString, sb) diff --git a/shared/src/main/scala/scala/xml/Equality.scala b/shared/src/main/scala/scala/xml/Equality.scala index 11877f47e..8c406c9d3 100644 --- a/shared/src/main/scala/scala/xml/Equality.scala +++ b/shared/src/main/scala/scala/xml/Equality.scala @@ -85,7 +85,7 @@ trait Equality extends scala.Equals { * which heads off a lot of inconsistency up front. */ override def canEqual(other: Any): Boolean = other match { - case x: Equality => true + case _: Equality => true case _ => false } @@ -96,7 +96,7 @@ trait Equality extends scala.Equals { * are final since clearly individual classes cannot be trusted * to maintain a semblance of order. */ - override def hashCode(): Int = basisForHashCode.## + override def hashCode: Int = basisForHashCode.## override def equals(other: Any): Boolean = doComparison(other, blithe = false) final def xml_==(other: Any): Boolean = doComparison(other, blithe = true) final def xml_!=(other: Any): Boolean = !xml_==(other) diff --git a/shared/src/main/scala/scala/xml/Group.scala b/shared/src/main/scala/scala/xml/Group.scala index 471979d4a..586a5981b 100644 --- a/shared/src/main/scala/scala/xml/Group.scala +++ b/shared/src/main/scala/scala/xml/Group.scala @@ -24,7 +24,7 @@ final case class Group(nodes: Seq[Node]) extends Node { override def theSeq: Seq[Node] = nodes override def canEqual(other: Any): Boolean = other match { - case x: Group => true + case _: Group => true case _ => false } diff --git a/shared/src/main/scala/scala/xml/MetaData.scala b/shared/src/main/scala/scala/xml/MetaData.scala index 4607ea6c7..45ea6eaf1 100644 --- a/shared/src/main/scala/scala/xml/MetaData.scala +++ b/shared/src/main/scala/scala/xml/MetaData.scala @@ -75,7 +75,7 @@ object MetaData { * attributes. Every instance of this class is either * - an instance of `UnprefixedAttribute key,value` or * - an instance of `PrefixedAttribute namespace_prefix,key,value` or - * - `Null, the empty attribute list. + * - `Null`, the empty attribute list. * * Namespace URIs are obtained by using the namespace scope of the element * owning this attribute (see `getNamespace`). @@ -204,17 +204,17 @@ abstract class MetaData * @param uri namespace of key * @param scope a namespace scp (usually of the element owning this attribute list) * @param key to be looked fore - * @return value as Some[Seq[Node]] if key is found, None otherwise + * @return value as `Some[Seq[Node]]` if key is found, None otherwise */ final def get(uri: String, scope: NamespaceBinding, key: String): Option[Seq[Node]] = Option(apply(uri, scope, key)) - protected def toString1(): String = sbToString(toString1) + protected def toString1: String = sbToString(toString1) // appends string representations of single attribute to StringBuilder protected def toString1(sb: StringBuilder): Unit - override def toString(): String = sbToString(buildString) + override def toString: String = sbToString(buildString) def buildString(sb: StringBuilder): StringBuilder = { sb append ' ' diff --git a/shared/src/main/scala/scala/xml/Node.scala b/shared/src/main/scala/scala/xml/Node.scala index 1b2716f5a..491f4ee92 100755 --- a/shared/src/main/scala/scala/xml/Node.scala +++ b/shared/src/main/scala/scala/xml/Node.scala @@ -140,8 +140,8 @@ abstract class Node extends NodeSeq { def descendant_or_self: List[Node] = this :: descendant override def canEqual(other: Any): Boolean = other match { - case x: Group => false - case x: Node => true + case _: Group => false + case _: Node => true case _ => false } @@ -178,7 +178,7 @@ abstract class Node extends NodeSeq { /** * Same as `toString('''false''')`. */ - override def toString(): String = buildString(stripComments = false) + override def toString: String = buildString(stripComments = false) /** * Appends qualified name of this node to `StringBuilder`. @@ -194,7 +194,7 @@ abstract class Node extends NodeSeq { /** * Returns a type symbol (e.g. DTD, XSD), default `'''null'''`. */ - def xmlType(): TypeSymbol = null + def xmlType: TypeSymbol = null /** * Returns a text representation of this node. Note that this is not equivalent to diff --git a/shared/src/main/scala/scala/xml/NodeSeq.scala b/shared/src/main/scala/scala/xml/NodeSeq.scala index 89d81372b..0691ae74b 100644 --- a/shared/src/main/scala/scala/xml/NodeSeq.scala +++ b/shared/src/main/scala/scala/xml/NodeSeq.scala @@ -102,7 +102,7 @@ abstract class NodeSeq extends AbstractSeq[Node] with immutable.Seq[Node] with S else if (that(1) == '{') { val i: Int = that indexOf '}' if (i == -1) fail - val (uri: String, key: String) = (that.substring(2, i), that.substring(i + 1, that.length())) + val (uri: String, key: String) = (that.substring(2, i), that.substring(i + 1, that.length)) if (uri == "" || key == "") fail else y.attribute(uri, key) } else y.attribute(that drop 1) @@ -128,7 +128,7 @@ abstract class NodeSeq extends AbstractSeq[Node] with immutable.Seq[Node] with S /** * Projection function, which returns elements of `this` sequence and of * all its subsequences, based on the string `that`. Use: - * - `this \\ "foo" to get a list of all elements that are labelled with `"foo"`, + * - `this \\ "foo"` to get a list of all elements that are labelled with "foo"`, * including `this`; * - `this \\ "_"` to get a list of all elements (wildcard), including `this`; * - `this \\ "@foo"` to get all unprefixed attributes `"foo"`; @@ -159,7 +159,7 @@ abstract class NodeSeq extends AbstractSeq[Node] with immutable.Seq[Node] with S */ def \@(attributeName: String): String = (this \ ("@" + attributeName)).text - override def toString(): String = theSeq.mkString + override def toString: String = theSeq.mkString def text: String = (this map (_.text)).mkString } diff --git a/shared/src/main/scala/scala/xml/Null.scala b/shared/src/main/scala/scala/xml/Null.scala index e7bf3627b..778da1a69 100644 --- a/shared/src/main/scala/scala/xml/Null.scala +++ b/shared/src/main/scala/scala/xml/Null.scala @@ -13,7 +13,6 @@ package scala package xml -import Utility.isNameStart import scala.collection.Iterator import scala.collection.Seq @@ -50,13 +49,13 @@ case object Null extends MetaData { override def apply(namespace: String, scope: NamespaceBinding, key: String) /* TODO type annotation */ = null override def apply(key: String) /* TODO type annotation */ = - if (isNameStart(key.head)) null + if (Utility.isNameStart(key.head)) null else throw new IllegalArgumentException("not a valid attribute name '" + key + "', so can never match !") override protected def toString1(sb: StringBuilder): Unit = () - override protected def toString1(): String = "" + override protected def toString1: String = "" - override def toString(): String = "" + override def toString: String = "" override def buildString(sb: StringBuilder): StringBuilder = sb diff --git a/shared/src/main/scala/scala/xml/PrettyPrinter.scala b/shared/src/main/scala/scala/xml/PrettyPrinter.scala index 261b05bf0..a02369d44 100755 --- a/shared/src/main/scala/scala/xml/PrettyPrinter.scala +++ b/shared/src/main/scala/scala/xml/PrettyPrinter.scala @@ -150,11 +150,11 @@ class PrettyPrinter(width: Int, step: Int, minimizeEmpty: Boolean) { protected def traverse(node: Node, pscope: NamespaceBinding, ind: Int): Unit = node match { - case Text(s) if s.trim() == "" => + case Text(s) if s.trim == "" => case _: Atom[_] | _: Comment | _: EntityRef | _: ProcInstr => - makeBox(ind, node.toString().trim()) - case g@Group(xs) => + makeBox(ind, node.toString.trim) + case Group(xs) => traverse(xs.iterator, pscope, ind) case _ => val test: String = { diff --git a/shared/src/main/scala/scala/xml/SpecialNode.scala b/shared/src/main/scala/scala/xml/SpecialNode.scala index e9a4d007f..0569bc4ed 100644 --- a/shared/src/main/scala/scala/xml/SpecialNode.scala +++ b/shared/src/main/scala/scala/xml/SpecialNode.scala @@ -24,7 +24,7 @@ abstract class SpecialNode extends Node { /** always empty */ final override def attributes: Null.type = Null - /** always Node.EmptyNamespace */ + /** always Node.EmptyNamespace - TODO not really: Node.EmptyNamespace is "", but this is null. */ final override def namespace: scala.Null = null /** always empty */ diff --git a/shared/src/main/scala/scala/xml/TopScope.scala b/shared/src/main/scala/scala/xml/TopScope.scala index 0fcc2287f..2dc77139e 100644 --- a/shared/src/main/scala/scala/xml/TopScope.scala +++ b/shared/src/main/scala/scala/xml/TopScope.scala @@ -28,7 +28,7 @@ object TopScope extends NamespaceBinding(null, null, null) { override def getPrefix(uri1: String): String = if (uri1 == namespace) xml else null - override def toString(): String = "" + override def toString: String = "" override def buildString(stop: NamespaceBinding): String = "" override def buildString(sb: StringBuilder, ignore: NamespaceBinding): Unit = () diff --git a/shared/src/main/scala/scala/xml/Utility.scala b/shared/src/main/scala/scala/xml/Utility.scala index c812e4b6b..28d389d3e 100755 --- a/shared/src/main/scala/scala/xml/Utility.scala +++ b/shared/src/main/scala/scala/xml/Utility.scala @@ -28,7 +28,7 @@ object Utility extends AnyRef with parsing.TokenTests { // [Martin] This looks dubious. We don't convert StringBuilders to // Strings anywhere else, why do it here? - implicit def implicitSbToString(sb: StringBuilder): String = sb.toString() + implicit def implicitSbToString(sb: StringBuilder): String = sb.toString // helper for the extremely oft-repeated sequence of creating a // StringBuilder, passing it around, and then grabbing its String. @@ -50,7 +50,7 @@ object Utility extends AnyRef with parsing.TokenTests { */ def trim(x: Node): Node = x match { case Elem(pre, lab, md, scp, child@_*) => - val children: Seq[Node] = combineAdjacentTextNodes(child) flatMap trimProper + val children: Seq[Node] = combineAdjacentTextNodes(child).flatMap(trimProper) Elem(pre, lab, md, scp, children.isEmpty, children: _*) } @@ -67,7 +67,7 @@ object Utility extends AnyRef with parsing.TokenTests { */ def trimProper(x: Node): Seq[Node] = x match { case Elem(pre, lab, md, scp, child@_*) => - val children: Seq[Node] = combineAdjacentTextNodes(child) flatMap trimProper + val children: Seq[Node] = combineAdjacentTextNodes(child).flatMap(trimProper) Elem(pre, lab, md, scp, children.isEmpty, children: _*) case Text(s) => new TextBuffer().append(s).toText @@ -173,7 +173,7 @@ object Utility extends AnyRef with parsing.TokenTests { // minimizeTags: Boolean = false): String = // { // toXMLsb(x, pscope, sb, stripComments, decodeEntities, preserveWhitespace, minimizeTags) - // sb.toString() + // sb.toString // } /** @@ -263,13 +263,16 @@ object Utility extends AnyRef with parsing.TokenTests { } else children foreach { serialize(_, pscope, sb, stripComments, decodeEntities, preserveWhitespace, minimizeTags) } } + def splitName(name: String): (Option[String], String) = { + val colon: Int = name.indexOf(':') + if (colon < 0) (None, name) + else (Some(name.take(colon)), name.drop(colon + 1)) + } + /** * Returns prefix of qualified name if any. */ - final def prefix(name: String): Option[String] = name.indexOf(':') match { - case -1 => None - case i => Some(name.substring(0, i)) - } + final def prefix(name: String): Option[String] = splitName(name)._1 /** * Returns a hashcode for the given constituents of a node @@ -357,12 +360,12 @@ object Utility extends AnyRef with parsing.TokenTests { rfb.append(c) c = it.next() } - val ref: String = rfb.toString() + val ref: String = rfb.toString rfb.clear() unescape(ref, sb) match { case null => if (sb.nonEmpty) { // flush buffer - nb += Text(sb.toString()) + nb += Text(sb.toString) sb.clear() } nb += EntityRef(ref) // add entityref @@ -372,7 +375,7 @@ object Utility extends AnyRef with parsing.TokenTests { } else sb append c } if (sb.nonEmpty) { // flush buffer - val x: Text = Text(sb.toString()) + val x: Text = Text(sb.toString) if (nb.isEmpty) return x else diff --git a/shared/src/main/scala/scala/xml/XML.scala b/shared/src/main/scala/scala/xml/XML.scala index 9838d1505..b5ea9133f 100755 --- a/shared/src/main/scala/scala/xml/XML.scala +++ b/shared/src/main/scala/scala/xml/XML.scala @@ -117,7 +117,7 @@ object XML extends XMLLoader[Elem] { final def write(w: java.io.Writer, node: Node, enc: String, xmlDecl: Boolean, doctype: dtd.DocType, minimizeTags: MinimizeMode.Value = MinimizeMode.Default): Unit = { /* TODO: optimize by giving writer parameter to toXML*/ if (xmlDecl) w.write("\n") - if (doctype ne null) w.write(doctype.toString() + "\n") + if (doctype ne null) w.write(doctype.toString + "\n") w.write(Utility.serialize(node, minimizeTags = minimizeTags).toString) } } diff --git a/shared/src/main/scala/scala/xml/dtd/Decl.scala b/shared/src/main/scala/scala/xml/dtd/Decl.scala index 0a1ded00e..08f4a8535 100644 --- a/shared/src/main/scala/scala/xml/dtd/Decl.scala +++ b/shared/src/main/scala/scala/xml/dtd/Decl.scala @@ -150,22 +150,22 @@ case class PEReference(ent: String) extends MarkupDecl { // default declarations for attributes sealed abstract class DefaultDecl { - override def toString(): String + def toString: String def buildString(sb: StringBuilder): StringBuilder } case object REQUIRED extends DefaultDecl { - override def toString(): String = "#REQUIRED" + override def toString: String = "#REQUIRED" override def buildString(sb: StringBuilder): StringBuilder = sb append "#REQUIRED" } case object IMPLIED extends DefaultDecl { - override def toString(): String = "#IMPLIED" + override def toString: String = "#IMPLIED" override def buildString(sb: StringBuilder): StringBuilder = sb append "#IMPLIED" } case class DEFAULT(fixed: Boolean, attValue: String) extends DefaultDecl { - override def toString(): String = sbToString(buildString) + override def toString: String = sbToString(buildString) override def buildString(sb: StringBuilder): StringBuilder = { if (fixed) sb append "#FIXED " Utility.appendEscapedQuoted(attValue, sb) diff --git a/shared/src/main/scala/scala/xml/dtd/DocType.scala b/shared/src/main/scala/scala/xml/dtd/DocType.scala index 6a6c6e9e7..efdfcf839 100644 --- a/shared/src/main/scala/scala/xml/dtd/DocType.scala +++ b/shared/src/main/scala/scala/xml/dtd/DocType.scala @@ -35,7 +35,7 @@ case class DocType(name: String, extID: ExternalID, intSubset: Seq[dtd.Decl]) { if (intSubset.isEmpty) "" else intSubset.mkString("[", "", "]") - """""".format(name, extID.toString(), intString) + """""".format(name, extID.toString, intString) } } diff --git a/shared/src/main/scala/scala/xml/dtd/ExternalID.scala b/shared/src/main/scala/scala/xml/dtd/ExternalID.scala index 2bd80c803..4446a570c 100644 --- a/shared/src/main/scala/scala/xml/dtd/ExternalID.scala +++ b/shared/src/main/scala/scala/xml/dtd/ExternalID.scala @@ -36,7 +36,7 @@ sealed abstract class ExternalID extends parsing.TokenTests { (if (systemId == null) "" else " " + quotedSystemLiteral) } def buildString(sb: StringBuilder): StringBuilder = - sb.append(this.toString()) + sb.append(this.toString) def systemId: String def publicId: String diff --git a/shared/src/main/scala/scala/xml/dtd/ValidationException.scala b/shared/src/main/scala/scala/xml/dtd/ValidationException.scala index 9b521c8ab..ce6f52bed 100644 --- a/shared/src/main/scala/scala/xml/dtd/ValidationException.scala +++ b/shared/src/main/scala/scala/xml/dtd/ValidationException.scala @@ -37,7 +37,7 @@ object MakeValidationException { val sb: StringBuilder = new StringBuilder("missing value for REQUIRED attribute") if (allKeys.size > 1) sb.append('s') allKeys foreach (k => sb append "'%s'".format(k)) - ValidationException(sb.toString()) + ValidationException(sb.toString) } def fromMissingAttribute(key: String, tpe: String): ValidationException = diff --git a/shared/src/main/scala/scala/xml/dtd/impl/BaseBerrySethi.scala b/shared/src/main/scala/scala/xml/dtd/impl/BaseBerrySethi.scala index 9d515938c..33d6e76d8 100644 --- a/shared/src/main/scala/scala/xml/dtd/impl/BaseBerrySethi.scala +++ b/shared/src/main/scala/scala/xml/dtd/impl/BaseBerrySethi.scala @@ -20,7 +20,7 @@ import scala.collection.Seq /** * This class turns a regular expression over `A` into a - * [[scala.util.automata.NondetWordAutom]] over `A` using the celebrated + * [[scala.xml.dtd.impl.NondetWordAutom]] over `A` using the celebrated * position automata construction (also called ''Berry-Sethi'' or ''Glushkov''). */ @deprecated("This class will be removed", "2.10.0") diff --git a/shared/src/main/scala/scala/xml/dtd/impl/DetWordAutom.scala b/shared/src/main/scala/scala/xml/dtd/impl/DetWordAutom.scala index 56df1f9f5..3b6b8663c 100644 --- a/shared/src/main/scala/scala/xml/dtd/impl/DetWordAutom.scala +++ b/shared/src/main/scala/scala/xml/dtd/impl/DetWordAutom.scala @@ -39,7 +39,7 @@ private[dtd] abstract class DetWordAutom[T <: AnyRef] { sb.append(nstates) sb.append(" finals=") val map: Map[Int, Int] = finals.zipWithIndex.map(_.swap).toMap - sb.append(map.toString()) + sb.append(map.toString) sb.append(" delta=\n") for (i <- 0 until nstates) { diff --git a/shared/src/main/scala/scala/xml/dtd/impl/WordBerrySethi.scala b/shared/src/main/scala/scala/xml/dtd/impl/WordBerrySethi.scala index 2e0f5cb5b..2692859af 100644 --- a/shared/src/main/scala/scala/xml/dtd/impl/WordBerrySethi.scala +++ b/shared/src/main/scala/scala/xml/dtd/impl/WordBerrySethi.scala @@ -17,7 +17,7 @@ import scala.collection.{immutable, mutable} import scala.collection.Seq /** - * This class turns a regular expression into a [[scala.util.automata.NondetWordAutom]] + * This class turns a regular expression into a [[scala.xml.dtd.impl.NondetWordAutom]] * celebrated position automata construction (also called ''Berry-Sethi'' or ''Glushkov''). * * @author Burak Emir diff --git a/shared/src/main/scala/scala/xml/factory/XMLLoader.scala b/shared/src/main/scala/scala/xml/factory/XMLLoader.scala index 8e7dd7455..ff722d6e5 100644 --- a/shared/src/main/scala/scala/xml/factory/XMLLoader.scala +++ b/shared/src/main/scala/scala/xml/factory/XMLLoader.scala @@ -30,7 +30,7 @@ trait XMLLoader[T <: Node] { private lazy val parserInstance: ThreadLocal[SAXParser] = new ThreadLocal[SAXParser] { override def initialValue: SAXParser = { - val parser: SAXParserFactory = SAXParserFactory.newInstance() + val parser: SAXParserFactory = SAXParserFactory.newInstance parser.setFeature("http://javax.xml.XMLConstants/feature/secure-processing", true) parser.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false) parser.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true) @@ -39,7 +39,7 @@ trait XMLLoader[T <: Node] { parser.setFeature("http://xml.org/sax/features/resolve-dtd-uris", false) parser.setXIncludeAware(false) parser.setNamespaceAware(false) - parser.newSAXParser() + parser.newSAXParser } } diff --git a/shared/src/main/scala/scala/xml/include/XIncludeException.scala b/shared/src/main/scala/scala/xml/include/XIncludeException.scala index ddc1419fc..4d2a809cf 100644 --- a/shared/src/main/scala/scala/xml/include/XIncludeException.scala +++ b/shared/src/main/scala/scala/xml/include/XIncludeException.scala @@ -57,5 +57,5 @@ class XIncludeException(message: String) extends Exception(message) { * @return Throwable the underlying exception which caused the * `XIncludeException` to be thrown */ - def getRootCause(): Throwable = this.rootCause + def getRootCause: Throwable = this.rootCause } diff --git a/shared/src/main/scala/scala/xml/include/sax/XIncludeFilter.scala b/shared/src/main/scala/scala/xml/include/sax/XIncludeFilter.scala index c7b22125b..3f0a382e7 100644 --- a/shared/src/main/scala/scala/xml/include/sax/XIncludeFilter.scala +++ b/shared/src/main/scala/scala/xml/include/sax/XIncludeFilter.scala @@ -94,7 +94,7 @@ class XIncludeFilter extends XMLFilterImpl { try { bases.push(new URL(base)) } catch { - case e: MalformedURLException => + case _: MalformedURLException => throw new UnsupportedOperationException("Unrecognized SYSTEM ID: " + base) } super.setDocumentLocator(locator) @@ -113,7 +113,7 @@ class XIncludeFilter extends XMLFilterImpl { * * @return boolean */ - def insideIncludeElement(): Boolean = level != 0 + def insideIncludeElement: Boolean = level != 0 override def startElement(uri: String, localName: String, qName: String, atts1: Attributes): Unit = { var atts: Attributes = atts1 @@ -222,9 +222,9 @@ class XIncludeFilter extends XMLFilterImpl { } // convenience method for error messages - private def getLocation(): String = { + private def getLocation: String = { var locationString: String = "" - val locator: Locator = locators.peek() + val locator: Locator = locators.peek var publicID: String = "" var systemID: String = "" var column: Int = -1 @@ -256,21 +256,21 @@ class XIncludeFilter extends XMLFilterImpl { */ private def includeTextDocument(url: String, encoding1: String): Unit = { var encoding: String = encoding1 - if (encoding == null || encoding.trim().equals("")) encoding = "UTF-8" + if (encoding == null || encoding.trim.equals("")) encoding = "UTF-8" var source: URL = null try { - val base: URL = bases.peek() + val base: URL = bases.peek source = new URL(base, url) } catch { case e: MalformedURLException => val ex: UnavailableResourceException = new UnavailableResourceException("Unresolvable URL " + url - + getLocation()) + + getLocation) ex.setRootCause(e) - throw new SAXException("Unresolvable URL " + url + getLocation(), ex) + throw new SAXException("Unresolvable URL " + url + getLocation, ex) } try { - val uc: URLConnection = source.openConnection() + val uc: URLConnection = source.openConnection val in: BufferedInputStream = new BufferedInputStream(uc.getInputStream) val encodingFromHeader: String = uc.getContentEncoding var contentType: String = uc.getContentType @@ -281,7 +281,7 @@ class XIncludeFilter extends XMLFilterImpl { // MIME types are case-insensitive // Java may be picking this up from file URL if (contentType != null) { - contentType = contentType.toLowerCase() + contentType = contentType.toLowerCase if (contentType.equals("text/xml") || contentType.equals("application/xml") || (contentType.startsWith("text/") && contentType.endsWith("+xml")) @@ -300,12 +300,11 @@ class XIncludeFilter extends XMLFilterImpl { } catch { case e: UnsupportedEncodingException => throw new SAXException("Unsupported encoding: " - + encoding + getLocation(), e) + + encoding + getLocation, e) case e: IOException => throw new SAXException("Document not found: " - + source.toExternalForm + getLocation(), e) + + source.toExternalForm + getLocation, e) } - } private var atRoot: Boolean = false @@ -322,19 +321,19 @@ class XIncludeFilter extends XMLFilterImpl { */ private def includeXMLDocument(url: String): Unit = { val source: URL = - try new URL(bases.peek(), url) + try new URL(bases.peek, url) catch { case e: MalformedURLException => - val ex: UnavailableResourceException = new UnavailableResourceException("Unresolvable URL " + url + getLocation()) + val ex: UnavailableResourceException = new UnavailableResourceException("Unresolvable URL " + url + getLocation) ex setRootCause e - throw new SAXException("Unresolvable URL " + url + getLocation(), ex) + throw new SAXException("Unresolvable URL " + url + getLocation, ex) } try { val parser: XMLReader = try XMLReaderFactory.createXMLReader() catch { - case e: SAXException => + case _: SAXException => try XMLReaderFactory.createXMLReader(XercesClassName) catch { case _: SAXException => return System.err.println("Could not find an XML parser") } } @@ -350,7 +349,7 @@ class XIncludeFilter extends XMLFilterImpl { if (bases contains source) throw new SAXException( "Circular XInclude Reference", - new CircularIncludeException("Circular XInclude Reference to " + source + getLocation()) + new CircularIncludeException("Circular XInclude Reference to " + source + getLocation) ) bases push source @@ -362,7 +361,7 @@ class XIncludeFilter extends XMLFilterImpl { bases.pop() } catch { case e: IOException => - throw new SAXException("Document not found: " + source.toExternalForm + getLocation(), e) + throw new SAXException("Document not found: " + source.toExternalForm + getLocation, e) } } } diff --git a/shared/src/main/scala/scala/xml/include/sax/XIncluder.scala b/shared/src/main/scala/scala/xml/include/sax/XIncluder.scala index 061d4933a..fd576e3a9 100644 --- a/shared/src/main/scala/scala/xml/include/sax/XIncluder.scala +++ b/shared/src/main/scala/scala/xml/include/sax/XIncluder.scala @@ -170,7 +170,7 @@ class XIncluder(outs: OutputStream, encoding: String) extends ContentHandler wit } override def comment(ch: Array[Char], start: Int, length: Int): Unit = { - if (!inDTD && !filter.insideIncludeElement()) { + if (!inDTD && !filter.insideIncludeElement) { try { out.write("", toString) + assertEquals("", .toString) @UnitTest def weirdElem(): Unit = - assertEquals("", toString) + assertEquals("", .toString) @UnitTest def escape(): Unit = @@ -265,12 +265,12 @@ Ours is the portal of hope, come as you are." Heathen, fire worshipper or idolatrous, come! Come even if you broke your penitence a hundred times, Ours is the portal of hope, come as you are." - Mevlana Celaleddin Rumi]]> toString) // this guy will escaped, and rightly so + Mevlana Celaleddin Rumi]]>.toString) // this guy will escaped, and rightly so @UnitTest def unparsed2(): Unit = { object myBreak extends Unparsed("
") - assertEquals("
", { myBreak } toString) // shows use of unparsed + assertEquals("
", { myBreak }.toString) // shows use of unparsed } @UnitTest @@ -297,7 +297,7 @@ Ours is the portal of hope, come as you are." assertEquals( """ abc - """, f("a,b,c") toString) + """, f("a,b,c").toString) // t-486 def wsdlTemplate1(serviceName: String): Node = @@ -315,11 +315,11 @@ Ours is the portal of hope, come as you are." @UnitTest def wsdl(): Unit = { assertEquals(""" - """, wsdlTemplate1("service1") toString) + """, wsdlTemplate1("service1").toString) assertEquals(""" - """, wsdlTemplate2("service2", "target2") toString) + """, wsdlTemplate2("service2", "target2").toString) assertEquals(""" - """, wsdlTemplate4("service4", () => "target4") toString) + """, wsdlTemplate4("service4", () => "target4").toString) } @UnitTest @@ -426,28 +426,28 @@ Ours is the portal of hope, come as you are." val bar: Attribute = Attribute(null, "bar", "2", foo) val ns: NamespaceBinding = NamespaceBinding(null, "uri", TopScope) - assertEquals(""" foo="1"""", foo toString) + assertEquals(""" foo="1"""", foo.toString) assertEquals(null, TopScope.getURI(foo.pre)) - assertEquals(""" bar="2"""", bar remove "foo" toString) - assertEquals(""" foo="1"""", bar remove "bar" toString) - assertEquals(""" bar="2"""", bar remove (null, TopScope, "foo") toString) - assertEquals(""" foo="1"""", bar remove (null, TopScope, "bar") toString) - assertEquals(""" bar="2" foo="1"""", bar toString) - assertEquals(""" bar="2" foo="1"""", bar remove (null, ns, "foo") toString) - assertEquals(""" bar="2" foo="1"""", bar remove (null, ns, "bar") toString) + assertEquals(""" bar="2"""", bar.remove("foo").toString) + assertEquals(""" foo="1"""", bar.remove("bar").toString) + assertEquals(""" bar="2"""", bar.remove(null, TopScope, "foo").toString) + assertEquals(""" foo="1"""", bar.remove(null, TopScope, "bar").toString) + assertEquals(""" bar="2" foo="1"""", bar.toString) + assertEquals(""" bar="2" foo="1"""", bar.remove(null, ns, "foo").toString) + assertEquals(""" bar="2" foo="1"""", bar.remove(null, ns, "bar").toString) } @UnitTest def t7074(): Unit = { - assertEquals("""
""", sort() toString) - assertEquals("""""", sort() toString) - assertEquals("""""", sort() toString) - assertEquals("""""", sort() toString) - assertEquals("""""", sort() toString) - assertEquals("""""", sort() toString) - assertEquals("""""", sort() toString) - assertEquals("""""", sort() toString) - assertEquals("""""", sort() toString) + assertEquals("""""", sort().toString) + assertEquals("""""", sort().toString) + assertEquals("""""", sort().toString) + assertEquals("""""", sort().toString) + assertEquals("""""", sort().toString) + assertEquals("""""", sort().toString) + assertEquals("""""", sort().toString) + assertEquals("""""", sort().toString) + assertEquals("""""", sort().toString) } @UnitTest @@ -468,20 +468,20 @@ Ours is the portal of hope, come as you are." assertEquals(xml1, xml2) assertEquals(xml1, xml3) - assertEquals("""""", noAttr toString) - assertEquals("""""", attrNull toString) - assertEquals("""""", attrNone toString) - assertEquals("""""", preAttrNull toString) - assertEquals("""""", preAttrNone toString) - assertEquals("""""", xml1 toString) - assertEquals("""""", xml2 toString) - assertEquals("""""", xml3 toString) + assertEquals("""""", noAttr.toString) + assertEquals("""""", attrNull.toString) + assertEquals("""""", attrNone.toString) + assertEquals("""""", preAttrNull.toString) + assertEquals("""""", preAttrNone.toString) + assertEquals("""""", xml1.toString) + assertEquals("""""", xml2.toString) + assertEquals("""""", xml3.toString) // Check if attribute order is retained - assertEquals("""""", toString) - assertEquals("""""", toString) - assertEquals("""""", toString) - assertEquals("""""", toString) + assertEquals("""""", .toString) + assertEquals("""""", .toString) + assertEquals("""""", .toString) + assertEquals("""""", .toString) } @UnitTest From ee3212d1c2d89c76b0b0859ab83578cd4c5237a6 Mon Sep 17 00:00:00 2001 From: Leonid Dubinsky Date: Tue, 28 Mar 2023 14:46:18 -0400 Subject: [PATCH 653/789] Add missing type annotations that do not break binary compatibility Some missing type annotations can be added without breaking binary compatibility; they are added in this pull request, letting #655 concentrate on adding type annotations that _do_ break binary compatibility (for Scala 3). Removed MiMa exclusions that are no longer needed. Removed Gitter link to a non-existing room. Added links to the compiler implementation of the `SymbolicXMLBuilder` for different versions of Scala. --- README.md | 9 +++++++-- build.sbt | 8 -------- .../scala-2.13-/scala/xml/ScalaVersionSpecific.scala | 8 ++++---- shared/src/main/scala/scala/xml/Null.scala | 2 +- 4 files changed, 12 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 10f310d2a..6cd3fe413 100644 --- a/README.md +++ b/README.md @@ -2,12 +2,17 @@ scala-xml [![latest release for 2.12](https://img.shields.io/maven-central/v/org.scala-lang.modules/scala-xml_2.12.svg?label=scala+2.12)](http://mvnrepository.com/artifact/org.scala-lang.modules/scala-xml_2.12) [![latest release for 2.13](https://img.shields.io/maven-central/v/org.scala-lang.modules/scala-xml_2.13.svg?label=scala+2.13)](http://mvnrepository.com/artifact/org.scala-lang.modules/scala-xml_2.13) [![latest release for 3.0](https://img.shields.io/maven-central/v/org.scala-lang.modules/scala-xml_3.svg?label=scala+3)](http://mvnrepository.com/artifact/org.scala-lang.modules/scala-xml_3) -[![Gitter](https://badges.gitter.im/Join+Chat.svg)](https://gitter.im/scala/scala-xml) ========= The standard Scala XML library. Please file XML issues here, not at https://github.com/scala/bug/issues or http://github.com/lampepfl/dotty/issues. -The decoupling of scala-xml from the Scala compiler and standard library is possible because the compiler desugars XML literals in Scala source code into a set of method calls. Alternative implementations of these calls are welcome! (This [implementation](https://github.com/scala/scala/blob/2.11.x/src/compiler/scala/tools/nsc/ast/parser/SymbolicXMLBuilder.scala) shows the calls needed.) +The decoupling of scala-xml from the Scala compiler and standard library is possible because the compiler desugars XML literals in Scala source code into a set of method calls. +Alternative implementations of these calls are welcome! +Compiler code that shows the calls needed: + [Scala 2.11](https://github.com/scala/scala/blob/2.11.x/src/compiler/scala/tools/nsc/ast/parser/SymbolicXMLBuilder.scala), + [Scala 2.12](https://github.com/scala/scala/blob/2.12.x/src/compiler/scala/tools/nsc/ast/parser/SymbolicXMLBuilder.scala), + [Scala 2.13](https://github.com/scala/scala/blob/2.13.x/src/compiler/scala/tools/nsc/ast/parser/SymbolicXMLBuilder.scala), + [Scala 3](https://github.com/lampepfl/dotty/blob/main/compiler/src/dotty/tools/dotc/parsing/xml/SymbolicXMLBuilder.scala). API documentation is available [here](https://javadoc.io/doc/org.scala-lang.modules/scala-xml_2.13/). diff --git a/build.sbt b/build.sbt index 4814321e5..257bc67f5 100644 --- a/build.sbt +++ b/build.sbt @@ -68,14 +68,6 @@ lazy val xml = crossProject(JSPlatform, JVMPlatform, NativePlatform) import com.typesafe.tools.mima.core._ import com.typesafe.tools.mima.core.ProblemFilters._ Seq( - // afaict this is just a JDK 8 vs 16 difference, producing a false positive when - // we compare classes built on JDK 16 (which we only do on CI, not at release time) - // to previous-version artifacts that were built on 8. see scala/scala-xml#501 - exclude[DirectMissingMethodProblem]("scala.xml.include.sax.XIncluder.declaration"), - - // necessitated by the switch from DefaultHandler to DefaultHandler2 in FactoryAdapter: - exclude[MissingTypesProblem]("scala.xml.parsing.FactoryAdapter"), // see #549 - // necessitated by the introduction of new abstract methods in FactoryAdapter: exclude[ReversedMissingMethodProblem]("scala.xml.parsing.FactoryAdapter.createComment"), // see #549 exclude[ReversedMissingMethodProblem]("scala.xml.parsing.FactoryAdapter.createPCData") // see #558 diff --git a/shared/src/main/scala-2.13-/scala/xml/ScalaVersionSpecific.scala b/shared/src/main/scala-2.13-/scala/xml/ScalaVersionSpecific.scala index a8256f0cd..35d6d0e26 100644 --- a/shared/src/main/scala-2.13-/scala/xml/ScalaVersionSpecific.scala +++ b/shared/src/main/scala-2.13-/scala/xml/ScalaVersionSpecific.scala @@ -12,21 +12,21 @@ package scala.xml -import scala.collection.SeqLike +import scala.collection.{SeqLike, mutable} import scala.collection.generic.CanBuildFrom private[xml] object ScalaVersionSpecific { import NodeSeq.Coll type CBF[-From, -A, +C] = CanBuildFrom[From, A, C] object NodeSeqCBF extends CanBuildFrom[Coll, Node, NodeSeq] { - override def apply(from: Coll) /* TODO type annotation */ = NodeSeq.newBuilder - override def apply() /* TODO type annotation */ = NodeSeq.newBuilder + override def apply(from: Coll): mutable.Builder[Node, NodeSeq] = NodeSeq.newBuilder + override def apply(): mutable.Builder[Node, NodeSeq] = NodeSeq.newBuilder } } private[xml] trait ScalaVersionSpecificNodeSeq extends SeqLike[Node, NodeSeq] { self: NodeSeq => /** Creates a list buffer as builder for this class */ - override protected[this] def newBuilder /* TODO type annotation */ = NodeSeq.newBuilder + override protected[this] def newBuilder: mutable.Builder[Node, NodeSeq] = NodeSeq.newBuilder } private[xml] trait ScalaVersionSpecificNodeBuffer { self: NodeBuffer => diff --git a/shared/src/main/scala/scala/xml/Null.scala b/shared/src/main/scala/scala/xml/Null.scala index 778da1a69..7e057f4f9 100644 --- a/shared/src/main/scala/scala/xml/Null.scala +++ b/shared/src/main/scala/scala/xml/Null.scala @@ -24,7 +24,7 @@ import scala.collection.Seq * @author Burak Emir */ case object Null extends MetaData { - override def iterator /* TODO type annotation */ = Iterator.empty + override def iterator: Iterator[Nothing] = Iterator.empty override def size: Int = 0 override def append(m: MetaData, scope: NamespaceBinding = TopScope): MetaData = m override def filter(f: MetaData => Boolean): MetaData = this From 7b579169560d3b509f1fe5ee60696efe9f4e7728 Mon Sep 17 00:00:00 2001 From: Leonid Dubinsky Date: Sun, 2 Apr 2023 17:37:01 -0400 Subject: [PATCH 654/789] Demonstrate XInclude work - and fail --- build.sbt | 1 + .../resources/scala/xml/archive/books.xml | 3 + .../scala/xml/archive/books/book/author.xml | 3 + .../archive/books/book/author/volume/1.xml | 1 + jvm/src/test/resources/scala/xml/includee.xml | 3 + jvm/src/test/resources/scala/xml/includer.xml | 3 + jvm/src/test/resources/scala/xml/site.xml | 3 + jvm/src/test/scala/scala/xml/XMLTest.scala | 74 ++++++++++++++++++- 8 files changed, 88 insertions(+), 3 deletions(-) create mode 100644 jvm/src/test/resources/scala/xml/archive/books.xml create mode 100644 jvm/src/test/resources/scala/xml/archive/books/book/author.xml create mode 100644 jvm/src/test/resources/scala/xml/archive/books/book/author/volume/1.xml create mode 100644 jvm/src/test/resources/scala/xml/includee.xml create mode 100644 jvm/src/test/resources/scala/xml/includer.xml create mode 100644 jvm/src/test/resources/scala/xml/site.xml diff --git a/build.sbt b/build.sbt index 257bc67f5..3a0d6b680 100644 --- a/build.sbt +++ b/build.sbt @@ -113,6 +113,7 @@ lazy val xml = crossProject(JSPlatform, JVMPlatform, NativePlatform) libraryDependencies += "junit" % "junit" % "4.13.2" % Test, libraryDependencies += "com.github.sbt" % "junit-interface" % "0.13.3" % Test, libraryDependencies += "org.apache.commons" % "commons-lang3" % "3.12.0" % Test, + libraryDependencies += "xerces" % "xercesImpl" % "2.12.2" % Test, libraryDependencies ++= (CrossVersion.partialVersion(scalaVersion.value) match { case Some((3, _)) => Seq() diff --git a/jvm/src/test/resources/scala/xml/archive/books.xml b/jvm/src/test/resources/scala/xml/archive/books.xml new file mode 100644 index 000000000..00a491113 --- /dev/null +++ b/jvm/src/test/resources/scala/xml/archive/books.xml @@ -0,0 +1,3 @@ + + + diff --git a/jvm/src/test/resources/scala/xml/archive/books/book/author.xml b/jvm/src/test/resources/scala/xml/archive/books/book/author.xml new file mode 100644 index 000000000..3f2d2a9cd --- /dev/null +++ b/jvm/src/test/resources/scala/xml/archive/books/book/author.xml @@ -0,0 +1,3 @@ + + + diff --git a/jvm/src/test/resources/scala/xml/archive/books/book/author/volume/1.xml b/jvm/src/test/resources/scala/xml/archive/books/book/author/volume/1.xml new file mode 100644 index 000000000..7577b32c7 --- /dev/null +++ b/jvm/src/test/resources/scala/xml/archive/books/book/author/volume/1.xml @@ -0,0 +1 @@ + diff --git a/jvm/src/test/resources/scala/xml/includee.xml b/jvm/src/test/resources/scala/xml/includee.xml new file mode 100644 index 000000000..151eda262 --- /dev/null +++ b/jvm/src/test/resources/scala/xml/includee.xml @@ -0,0 +1,3 @@ + + Blah! + diff --git a/jvm/src/test/resources/scala/xml/includer.xml b/jvm/src/test/resources/scala/xml/includer.xml new file mode 100644 index 000000000..521954785 --- /dev/null +++ b/jvm/src/test/resources/scala/xml/includer.xml @@ -0,0 +1,3 @@ + + + diff --git a/jvm/src/test/resources/scala/xml/site.xml b/jvm/src/test/resources/scala/xml/site.xml new file mode 100644 index 000000000..9c77a297b --- /dev/null +++ b/jvm/src/test/resources/scala/xml/site.xml @@ -0,0 +1,3 @@ + + + diff --git a/jvm/src/test/scala/scala/xml/XMLTest.scala b/jvm/src/test/scala/scala/xml/XMLTest.scala index 196085f4d..90e4a65cd 100644 --- a/jvm/src/test/scala/scala/xml/XMLTest.scala +++ b/jvm/src/test/scala/scala/xml/XMLTest.scala @@ -510,8 +510,15 @@ class XMLTestJVM { } } + // With both internal and external Xerces now on the classpath, we explicitly disambiguate which one we want: + def xercesInternal: javax.xml.parsers.SAXParserFactory = + javax.xml.parsers.SAXParserFactory.newInstance("com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl", null) + + def xercesExternal: javax.xml.parsers.SAXParserFactory = + javax.xml.parsers.SAXParserFactory.newInstance("org.apache.xerces.jaxp.SAXParserFactoryImpl", null) + /** Default SAXParserFactory */ - val defaultParserFactory: javax.xml.parsers.SAXParserFactory = javax.xml.parsers.SAXParserFactory.newInstance + val defaultParserFactory: javax.xml.parsers.SAXParserFactory = xercesInternal @throws(classOf[org.xml.sax.SAXNotRecognizedException]) def issue17UnrecognizedFeature(): Unit = { @@ -629,7 +636,7 @@ class XMLTestJVM { // using namespace-aware parser, this works with FactoryAdapter enhanced to handle startPrefixMapping() events; // see https://github.com/scala/scala-xml/issues/506 def roundtrip(namespaceAware: Boolean, xml: String): Unit = { - val parserFactory: javax.xml.parsers.SAXParserFactory = javax.xml.parsers.SAXParserFactory.newInstance() + val parserFactory: javax.xml.parsers.SAXParserFactory = xercesInternal parserFactory.setFeature("http://javax.xml.XMLConstants/feature/secure-processing", true) parserFactory.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false) parserFactory.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true) @@ -656,7 +663,7 @@ class XMLTestJVM { @UnitTest def useXMLReaderWithXMLFilter(): Unit = { - val parent: org.xml.sax.XMLReader = javax.xml.parsers.SAXParserFactory.newInstance.newSAXParser.getXMLReader + val parent: org.xml.sax.XMLReader = xercesInternal.newSAXParser.getXMLReader val filter: org.xml.sax.XMLFilter = new org.xml.sax.helpers.XMLFilterImpl(parent) { override def characters(ch: Array[Char], start: Int, length: Int): Unit = { for (i <- 0 until length) if (ch(start+i) == 'a') ch(start+i) = 'b' @@ -682,6 +689,67 @@ class XMLTestJVM { assertTrue(gotAnError) } + // Now that we can use XML parser configured to be namespace-aware, + // we can also configure it to be XInclude-aware and process XML Includes: + def check( + parserFactory: javax.xml.parsers.SAXParserFactory, + resourceName: String, + expected: String + ): Unit = { + parserFactory.setNamespaceAware(true) + parserFactory.setXIncludeAware(true) + val actual: String = XML + .withSAXParser(parserFactory.newSAXParser) + .load(getClass.getResource(resourceName).toString) + .toString + + assertEquals(expected, actual) + } + + // Here we demonstrate that XInclude works with both the external and the built-in Xerces: + + val includerExpected: String = + s""" + | + | Blah! + | + |""".stripMargin + + @UnitTest def xIncludeWithExternalXerces(): Unit = check(xercesExternal, "includer.xml", includerExpected) + @UnitTest def xIncludeWithInternalXerces(): Unit = check(xercesInternal, "includer.xml", includerExpected) + + // And here we demonstrate that both external and built-in Xerces report incorrect `xml:base` + // when the XML file included contains its own include, and included files are not in the same directory: + // `xml:base` on the `` element is incorrect + // books/book/author/volume/1.xml instead of the correct + // archive/books/book/author/volume/1.xml! + val siteUnfortunatelyExpected: String = + s""" + | + | + | + | + | + |""".stripMargin + + // Turns out, this is a known Xerces bug https://issues.apache.org/jira/browse/XERCESJ-1102: + // - the bug was reported in October 2005 - more then seventeen years ago; + // - a patch fixing it (that I have not verified personally) was submitted many years ago; + // - the bug is still not fixed in the 2023 release of Xerces; + // - the bug was discussed by the Saxon users in https://saxonica.plan.io/issues/4664, + // and is allegedly fixed in SaxonC 11.1 - although how can this be with Saxon not shipping its own Xerces is not clear. + // + // In my own application, I had to "fix up" incorrect values produced by Xerces, taking into account + // specific directory layout being used. I can only speculate what others do, but none of the alternatives sound great: + // - avoid using nested includes altogether or flatten the directory hierarchy to appease the bug; + // - use privately patched version of Xerces; + // - use Saxon DOM parsing instead of Xerces' SAX. + // + // I find it utterly incomprehensible that foundational library shipped with JDK and used everywhere + // has a bug in its core functionality for years and it never gets fixed, but sadly, it is the state of affairs: + @UnitTest def xIncludeFailWithExternalXerces(): Unit = check(xercesExternal, "site.xml", siteUnfortunatelyExpected) + @UnitTest def xIncludeFailWithInternalXerces(): Unit = check(xercesInternal, "site.xml", siteUnfortunatelyExpected) + @UnitTest def nodeSeqNs(): Unit = { val x: NodeBuffer = { From bbe920421d3cacbce99ddc6ad69572fab685e954 Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Fri, 7 Apr 2023 17:04:22 +0000 Subject: [PATCH 655/789] Update sbt-scala-native-crossproject, ... to 1.3.0 --- project/plugins.sbt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/project/plugins.sbt b/project/plugins.sbt index 9fc720ad8..a7627ee90 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,6 +1,6 @@ addSbtPlugin("org.scala-lang.modules" % "sbt-scala-module" % "3.0.1") -addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.2.0") -addSbtPlugin("org.portable-scala" % "sbt-scala-native-crossproject" % "1.2.0") +addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.3.0") +addSbtPlugin("org.portable-scala" % "sbt-scala-native-crossproject" % "1.3.0") addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.13.0") addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.4.12") addSbtPlugin("de.heikoseeberger" % "sbt-header" % "5.9.0") From 4384d5ee2455c89c0348ead593f10f6b517bc3f3 Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Tue, 11 Apr 2023 18:03:17 +0000 Subject: [PATCH 656/789] Update sbt-scalajs, scalajs-compiler, ... to 1.13.1 --- project/plugins.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/plugins.sbt b/project/plugins.sbt index a7627ee90..45d7052fe 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,6 +1,6 @@ addSbtPlugin("org.scala-lang.modules" % "sbt-scala-module" % "3.0.1") addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.3.0") addSbtPlugin("org.portable-scala" % "sbt-scala-native-crossproject" % "1.3.0") -addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.13.0") +addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.13.1") addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.4.12") addSbtPlugin("de.heikoseeberger" % "sbt-header" % "5.9.0") From f7c7e00a6976dd3c61e9307758f353ae6a722885 Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Mon, 17 Apr 2023 20:20:07 +0000 Subject: [PATCH 657/789] Update sbt-scala-native-crossproject, ... to 1.3.1 --- project/plugins.sbt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/project/plugins.sbt b/project/plugins.sbt index 45d7052fe..790f03dd2 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,6 +1,6 @@ addSbtPlugin("org.scala-lang.modules" % "sbt-scala-module" % "3.0.1") -addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.3.0") -addSbtPlugin("org.portable-scala" % "sbt-scala-native-crossproject" % "1.3.0") +addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.3.1") +addSbtPlugin("org.portable-scala" % "sbt-scala-native-crossproject" % "1.3.1") addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.13.1") addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.4.12") addSbtPlugin("de.heikoseeberger" % "sbt-header" % "5.9.0") From aac142ad81aa09ae736174c6c6197b4bae45be8f Mon Sep 17 00:00:00 2001 From: Leonid Dubinsky Date: Sun, 2 Apr 2023 19:47:46 -0400 Subject: [PATCH 658/789] - when `systemId` is known (file, URL), wrap `InputSource` around it instead of opening `InputStream`: this allows `XInclude` to work (XML parser will open the stream itself). --- jvm/src/test/scala/scala/xml/XMLTest.scala | 26 +++-- shared/src/main/scala/scala/xml/XML.scala | 10 +- .../scala/scala/xml/factory/XMLLoader.scala | 94 +++++++++---------- 3 files changed, 69 insertions(+), 61 deletions(-) diff --git a/jvm/src/test/scala/scala/xml/XMLTest.scala b/jvm/src/test/scala/scala/xml/XMLTest.scala index 90e4a65cd..d5a606d4e 100644 --- a/jvm/src/test/scala/scala/xml/XMLTest.scala +++ b/jvm/src/test/scala/scala/xml/XMLTest.scala @@ -24,10 +24,10 @@ class XMLTestJVM { def Elem(prefix: String, label: String, attributes: MetaData, scope: NamespaceBinding, child: Node*): Elem = scala.xml.Elem.apply(prefix, label, attributes, scope, minimizeEmpty = true, child: _*) - lazy val parsedxml1: Elem = XML.load(new InputSource(new StringReader(""))) - lazy val parsedxml11: Elem = XML.load(new InputSource(new StringReader(""))) + lazy val parsedxml1: Elem = XML.loadString("") + lazy val parsedxml11: Elem = XML.loadString("") val xmlFile2: String = "Peter BunemanDan SuciuData on ze webJohn MitchellFoundations of Programming Languages" - lazy val parsedxml2: Elem = XML.load(new InputSource(new StringReader(xmlFile2))) + lazy val parsedxml2: Elem = XML.loadString(xmlFile2) @UnitTest def equality(): Unit = { @@ -46,9 +46,7 @@ class XMLTestJVM { assertTrue(Array(parsedxml1).toList sameElements List(parsedxml11)) val x2: String = "Peter BunemanDan SuciuData on ze web" - - val i: InputSource = new InputSource(new StringReader(x2)) - val x2p: Elem = XML.load(i) + val x2p: Elem = XML.loadString(x2) assertEquals(Elem(null, "book", e, sc, Elem(null, "author", e, sc, Text("Peter Buneman")), @@ -146,8 +144,7 @@ class XMLTestJVM { val xmlAttrValueNorm: String = "" { - val isrcA: InputSource = new InputSource(new StringReader(xmlAttrValueNorm)) - val parsedxmlA: Elem = XML.load(isrcA) + val parsedxmlA: Elem = XML.loadString(xmlAttrValueNorm) val c: Char = (parsedxmlA \ "@nom").text.charAt(0) assertTrue(c == '\u015e') } @@ -689,6 +686,17 @@ class XMLTestJVM { assertTrue(gotAnError) } + // Here we see that opening InputStream prematurely, as was done previously, breaks XInclude. + @UnitTest(expected = classOf[org.xml.sax.SAXParseException]) def xIncludeNeedsSystemId(): Unit = { + val parserFactory = xercesInternal + parserFactory.setNamespaceAware(true) + parserFactory.setXIncludeAware(true) + XML + .withSAXParser(parserFactory.newSAXParser) + .load(getClass.getResource("site.xml").openStream()) + .toString + } + // Now that we can use XML parser configured to be namespace-aware, // we can also configure it to be XInclude-aware and process XML Includes: def check( @@ -700,7 +708,7 @@ class XMLTestJVM { parserFactory.setXIncludeAware(true) val actual: String = XML .withSAXParser(parserFactory.newSAXParser) - .load(getClass.getResource(resourceName).toString) + .load(getClass.getResource(resourceName)) .toString assertEquals(expected, actual) diff --git a/shared/src/main/scala/scala/xml/XML.scala b/shared/src/main/scala/scala/xml/XML.scala index b5ea9133f..16a23aa08 100755 --- a/shared/src/main/scala/scala/xml/XML.scala +++ b/shared/src/main/scala/scala/xml/XML.scala @@ -19,13 +19,13 @@ import java.nio.channels.Channels import scala.util.control.Exception.ultimately object Source { - def fromFile(file: File): InputSource = new InputSource(new FileInputStream(file)) - def fromFile(fd: FileDescriptor): InputSource = new InputSource(new FileInputStream(fd)) - def fromFile(name: String): InputSource = new InputSource(new FileInputStream(name)) - + def fromFile(name: String): InputSource = fromFile(new File(name)) + def fromFile(file: File): InputSource = fromUrl(file.toURI.toURL) + def fromUrl(url: java.net.URL): InputSource = fromSysId(url.toString) + def fromSysId(sysID: String): InputSource = new InputSource(sysID) + def fromFile(fd: FileDescriptor): InputSource = fromInputStream(new FileInputStream(fd)) def fromInputStream(is: InputStream): InputSource = new InputSource(is) def fromReader(reader: Reader): InputSource = new InputSource(reader) - def fromSysId(sysID: String): InputSource = new InputSource(sysID) def fromString(string: String): InputSource = fromReader(new StringReader(string)) } diff --git a/shared/src/main/scala/scala/xml/factory/XMLLoader.scala b/shared/src/main/scala/scala/xml/factory/XMLLoader.scala index ff722d6e5..acaf63536 100644 --- a/shared/src/main/scala/scala/xml/factory/XMLLoader.scala +++ b/shared/src/main/scala/scala/xml/factory/XMLLoader.scala @@ -14,7 +14,7 @@ package scala package xml package factory -import org.xml.sax.{SAXNotRecognizedException, XMLReader} +import org.xml.sax.{SAXNotRecognizedException, SAXNotSupportedException, XMLReader} import javax.xml.parsers.SAXParserFactory import parsing.{FactoryAdapter, NoBindingFactoryAdapter} import java.io.{File, FileDescriptor, InputStream, Reader} @@ -22,24 +22,28 @@ import java.net.URL /** * Presents collection of XML loading methods which use the parser - * created by "def parser". + * created by "def parser" or the reader created by "def reader". */ trait XMLLoader[T <: Node] { import scala.xml.Source._ def adapter: FactoryAdapter = new NoBindingFactoryAdapter() + private def setSafeDefaults(parserFactory: SAXParserFactory): Unit = { + parserFactory.setFeature("http://javax.xml.XMLConstants/feature/secure-processing", true) + parserFactory.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false) + parserFactory.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true) + parserFactory.setFeature("http://xml.org/sax/features/external-parameter-entities", false) + parserFactory.setFeature("http://xml.org/sax/features/external-general-entities", false) + parserFactory.setFeature("http://xml.org/sax/features/resolve-dtd-uris", false) + parserFactory.setXIncludeAware(false) + parserFactory.setNamespaceAware(false) + } + private lazy val parserInstance: ThreadLocal[SAXParser] = new ThreadLocal[SAXParser] { override def initialValue: SAXParser = { - val parser: SAXParserFactory = SAXParserFactory.newInstance - parser.setFeature("http://javax.xml.XMLConstants/feature/secure-processing", true) - parser.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false) - parser.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true) - parser.setFeature("http://xml.org/sax/features/external-parameter-entities", false) - parser.setFeature("http://xml.org/sax/features/external-general-entities", false) - parser.setFeature("http://xml.org/sax/features/resolve-dtd-uris", false) - parser.setXIncludeAware(false) - parser.setNamespaceAware(false) - parser.newSAXParser + val parserFactory: SAXParserFactory = SAXParserFactory.newInstance + setSafeDefaults(parserFactory) + parserFactory.newSAXParser } } @@ -51,72 +55,68 @@ trait XMLLoader[T <: Node] { /** * Loads XML from the given InputSource, using the supplied parser. - * The methods available in scala.xml.XML use the XML parser in the JDK. + * The methods available in scala.xml.XML use the XML parser in the JDK + * (unless another parser is present on the classpath). */ - def loadXML(source: InputSource, parser: SAXParser): T = loadXML(source, parser.getXMLReader) + def loadXML(inputSource: InputSource, parser: SAXParser): T = loadXML(inputSource, parser.getXMLReader) - def loadXMLNodes(source: InputSource, parser: SAXParser): Seq[Node] = loadXMLNodes(source, parser.getXMLReader) + def loadXMLNodes(inputSource: InputSource, parser: SAXParser): Seq[Node] = loadXMLNodes(inputSource, parser.getXMLReader) - private def loadXML(source: InputSource, reader: XMLReader): T = { - val result: FactoryAdapter = parse(source, reader) + private def loadXML(inputSource: InputSource, reader: XMLReader): T = { + val result: FactoryAdapter = parse(inputSource, reader) result.rootElem.asInstanceOf[T] } - - private def loadXMLNodes(source: InputSource, reader: XMLReader): Seq[Node] = { - val result: FactoryAdapter = parse(source, reader) + + private def loadXMLNodes(inputSource: InputSource, reader: XMLReader): Seq[Node] = { + val result: FactoryAdapter = parse(inputSource, reader) result.prolog ++ (result.rootElem :: result.epilogue) } - private def parse(source: InputSource, reader: XMLReader): FactoryAdapter = { - if (source == null) throw new IllegalArgumentException("InputSource cannot be null") + private def parse(inputSource: InputSource, xmlReader: XMLReader): FactoryAdapter = { + if (inputSource == null) throw new IllegalArgumentException("InputSource cannot be null") val result: FactoryAdapter = adapter - reader.setContentHandler(result) - reader.setDTDHandler(result) + xmlReader.setContentHandler(result) + xmlReader.setDTDHandler(result) /* Do not overwrite pre-configured EntityResolver. */ - if (reader.getEntityResolver == null) reader.setEntityResolver(result) + if (xmlReader.getEntityResolver == null) xmlReader.setEntityResolver(result) /* Do not overwrite pre-configured ErrorHandler. */ - if (reader.getErrorHandler == null) reader.setErrorHandler(result) + if (xmlReader.getErrorHandler == null) xmlReader.setErrorHandler(result) try { - reader.setProperty("http://xml.org/sax/properties/lexical-handler", result) + xmlReader.setProperty("http://xml.org/sax/properties/lexical-handler", result) } catch { case _: SAXNotRecognizedException => + case _: SAXNotSupportedException => } result.scopeStack = TopScope :: result.scopeStack - reader.parse(source) + xmlReader.parse(inputSource) result.scopeStack = result.scopeStack.tail result } - /** loads XML from given InputSource. */ - def load(source: InputSource): T = loadXML(source, reader) - - /** Loads XML from the given file, file descriptor, or filename. */ + /** Loads XML. */ + def load(inputSource: InputSource): T = loadXML(inputSource, reader) + def loadFile(fileName: String): T = load(fromFile(fileName)) def loadFile(file: File): T = load(fromFile(file)) - def loadFile(fd: FileDescriptor): T = load(fromFile(fd)) - def loadFile(name: String): T = load(fromFile(name)) - - /** loads XML from given InputStream, Reader, sysID, or URL. */ - def load(is: InputStream): T = load(fromInputStream(is)) + def load(url: URL): T = load(fromUrl(url)) + def load(sysId: String): T = load(fromSysId(sysId)) + def loadFile(fileDescriptor: FileDescriptor): T = load(fromFile(fileDescriptor)) + def load(inputStream: InputStream): T = load(fromInputStream(inputStream)) def load(reader: Reader): T = load(fromReader(reader)) - def load(sysID: String): T = load(fromSysId(sysID)) - def load(url: URL): T = load(fromInputStream(url.openStream())) - - /** Loads XML from the given String. */ def loadString(string: String): T = load(fromString(string)) /** Load XML nodes, including comments and processing instructions that precede and follow the root element. */ - def loadNodes(source: InputSource): Seq[Node] = loadXMLNodes(source, reader) + def loadNodes(inputSource: InputSource): Seq[Node] = loadXMLNodes(inputSource, reader) + def loadFileNodes(fileName: String): Seq[Node] = loadNodes(fromFile(fileName)) def loadFileNodes(file: File): Seq[Node] = loadNodes(fromFile(file)) - def loadFileNodes(fd: FileDescriptor): Seq[Node] = loadNodes(fromFile(fd)) - def loadFileNodes(name: String): Seq[Node] = loadNodes(fromFile(name)) - def loadNodes(is: InputStream): Seq[Node] = loadNodes(fromInputStream(is)) + def loadNodes(url: URL): Seq[Node] = loadNodes(fromUrl(url)) + def loadNodes(sysId: String): Seq[Node] = loadNodes(fromSysId(sysId)) + def loadFileNodes(fileDescriptor: FileDescriptor): Seq[Node] = loadNodes(fromFile(fileDescriptor)) + def loadNodes(inputStream: InputStream): Seq[Node] = loadNodes(fromInputStream(inputStream)) def loadNodes(reader: Reader): Seq[Node] = loadNodes(fromReader(reader)) - def loadNodes(sysID: String): Seq[Node] = loadNodes(fromSysId(sysID)) - def loadNodes(url: URL): Seq[Node] = loadNodes(fromInputStream(url.openStream())) def loadStringNodes(string: String): Seq[Node] = loadNodes(fromString(string)) } From 72b263e3ebbfb03fdfddcadd60f07bdf009d734a Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Sun, 28 May 2023 03:00:53 +0000 Subject: [PATCH 659/789] Update sbt to 1.8.3 --- project/build.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/build.properties b/project/build.properties index 46e43a97e..72413de15 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version=1.8.2 +sbt.version=1.8.3 From f7e430e6c9bea4b09c6beee1e4e22b2f704d7bfd Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Sat, 3 Jun 2023 03:34:48 +0000 Subject: [PATCH 660/789] Update scala3-library, ... to 3.3.0 --- .circleci/config.yml | 10 +++++----- build.sbt | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 007db1a72..5eb9f1704 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -102,7 +102,7 @@ workflows: - scala_job: name: 3.1.0 java_version: jdk8 - scala_version: 3.2.2 + scala_version: 3.3.0 - scala_job: name: jdk11_2.12 java_version: jdk11 @@ -114,7 +114,7 @@ workflows: - scala_job: name: jdk11_3.1 java_version: jdk11 - scala_version: 3.2.2 + scala_version: 3.3.0 - scala_job: name: jdk17_2.12 java_version: jdk17 @@ -126,7 +126,7 @@ workflows: - scala_job: name: jdk17_3.1 java_version: jdk17 - scala_version: 3.2.2 + scala_version: 3.3.0 - scalajs_job: name: sjs1.0_2.12 scala_version: 2.12.17 @@ -135,7 +135,7 @@ workflows: scala_version: 2.13.10 - scalajs_job: name: sjs1.0_3.1 - scala_version: 3.2.2 + scala_version: 3.3.0 - scalanative_job: name: native0.4_2.12 scala_version: 2.12.17 @@ -144,4 +144,4 @@ workflows: scala_version: 2.13.10 - scalanative_job: name: native0.4_3 - scala_version: 3.2.2 + scala_version: 3.3.0 diff --git a/build.sbt b/build.sbt index 3a0d6b680..91cb694c1 100644 --- a/build.sbt +++ b/build.sbt @@ -36,7 +36,7 @@ lazy val xml = crossProject(JSPlatform, JVMPlatform, NativePlatform) .settings( name := "scala-xml", scalaModuleAutomaticModuleName := Some("scala.xml"), - crossScalaVersions := Seq("2.13.10", "2.12.17", "3.2.2"), + crossScalaVersions := Seq("2.13.10", "2.12.17", "3.3.0"), scalaVersion := "2.12.17", scalacOptions ++= (CrossVersion.partialVersion(scalaVersion.value) match { From 7fffc7504018e301cdcc9609106d30caa1bf9d0f Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Sat, 3 Jun 2023 03:34:51 +0000 Subject: [PATCH 661/789] Update sbt to 1.9.0 --- project/build.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/build.properties b/project/build.properties index 72413de15..40b3b8e7b 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version=1.8.3 +sbt.version=1.9.0 From a0879f5b65984554dcc8826277cbf3664407f10e Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Tue, 6 Jun 2023 22:26:18 +0000 Subject: [PATCH 662/789] Update junit-runtime, nscplugin, ... to 0.4.14 --- project/plugins.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/plugins.sbt b/project/plugins.sbt index 790f03dd2..537a0b5aa 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -2,5 +2,5 @@ addSbtPlugin("org.scala-lang.modules" % "sbt-scala-module" % "3.0.1") addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.3.1") addSbtPlugin("org.portable-scala" % "sbt-scala-native-crossproject" % "1.3.1") addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.13.1") -addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.4.12") +addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.4.14") addSbtPlugin("de.heikoseeberger" % "sbt-header" % "5.9.0") From 3ab4724d823fdf9ef5bea67840bec6e6c2fd65fe Mon Sep 17 00:00:00 2001 From: Leonid Dubinsky Date: Sun, 21 May 2023 21:05:49 -0400 Subject: [PATCH 663/789] - moved `private def parse()` from `XMLLoader` to `FactoryAdapter`; - `FactoryAdapter.parse` returns `Document`; - added yet another flavor of the `XMLLoader.load*` methods returning `Document`: `load*Document`; - expressed all the other `load` methods in terms of the `load*Document`; --- jvm/src/test/scala/scala/xml/XMLTest.scala | 8 +- shared/src/main/scala/scala/xml/XML.scala | 39 ++- .../scala/scala/xml/factory/XMLLoader.scala | 107 +++---- .../scala/xml/parsing/FactoryAdapter.scala | 271 +++++++++++------- 4 files changed, 234 insertions(+), 191 deletions(-) diff --git a/jvm/src/test/scala/scala/xml/XMLTest.scala b/jvm/src/test/scala/scala/xml/XMLTest.scala index d5a606d4e..b96d23293 100644 --- a/jvm/src/test/scala/scala/xml/XMLTest.scala +++ b/jvm/src/test/scala/scala/xml/XMLTest.scala @@ -1,14 +1,10 @@ package scala.xml import language.postfixOps - import org.junit.{Test => UnitTest} -import org.junit.Assert.assertTrue -import org.junit.Assert.assertFalse -import org.junit.Assert.assertEquals +import org.junit.Assert.{assertEquals, assertFalse, assertTrue} import java.io.StringWriter import java.io.ByteArrayOutputStream -import java.io.StringReader import scala.xml.dtd.{DocType, PublicID} import scala.xml.parsing.ConstructingParser import scala.xml.Utility.sort @@ -610,7 +606,7 @@ class XMLTestJVM { | section]]>
suffix""".stripMargin) } - def roundtripNodes(xml: String): Unit = assertEquals(xml, XML.loadStringNodes(xml).map(_.toString).mkString("")) + def roundtripNodes(xml: String): Unit = assertEquals(xml, XML.loadStringDocument(xml).children.map(_.toString).mkString("")) @UnitTest def xmlLoaderLoadNodes(): Unit = { diff --git a/shared/src/main/scala/scala/xml/XML.scala b/shared/src/main/scala/scala/xml/XML.scala index 16a23aa08..1aad3139c 100755 --- a/shared/src/main/scala/scala/xml/XML.scala +++ b/shared/src/main/scala/scala/xml/XML.scala @@ -16,7 +16,7 @@ package xml import factory.XMLLoader import java.io.{File, FileDescriptor, FileInputStream, FileOutputStream, InputStream, Reader, StringReader, Writer} import java.nio.channels.Channels -import scala.util.control.Exception.ultimately +import scala.util.control.Exception object Source { def fromFile(name: String): InputSource = fromFile(new File(name)) @@ -25,8 +25,8 @@ object Source { def fromSysId(sysID: String): InputSource = new InputSource(sysID) def fromFile(fd: FileDescriptor): InputSource = fromInputStream(new FileInputStream(fd)) def fromInputStream(is: InputStream): InputSource = new InputSource(is) - def fromReader(reader: Reader): InputSource = new InputSource(reader) def fromString(string: String): InputSource = fromReader(new StringReader(string)) + def fromReader(reader: Reader): InputSource = new InputSource(reader) } /** @@ -68,12 +68,14 @@ object XML extends XMLLoader[Elem] { val encoding: String = "UTF-8" /** Returns an XMLLoader whose load* methods will use the supplied SAXParser. */ - def withSAXParser(p: SAXParser): XMLLoader[Elem] = - new XMLLoader[Elem] { override val parser: SAXParser = p } + def withSAXParser(p: SAXParser): XMLLoader[Elem] = new XMLLoader[Elem] { + override val parser: SAXParser = p + } /** Returns an XMLLoader whose load* methods will use the supplied XMLReader. */ - def withXMLReader(r: XMLReader): XMLLoader[Elem] = - new XMLLoader[Elem] { override val reader: XMLReader = r } + def withXMLReader(r: XMLReader): XMLLoader[Elem] = new XMLLoader[Elem] { + override val reader: XMLReader = r + } /** * Saves a node to a file with given filename using given encoding @@ -94,15 +96,15 @@ object XML extends XMLLoader[Elem] { node: Node, enc: String = "UTF-8", xmlDecl: Boolean = false, - doctype: dtd.DocType = null): Unit = - { - val fos: FileOutputStream = new FileOutputStream(filename) - val w: Writer = Channels.newWriter(fos.getChannel, enc) + doctype: dtd.DocType = null + ): Unit = { + val fos: FileOutputStream = new FileOutputStream(filename) + val w: Writer = Channels.newWriter(fos.getChannel, enc) - ultimately(w.close())( - write(w, node, enc, xmlDecl, doctype) - ) - } + Exception.ultimately(w.close())( + write(w, node, enc, xmlDecl, doctype) + ) + } /** * Writes the given node using writer, optionally with xml decl and doctype. @@ -114,7 +116,14 @@ object XML extends XMLLoader[Elem] { * @param xmlDecl if true, write xml declaration * @param doctype if not null, write doctype declaration */ - final def write(w: java.io.Writer, node: Node, enc: String, xmlDecl: Boolean, doctype: dtd.DocType, minimizeTags: MinimizeMode.Value = MinimizeMode.Default): Unit = { + final def write( + w: Writer, + node: Node, + enc: String, + xmlDecl: Boolean, + doctype: dtd.DocType, + minimizeTags: MinimizeMode.Value = MinimizeMode.Default + ): Unit = { /* TODO: optimize by giving writer parameter to toXML*/ if (xmlDecl) w.write("\n") if (doctype ne null) w.write(doctype.toString + "\n") diff --git a/shared/src/main/scala/scala/xml/factory/XMLLoader.scala b/shared/src/main/scala/scala/xml/factory/XMLLoader.scala index acaf63536..0aa36e699 100644 --- a/shared/src/main/scala/scala/xml/factory/XMLLoader.scala +++ b/shared/src/main/scala/scala/xml/factory/XMLLoader.scala @@ -14,9 +14,9 @@ package scala package xml package factory -import org.xml.sax.{SAXNotRecognizedException, SAXNotSupportedException, XMLReader} +import org.xml.sax.XMLReader +import scala.xml.Source import javax.xml.parsers.SAXParserFactory -import parsing.{FactoryAdapter, NoBindingFactoryAdapter} import java.io.{File, FileDescriptor, InputStream, Reader} import java.net.URL @@ -25,9 +25,6 @@ import java.net.URL * created by "def parser" or the reader created by "def reader". */ trait XMLLoader[T <: Node] { - import scala.xml.Source._ - def adapter: FactoryAdapter = new NoBindingFactoryAdapter() - private def setSafeDefaults(parserFactory: SAXParserFactory): Unit = { parserFactory.setFeature("http://javax.xml.XMLConstants/feature/secure-processing", true) parserFactory.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false) @@ -54,69 +51,49 @@ trait XMLLoader[T <: Node] { def reader: XMLReader = parser.getXMLReader /** - * Loads XML from the given InputSource, using the supplied parser. + * Loads XML from the given InputSource, using the supplied parser or reader. * The methods available in scala.xml.XML use the XML parser in the JDK * (unless another parser is present on the classpath). */ - def loadXML(inputSource: InputSource, parser: SAXParser): T = loadXML(inputSource, parser.getXMLReader) - - def loadXMLNodes(inputSource: InputSource, parser: SAXParser): Seq[Node] = loadXMLNodes(inputSource, parser.getXMLReader) - - private def loadXML(inputSource: InputSource, reader: XMLReader): T = { - val result: FactoryAdapter = parse(inputSource, reader) - result.rootElem.asInstanceOf[T] - } - - private def loadXMLNodes(inputSource: InputSource, reader: XMLReader): Seq[Node] = { - val result: FactoryAdapter = parse(inputSource, reader) - result.prolog ++ (result.rootElem :: result.epilogue) - } - - private def parse(inputSource: InputSource, xmlReader: XMLReader): FactoryAdapter = { - if (inputSource == null) throw new IllegalArgumentException("InputSource cannot be null") - - val result: FactoryAdapter = adapter - - xmlReader.setContentHandler(result) - xmlReader.setDTDHandler(result) - /* Do not overwrite pre-configured EntityResolver. */ - if (xmlReader.getEntityResolver == null) xmlReader.setEntityResolver(result) - /* Do not overwrite pre-configured ErrorHandler. */ - if (xmlReader.getErrorHandler == null) xmlReader.setErrorHandler(result) - - try { - xmlReader.setProperty("http://xml.org/sax/properties/lexical-handler", result) - } catch { - case _: SAXNotRecognizedException => - case _: SAXNotSupportedException => - } - - result.scopeStack = TopScope :: result.scopeStack - xmlReader.parse(inputSource) - result.scopeStack = result.scopeStack.tail - - result - } - - /** Loads XML. */ - def load(inputSource: InputSource): T = loadXML(inputSource, reader) - def loadFile(fileName: String): T = load(fromFile(fileName)) - def loadFile(file: File): T = load(fromFile(file)) - def load(url: URL): T = load(fromUrl(url)) - def load(sysId: String): T = load(fromSysId(sysId)) - def loadFile(fileDescriptor: FileDescriptor): T = load(fromFile(fileDescriptor)) - def load(inputStream: InputStream): T = load(fromInputStream(inputStream)) - def load(reader: Reader): T = load(fromReader(reader)) - def loadString(string: String): T = load(fromString(string)) + private def getDocElem(document: Document): T = document.docElem.asInstanceOf[T] + + def loadXML(inputSource: InputSource, parser: SAXParser): T = getDocElem(loadDocument(inputSource, parser)) + def loadXMLNodes(inputSource: InputSource, parser: SAXParser): Seq[Node] = loadDocument(inputSource, parser).children + + private def loadDocument(inputSource: InputSource, parser: SAXParser): Document = adapter.loadDocument(inputSource, parser) + private def loadDocument(inputSource: InputSource, reader: XMLReader): Document = adapter.loadDocument(inputSource, reader) + def adapter: parsing.FactoryAdapter = new parsing.NoBindingFactoryAdapter() + + /** Loads XML Document. */ + def loadDocument(source: InputSource): Document = loadDocument(source, reader) + def loadFileDocument(fileName: String): Document = loadDocument(Source.fromFile(fileName)) + def loadFileDocument(file: File): Document = loadDocument(Source.fromFile(file)) + def loadDocument(url: URL): Document = loadDocument(Source.fromUrl(url)) + def loadDocument(sysId: String): Document = loadDocument(Source.fromSysId(sysId)) + def loadFileDocument(fileDescriptor: FileDescriptor): Document = loadDocument(Source.fromFile(fileDescriptor)) + def loadDocument(inputStream: InputStream): Document = loadDocument(Source.fromInputStream(inputStream)) + def loadDocument(reader: Reader): Document = loadDocument(Source.fromReader(reader)) + def loadStringDocument(string: String): Document = loadDocument(Source.fromString(string)) + + /** Loads XML element. */ + def load(inputSource: InputSource): T = getDocElem(loadDocument(inputSource)) + def loadFile(fileName: String): T = getDocElem(loadFileDocument(fileName)) + def loadFile(file: File): T = getDocElem(loadFileDocument(file)) + def load(url: URL): T = getDocElem(loadDocument(url)) + def load(sysId: String): T = getDocElem(loadDocument(sysId)) + def loadFile(fileDescriptor: FileDescriptor): T = getDocElem(loadFileDocument(fileDescriptor)) + def load(inputStream: InputStream): T = getDocElem(loadDocument(inputStream)) + def load(reader: Reader): T = getDocElem(loadDocument(reader)) + def loadString(string: String): T = getDocElem(loadStringDocument(string)) /** Load XML nodes, including comments and processing instructions that precede and follow the root element. */ - def loadNodes(inputSource: InputSource): Seq[Node] = loadXMLNodes(inputSource, reader) - def loadFileNodes(fileName: String): Seq[Node] = loadNodes(fromFile(fileName)) - def loadFileNodes(file: File): Seq[Node] = loadNodes(fromFile(file)) - def loadNodes(url: URL): Seq[Node] = loadNodes(fromUrl(url)) - def loadNodes(sysId: String): Seq[Node] = loadNodes(fromSysId(sysId)) - def loadFileNodes(fileDescriptor: FileDescriptor): Seq[Node] = loadNodes(fromFile(fileDescriptor)) - def loadNodes(inputStream: InputStream): Seq[Node] = loadNodes(fromInputStream(inputStream)) - def loadNodes(reader: Reader): Seq[Node] = loadNodes(fromReader(reader)) - def loadStringNodes(string: String): Seq[Node] = loadNodes(fromString(string)) + def loadNodes(inputSource: InputSource): Seq[Node] = loadDocument(inputSource).children + def loadFileNodes(fileName: String): Seq[Node] = loadFileDocument(fileName).children + def loadFileNodes(file: File): Seq[Node] = loadFileDocument(file).children + def loadNodes(url: URL): Seq[Node] = loadDocument(url).children + def loadNodes(sysId: String): Seq[Node] = loadDocument(sysId).children + def loadFileNodes(fileDescriptor: FileDescriptor): Seq[Node] = loadFileDocument(fileDescriptor).children + def loadNodes(inputStream: InputStream): Seq[Node] = loadDocument(inputStream).children + def loadNodes(reader: Reader): Seq[Node] = loadDocument(reader).children + def loadStringNodes(string: String): Seq[Node] = loadStringDocument(string).children } diff --git a/shared/src/main/scala/scala/xml/parsing/FactoryAdapter.scala b/shared/src/main/scala/scala/xml/parsing/FactoryAdapter.scala index d31033468..536d269f8 100644 --- a/shared/src/main/scala/scala/xml/parsing/FactoryAdapter.scala +++ b/shared/src/main/scala/scala/xml/parsing/FactoryAdapter.scala @@ -15,7 +15,7 @@ package xml package parsing import scala.collection.Seq -import org.xml.sax.Attributes +import org.xml.sax.{Attributes, SAXNotRecognizedException, SAXNotSupportedException} import org.xml.sax.ext.DefaultHandler2 // can be mixed into FactoryAdapter if desired @@ -37,9 +37,15 @@ trait ConsoleErrorHandler extends DefaultHandler2 { /** * SAX adapter class, for use with Java SAX parser. Keeps track of * namespace bindings, without relying on namespace handling of the - * underlying SAX parser. + * underlying SAX parser (but processing the parser's namespace-related events if it is namespace-aware). */ abstract class FactoryAdapter extends DefaultHandler2 with factory.XMLLoader[Node] { + val normalizeWhitespace: Boolean = false + + private var document: Option[Document] = None + + private var prefixMappings: List[(String, String)] = List.empty + var prolog: List[Node] = List.empty var rootElem: Node = _ var epilogue: List[Node] = List.empty @@ -79,6 +85,52 @@ abstract class FactoryAdapter extends DefaultHandler2 with factory.XMLLoader[Nod var curTag: String = _ var capture: Boolean = false + /** + * Captures text or cdata. + */ + def captureText(): Unit = { + if (capture && buffer.nonEmpty) { + val text: String = buffer.toString + val newNode: Node = if (inCDATA) createPCData(text) else createText(text) + hStack ::= newNode + } + + buffer.clear() + inCDATA = false + } + + /** + * Load XML document from the source using the parser. + */ + def loadDocument(source: InputSource, parser: SAXParser): Document = + loadDocument(source, parser.getXMLReader) + + /** + * Load XML document from the source using the reader. + */ + def loadDocument(source: InputSource, xmlReader: XMLReader): Document = { + if (source == null) throw new IllegalArgumentException("InputSource cannot be null") + + xmlReader.setContentHandler(this) + xmlReader.setDTDHandler(this) + /* Do not overwrite pre-configured EntityResolver. */ + if (xmlReader.getEntityResolver == null) xmlReader.setEntityResolver(this) + /* Do not overwrite pre-configured ErrorHandler. */ + if (xmlReader.getErrorHandler == null) xmlReader.setErrorHandler(this) + + /* Use LexicalHandler if it is supported by the xmlReader. */ + try { + xmlReader.setProperty("http://xml.org/sax/properties/lexical-handler", this) + } catch { + case _: SAXNotRecognizedException => + case _: SAXNotSupportedException => + } + + xmlReader.parse(source) + + document.get + } + // abstract methods /** @@ -121,121 +173,100 @@ abstract class FactoryAdapter extends DefaultHandler2 with factory.XMLLoader[Nod */ def createComment(characters: String): Seq[Comment] - // - // ContentHandler methods - // - - val normalizeWhitespace: Boolean = false + /* ContentHandler methods */ - /** - * Capture characters, possibly normalizing whitespace. - * @param ch - * @param offset - * @param length - */ - override def characters(ch: Array[Char], offset: Int, length: Int): Unit = { - if (!capture) () - // compliant: report every character - else if (!normalizeWhitespace) buffer.appendAll(ch, offset, length) - // normalizing whitespace is not compliant, but useful - else { - var it: Iterator[Char] = ch.slice(offset, offset + length).iterator - while (it.hasNext) { - val c: Char = it.next() - val isSpace: Boolean = c.isWhitespace - buffer append (if (isSpace) ' ' else c) - if (isSpace) - it = it dropWhile (_.isWhitespace) - } - } + override def startDocument(): Unit = { + scopeStack ::= TopScope // TODO remove } - /** - * Start of a CDATA section. - */ - override def startCDATA(): Unit = { - captureText() - inCDATA = true + override def endDocument(): Unit = { + // capture the epilogue at the end of the document + epilogue = hStack.init.reverse + + val document = new Document + this.document = Some(document) + document.children = prolog ++ rootElem ++ epilogue + document.docElem = rootElem + document.dtd = null + document.baseURI = null + document.encoding = None + document.standAlone = None + document.version = None + + // Note: resetting to the freshly-created state; needed only if this instance is reused, which we do not do... + hStack = hStack.last :: Nil // TODO List.empty + scopeStack = scopeStack.tail // TODO List.empty + + rootElem = null + prolog = List.empty + epilogue = List.empty + + buffer.clear() + inCDATA = false + capture = false + curTag = null + + attribStack = List.empty + tagStack = List.empty } - /** - * End of a CDATA section. - */ - override def endCDATA(): Unit = captureText() + override def startPrefixMapping(prefix: String, uri: String): Unit = + prefixMappings ::= (prefix, uri) - /* ContentHandler methods */ + override def endPrefixMapping(prefix: String): Unit = () /* Start element. */ override def startElement( uri: String, _localName: String, qname: String, - attributes: Attributes): Unit = - { - captureText() - - // capture the prolog at the start of the root element - if (tagStack.isEmpty) { - prolog = hStack.reverse - hStack = List.empty - } - - tagStack = curTag :: tagStack - curTag = qname - - val localName: String = Utility.splitName(qname)._2 - capture = nodeContainsText(localName) - - hStack = null :: hStack - var m: MetaData = Null - var scpe: NamespaceBinding = - if (scopeStack.isEmpty) TopScope - else scopeStack.head - - for (i <- (0 until attributes.getLength).reverse) { - val qname: String = attributes getQName i - val value: String = attributes getValue i - val (pre: Option[String], key: String) = Utility.splitName(qname) - def nullIfEmpty(s: String): String = if (s == "") null else s - - if (pre.contains("xmlns") || (pre.isEmpty && qname == "xmlns")) { - val arg: String = if (pre.isEmpty) null else key - scpe = NamespaceBinding(arg, nullIfEmpty(value), scpe) - } else - m = Attribute(pre, key, Text(value), m) - } - - // Add namespace bindings for the prefix mappings declared by this element - // (if there are any, the parser is namespace-aware, and no namespace bindings were delivered as attributes). - // All `startPrefixMapping()` events will occur immediately before the corresponding `startElement()` event. - for ((prefix: String, uri: String) <- prefixMappings) - scpe = NamespaceBinding(if (prefix.isEmpty) null else prefix, uri, scpe) - - // Once the `prefixMappings` are processed into `scpe`, the list is emptied out - // so that already-declared namespaces are not re-declared on the nested elements. - prefixMappings = List.empty + attributes: Attributes + ): Unit = { + captureText() - scopeStack = scpe :: scopeStack - attribStack = m :: attribStack + // capture the prolog at the start of the root element + if (tagStack.isEmpty) { + prolog = hStack.reverse + hStack = List.empty } - private var prefixMappings: List[(String, String)] = List.empty + tagStack ::= curTag + curTag = qname + + val localName: String = Utility.splitName(qname)._2 + capture = nodeContainsText(localName) + + hStack ::= null + var m: MetaData = Null + var scpe: NamespaceBinding = + if (scopeStack.isEmpty) TopScope + else scopeStack.head + + for (i <- (0 until attributes.getLength).reverse) { + val qname: String = attributes getQName i + val value: String = attributes getValue i + val (pre: Option[String], key: String) = Utility.splitName(qname) + def nullIfEmpty(s: String): String = if (s == "") null else s + + if (pre.contains("xmlns") || (pre.isEmpty && qname == "xmlns")) { + val arg: String = if (pre.isEmpty) null else key + scpe = NamespaceBinding(arg, nullIfEmpty(value), scpe) + } else + m = Attribute(pre, key, Text(value), m) + } - override def startPrefixMapping(prefix: String, uri: String): Unit = - prefixMappings = (prefix, uri) :: prefixMappings + // Add namespace bindings for the prefix mappings declared by this element + // (if there are any, the parser is namespace-aware, and no namespace bindings were delivered as attributes). + // All `startPrefixMapping()` events will occur immediately before the corresponding `startElement()` event. + for ((prefix: String, uri: String) <- prefixMappings) + scpe = NamespaceBinding(if (prefix.isEmpty) null else prefix, uri, scpe) - /** - * Captures text or cdata. - */ - def captureText(): Unit = { - if (capture && buffer.nonEmpty) { - val text: String = buffer.toString - val newNode: Node = if (inCDATA) createPCData(text) else createText(text) - hStack = newNode :: hStack - } + // Once the `prefixMappings` are processed into `scpe`, the list is emptied out + // so that already-declared namespaces are not re-declared on the nested elements. + prefixMappings = List.empty - buffer.clear() - inCDATA = false + scopeStack ::= scpe + attribStack ::= m } /** @@ -262,18 +293,35 @@ abstract class FactoryAdapter extends DefaultHandler2 with factory.XMLLoader[Nod // create element rootElem = createNode(pre.orNull, localName, metaData, scp, v) - hStack = rootElem :: hStack + hStack ::= rootElem curTag = tagStack.head tagStack = tagStack.tail capture = curTag != null && nodeContainsText(curTag) // root level } - override def endDocument(): Unit = { - // capture the epilogue at the end of the document - epilogue = hStack.init.reverse - hStack = hStack.last :: Nil + /** + * Capture characters, possibly normalizing whitespace. + * + * @param ch + * @param offset + * @param length + */ + override def characters(ch: Array[Char], offset: Int, length: Int): Unit = { + if (!capture) () + // compliant: report every character + else if (!normalizeWhitespace) buffer.appendAll(ch, offset, length) + // normalizing whitespace is not compliant, but useful + else { + var it: Iterator[Char] = ch.slice(offset, offset + length).iterator + while (it.hasNext) { + val c: Char = it.next() + val isSpace: Boolean = c.isWhitespace + buffer append (if (isSpace) ' ' else c) + if (isSpace) + it = it dropWhile (_.isWhitespace) + } + } } - /** * Processing instruction. */ @@ -282,6 +330,19 @@ abstract class FactoryAdapter extends DefaultHandler2 with factory.XMLLoader[Nod hStack = hStack.reverse_:::(createProcInstr(target, data).toList) } + /** + * Start of a CDATA section. + */ + override def startCDATA(): Unit = { + captureText() + inCDATA = true + } + + /** + * End of a CDATA section. + */ + override def endCDATA(): Unit = captureText() + /** * Comment. */ From f71c1b7ce4d19a85bef3a1af699f5127ab4b2956 Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Fri, 9 Jun 2023 04:07:47 +0000 Subject: [PATCH 664/789] Update scala-compiler, scala-library to 2.12.18 --- .circleci/config.yml | 10 +++++----- build.sbt | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 5eb9f1704..17e8aaa2f 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -94,7 +94,7 @@ workflows: - scala_job: name: 2.12.17 java_version: jdk8 - scala_version: 2.12.17 + scala_version: 2.12.18 - scala_job: name: 2.13.10 java_version: jdk8 @@ -106,7 +106,7 @@ workflows: - scala_job: name: jdk11_2.12 java_version: jdk11 - scala_version: 2.12.17 + scala_version: 2.12.18 - scala_job: name: jdk11_2.13 java_version: jdk11 @@ -118,7 +118,7 @@ workflows: - scala_job: name: jdk17_2.12 java_version: jdk17 - scala_version: 2.12.17 + scala_version: 2.12.18 - scala_job: name: jdk17_2.13 java_version: jdk17 @@ -129,7 +129,7 @@ workflows: scala_version: 3.3.0 - scalajs_job: name: sjs1.0_2.12 - scala_version: 2.12.17 + scala_version: 2.12.18 - scalajs_job: name: sjs1.0_2.13 scala_version: 2.13.10 @@ -138,7 +138,7 @@ workflows: scala_version: 3.3.0 - scalanative_job: name: native0.4_2.12 - scala_version: 2.12.17 + scala_version: 2.12.18 - scalanative_job: name: native0.4_2.13 scala_version: 2.13.10 diff --git a/build.sbt b/build.sbt index 91cb694c1..6337abf04 100644 --- a/build.sbt +++ b/build.sbt @@ -36,8 +36,8 @@ lazy val xml = crossProject(JSPlatform, JVMPlatform, NativePlatform) .settings( name := "scala-xml", scalaModuleAutomaticModuleName := Some("scala.xml"), - crossScalaVersions := Seq("2.13.10", "2.12.17", "3.3.0"), - scalaVersion := "2.12.17", + crossScalaVersions := Seq("2.13.10", "2.12.18", "3.3.0"), + scalaVersion := "2.12.18", scalacOptions ++= (CrossVersion.partialVersion(scalaVersion.value) match { case Some((3, _)) => From 2da39909898d0db839fdcda6d42ad9d10c00ef59 Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Fri, 9 Jun 2023 04:07:51 +0000 Subject: [PATCH 665/789] Update scala-compiler, scala-library to 2.13.11 --- .circleci/config.yml | 10 +++++----- build.sbt | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 5eb9f1704..11b9b4b8e 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -98,7 +98,7 @@ workflows: - scala_job: name: 2.13.10 java_version: jdk8 - scala_version: 2.13.10 + scala_version: 2.13.11 - scala_job: name: 3.1.0 java_version: jdk8 @@ -110,7 +110,7 @@ workflows: - scala_job: name: jdk11_2.13 java_version: jdk11 - scala_version: 2.13.10 + scala_version: 2.13.11 - scala_job: name: jdk11_3.1 java_version: jdk11 @@ -122,7 +122,7 @@ workflows: - scala_job: name: jdk17_2.13 java_version: jdk17 - scala_version: 2.13.10 + scala_version: 2.13.11 - scala_job: name: jdk17_3.1 java_version: jdk17 @@ -132,7 +132,7 @@ workflows: scala_version: 2.12.17 - scalajs_job: name: sjs1.0_2.13 - scala_version: 2.13.10 + scala_version: 2.13.11 - scalajs_job: name: sjs1.0_3.1 scala_version: 3.3.0 @@ -141,7 +141,7 @@ workflows: scala_version: 2.12.17 - scalanative_job: name: native0.4_2.13 - scala_version: 2.13.10 + scala_version: 2.13.11 - scalanative_job: name: native0.4_3 scala_version: 3.3.0 diff --git a/build.sbt b/build.sbt index 91cb694c1..ad785eae3 100644 --- a/build.sbt +++ b/build.sbt @@ -36,7 +36,7 @@ lazy val xml = crossProject(JSPlatform, JVMPlatform, NativePlatform) .settings( name := "scala-xml", scalaModuleAutomaticModuleName := Some("scala.xml"), - crossScalaVersions := Seq("2.13.10", "2.12.17", "3.3.0"), + crossScalaVersions := Seq("2.13.11", "2.12.17", "3.3.0"), scalaVersion := "2.12.17", scalacOptions ++= (CrossVersion.partialVersion(scalaVersion.value) match { From 420ef350b7224f24dc0363d2ace5df5b0e1a8b07 Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Fri, 9 Jun 2023 04:06:55 +0000 Subject: [PATCH 666/789] Update sbt-header to 5.10.0 --- project/plugins.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/plugins.sbt b/project/plugins.sbt index 537a0b5aa..e1aefda6a 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -3,4 +3,4 @@ addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.3.1") addSbtPlugin("org.portable-scala" % "sbt-scala-native-crossproject" % "1.3.1") addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.13.1") addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.4.14") -addSbtPlugin("de.heikoseeberger" % "sbt-header" % "5.9.0") +addSbtPlugin("de.heikoseeberger" % "sbt-header" % "5.10.0") From 042abb0b3e242ecf2890171681ca0dc511f676bb Mon Sep 17 00:00:00 2001 From: Leonid Dubinsky Date: Mon, 12 Jun 2023 02:27:02 -0400 Subject: [PATCH 667/789] Update config.yml --- .circleci/config.yml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 230872a50..63248b6a8 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -20,7 +20,7 @@ commands: parameters: scala_version: type: string - default: 2.12.17 + default: 2.12.18 sbt_tasks: type: string default: update compile test:compile test doc package osgiBundle @@ -44,7 +44,7 @@ jobs: parameters: scala_version: description: "Scala version" - default: 2.12.17 + default: 2.12.18 type: string java_version: description: "Java version" @@ -61,7 +61,7 @@ jobs: parameters: scala_version: description: "Scala version" - default: 2.12.17 + default: 2.12.18 type: string steps: - checkout @@ -75,7 +75,7 @@ jobs: parameters: scala_version: description: "Scala version" - default: 2.12.17 + default: 2.12.18 type: string steps: - checkout @@ -92,15 +92,15 @@ workflows: build: jobs: - scala_job: - name: 2.12.17 + name: 2.12.18 java_version: jdk8 scala_version: 2.12.18 - scala_job: - name: 2.13.10 + name: 2.13.11 java_version: jdk8 scala_version: 2.13.11 - scala_job: - name: 3.1.0 + name: 3.3.0 java_version: jdk8 scala_version: 3.3.0 - scala_job: @@ -124,7 +124,7 @@ workflows: java_version: jdk17 scala_version: 2.13.11 - scala_job: - name: jdk17_3.1 + name: jdk17_3.3 java_version: jdk17 scala_version: 3.3.0 - scalajs_job: @@ -134,7 +134,7 @@ workflows: name: sjs1.0_2.13 scala_version: 2.13.11 - scalajs_job: - name: sjs1.0_3.1 + name: sjs1.0_3.3 scala_version: 3.3.0 - scalanative_job: name: native0.4_2.12 From ad7a0079b22dcdd303b794116b07547e47a3870a Mon Sep 17 00:00:00 2001 From: Leonid Dubinsky Date: Wed, 14 Jun 2023 23:16:58 -0400 Subject: [PATCH 668/789] Change infix method calls `o m a` to `o.m(a)`. --- build.sbt | 2 +- .../scala-2.x/scala/xml/CompilerErrors.scala | 6 +- .../test/scala/scala/xml/ReuseNodesTest.scala | 6 +- jvm/src/test/scala/scala/xml/XMLTest.scala | 41 ++++--- shared/src/main/scala/scala/xml/Comment.scala | 2 +- shared/src/main/scala/scala/xml/Elem.scala | 2 +- .../src/main/scala/scala/xml/Equality.scala | 8 +- shared/src/main/scala/scala/xml/Group.scala | 4 +- .../src/main/scala/scala/xml/MetaData.scala | 20 ++-- .../scala/scala/xml/NamespaceBinding.scala | 13 +- shared/src/main/scala/scala/xml/Node.scala | 12 +- .../src/main/scala/scala/xml/NodeBuffer.scala | 2 +- shared/src/main/scala/scala/xml/NodeSeq.scala | 18 +-- shared/src/main/scala/scala/xml/PCData.scala | 2 +- .../scala/scala/xml/PrefixedAttribute.scala | 4 +- .../main/scala/scala/xml/PrettyPrinter.scala | 36 +++--- .../src/main/scala/scala/xml/ProcInstr.scala | 4 +- .../src/main/scala/scala/xml/TextBuffer.scala | 8 +- .../src/main/scala/scala/xml/Unparsed.scala | 2 +- .../scala/scala/xml/UnprefixedAttribute.scala | 4 +- shared/src/main/scala/scala/xml/Utility.scala | 113 +++++++++--------- shared/src/main/scala/scala/xml/XML.scala | 2 +- shared/src/main/scala/scala/xml/Xhtml.scala | 80 ++++++------- .../scala/scala/xml/dtd/ContentModel.scala | 22 ++-- .../src/main/scala/scala/xml/dtd/Decl.scala | 40 +++---- .../main/scala/scala/xml/dtd/ExternalID.scala | 2 +- .../scala/xml/dtd/ValidationException.scala | 2 +- .../main/scala/scala/xml/dtd/impl/Base.scala | 4 +- .../scala/xml/dtd/impl/BaseBerrySethi.scala | 10 +- .../scala/xml/dtd/impl/DetWordAutom.scala | 6 +- .../scala/xml/dtd/impl/NondetWordAutom.scala | 10 +- .../xml/dtd/impl/SubsetConstruction.scala | 8 +- .../scala/xml/dtd/impl/WordBerrySethi.scala | 16 +-- .../scala/scala/xml/factory/NodeFactory.scala | 2 +- .../xml/include/sax/XIncludeFilter.scala | 10 +- .../scala/xml/parsing/ExternalSources.scala | 8 +- .../scala/xml/parsing/FactoryAdapter.scala | 12 +- .../scala/xml/parsing/MarkupHandler.scala | 6 +- .../scala/xml/parsing/MarkupParser.scala | 10 +- .../xml/parsing/MarkupParserCommon.scala | 23 ++-- .../scala/scala/xml/parsing/TokenTests.scala | 16 +-- .../xml/transform/BasicTransformer.scala | 4 +- .../test/scala-2.x/scala/xml/XMLTest2x.scala | 3 - .../test/scala/scala/xml/AttributeTest.scala | 4 +- .../scala/scala/xml/PatternMatchingTest.scala | 2 +- .../test/scala/scala/xml/ShouldCompile.scala | 4 +- .../test/scala/scala/xml/XMLSyntaxTest.scala | 6 +- shared/src/test/scala/scala/xml/XMLTest.scala | 6 +- 48 files changed, 309 insertions(+), 318 deletions(-) diff --git a/build.sbt b/build.sbt index 9e2f2ec18..a195e9df6 100644 --- a/build.sbt +++ b/build.sbt @@ -93,7 +93,7 @@ lazy val xml = crossProject(JSPlatform, JVMPlatform, NativePlatform) file(jarPath) -> url("http://docs.oracle.com/javase/8/docs/api") ) - } getOrElse { + }.getOrElse { // If everything fails, jam in Java 11 modules. Map( file("/modules/java.base") diff --git a/jvm/src/test/scala-2.x/scala/xml/CompilerErrors.scala b/jvm/src/test/scala-2.x/scala/xml/CompilerErrors.scala index 5a8e03e9c..2ad3a329b 100644 --- a/jvm/src/test/scala-2.x/scala/xml/CompilerErrors.scala +++ b/jvm/src/test/scala-2.x/scala/xml/CompilerErrors.scala @@ -197,12 +197,12 @@ class CompilerTesting { def expectXmlError(msg: String, code: String): Unit = { val errors: List[String] = xmlErrorMessages(msg, code) - assert(errors exists (_ contains msg), errors mkString "\n") + assert(errors.exists(_.contains(msg)), errors.mkString("\n")) } def expectXmlErrors(msgCount: Int, msg: String, code: String): Unit = { val errors: List[String] = xmlErrorMessages(msg, code) - val errorCount: Int = errors.count(_ contains msg) - assert(errorCount == msgCount, s"$errorCount occurrences of \'$msg\' found -- expected $msgCount in:\n${errors mkString "\n"}") + val errorCount: Int = errors.count(_.contains(msg)) + assert(errorCount == msgCount, s"$errorCount occurrences of \'$msg\' found -- expected $msgCount in:\n${errors.mkString("\n")}") } } diff --git a/jvm/src/test/scala/scala/xml/ReuseNodesTest.scala b/jvm/src/test/scala/scala/xml/ReuseNodesTest.scala index 3adbeb698..81c839bba 100644 --- a/jvm/src/test/scala/scala/xml/ReuseNodesTest.scala +++ b/jvm/src/test/scala/scala/xml/ReuseNodesTest.scala @@ -19,7 +19,7 @@ object ReuseNodesTest { class OriginalTranformr(rules: RewriteRule*) extends RuleTransformer(rules:_*) { override def transform(ns: Seq[Node]): Seq[Node] = { - val xs: Seq[Seq[Node]] = ns.toStream map transform + val xs: Seq[Seq[Node]] = ns.toStream.map(transform) val (xs1: Seq[(Seq[Node], Node)], xs2: Seq[(Seq[Node], Node)]) = xs.zip(ns).span { case (x, n) => unchanged(n, x) } if (xs2.isEmpty) ns @@ -30,7 +30,7 @@ object ReuseNodesTest { class ModifiedTranformr(rules: RewriteRule*) extends RuleTransformer(rules:_*) { override def transform(ns: Seq[Node]): Seq[Node] = { - val changed: Seq[Node] = ns flatMap transform + val changed: Seq[Node] = ns.flatMap(transform) if (changed.length != ns.length || changed.zip(ns).exists(p => p._1 != p._2)) changed else ns @@ -93,7 +93,7 @@ class ReuseNodesTest { recursiveAssert(original.child,transformed.child) case _ => assertSame(original, transformed) - // No need to check for children, node being immuatable + // No need to check for children, node being immutable // children can't be different if parents are referentially equal } } diff --git a/jvm/src/test/scala/scala/xml/XMLTest.scala b/jvm/src/test/scala/scala/xml/XMLTest.scala index b96d23293..49ca15974 100644 --- a/jvm/src/test/scala/scala/xml/XMLTest.scala +++ b/jvm/src/test/scala/scala/xml/XMLTest.scala @@ -1,6 +1,5 @@ package scala.xml -import language.postfixOps import org.junit.{Test => UnitTest} import org.junit.Assert.{assertEquals, assertFalse, assertTrue} import java.io.StringWriter @@ -38,8 +37,8 @@ class XMLTestJVM { assertEquals(c, parsedxml11) assertEquals(parsedxml1, parsedxml11) - assertTrue(List(parsedxml1) sameElements List(parsedxml11)) - assertTrue(Array(parsedxml1).toList sameElements List(parsedxml11)) + assertTrue(List(parsedxml1).sameElements(List(parsedxml11))) + assertTrue(Array(parsedxml1).toList.sameElements(List(parsedxml11))) val x2: String = "Peter BunemanDan SuciuData on ze web" val x2p: Elem = XML.loadString(x2) @@ -52,44 +51,44 @@ class XMLTestJVM { @UnitTest def xpath(): Unit = { - assertTrue(parsedxml1 \ "_" sameElements List(Elem(null, "world", e, sc))) + assertTrue((parsedxml1 \ "_").sameElements(List(Elem(null, "world", e, sc)))) - assertTrue(parsedxml1 \ "world" sameElements List(Elem(null, "world", e, sc))) + assertTrue((parsedxml1 \ "world").sameElements(List(Elem(null, "world", e, sc)))) assertTrue( - (parsedxml2 \ "_") sameElements List( + (parsedxml2 \ "_").sameElements(List( Elem(null, "book", e, sc, Elem(null, "author", e, sc, Text("Peter Buneman")), Elem(null, "author", e, sc, Text("Dan Suciu")), Elem(null, "title", e, sc, Text("Data on ze web"))), Elem(null, "book", e, sc, Elem(null, "author", e, sc, Text("John Mitchell")), - Elem(null, "title", e, sc, Text("Foundations of Programming Languages"))))) + Elem(null, "title", e, sc, Text("Foundations of Programming Languages")))))) assertTrue((parsedxml2 \ "author").isEmpty) assertTrue( - (parsedxml2 \ "book") sameElements List( + (parsedxml2 \ "book").sameElements(List( Elem(null, "book", e, sc, Elem(null, "author", e, sc, Text("Peter Buneman")), Elem(null, "author", e, sc, Text("Dan Suciu")), Elem(null, "title", e, sc, Text("Data on ze web"))), Elem(null, "book", e, sc, Elem(null, "author", e, sc, Text("John Mitchell")), - Elem(null, "title", e, sc, Text("Foundations of Programming Languages"))))) + Elem(null, "title", e, sc, Text("Foundations of Programming Languages")))))) assertTrue( - (parsedxml2 \ "_" \ "_") sameElements List( + (parsedxml2 \ "_" \ "_").sameElements(List( Elem(null, "author", e, sc, Text("Peter Buneman")), Elem(null, "author", e, sc, Text("Dan Suciu")), Elem(null, "title", e, sc, Text("Data on ze web")), Elem(null, "author", e, sc, Text("John Mitchell")), - Elem(null, "title", e, sc, Text("Foundations of Programming Languages")))) + Elem(null, "title", e, sc, Text("Foundations of Programming Languages"))))) assertTrue( - (parsedxml2 \ "_" \ "author") sameElements List( + (parsedxml2 \ "_" \ "author").sameElements(List( Elem(null, "author", e, sc, Text("Peter Buneman")), Elem(null, "author", e, sc, Text("Dan Suciu")), - Elem(null, "author", e, sc, Text("John Mitchell")))) + Elem(null, "author", e, sc, Text("John Mitchell"))))) assertTrue((parsedxml2 \ "_" \ "_" \ "author").isEmpty) } @@ -97,21 +96,21 @@ class XMLTestJVM { @UnitTest def xpathDESCENDANTS(): Unit = { assertTrue( - (parsedxml2 \\ "author") sameElements List( + (parsedxml2 \\ "author").sameElements(List( Elem(null, "author", e, sc, Text("Peter Buneman")), Elem(null, "author", e, sc, Text("Dan Suciu")), - Elem(null, "author", e, sc, Text("John Mitchell")))) + Elem(null, "author", e, sc, Text("John Mitchell"))))) assertTrue( - (parsedxml2 \\ "title") sameElements List( + (parsedxml2 \\ "title").sameElements(List( Elem(null, "title", e, sc, Text("Data on ze web")), - Elem(null, "title", e, sc, Text("Foundations of Programming Languages")))) + Elem(null, "title", e, sc, Text("Foundations of Programming Languages"))))) assertEquals("Peter BunemanDan SuciuData on ze web", (parsedxml2 \\ "book") { (n: Node) => (n \ "title") xml_== "Data on ze web" }.toString) assertTrue( - (NodeSeq.fromSeq(List(parsedxml2)) \\ "_") sameElements List( + (NodeSeq.fromSeq(List(parsedxml2)) \\ "_").sameElements(List( Elem(null, "bib", e, sc, Elem(null, "book", e, sc, Elem(null, "author", e, sc, Text("Peter Buneman")), @@ -131,7 +130,7 @@ class XMLTestJVM { Elem(null, "author", e, sc, Text("John Mitchell")), Elem(null, "title", e, sc, Text("Foundations of Programming Languages"))), Elem(null, "author", e, sc, Text("John Mitchell")), - Elem(null, "title", e, sc, Text("Foundations of Programming Languages")))) + Elem(null, "title", e, sc, Text("Foundations of Programming Languages"))))) } @UnitTest @@ -196,7 +195,7 @@ class XMLTestJVM { // println("x = " + x) // println("y = " + y) // println("x equals y: " + (x equals y) + ", y equals x: " + (y equals x)) - assertTrue((x equals y) && (y equals x)) + assertTrue(x.equals(y) && y.equals(x)) // println() } } @@ -659,7 +658,7 @@ class XMLTestJVM { val parent: org.xml.sax.XMLReader = xercesInternal.newSAXParser.getXMLReader val filter: org.xml.sax.XMLFilter = new org.xml.sax.helpers.XMLFilterImpl(parent) { override def characters(ch: Array[Char], start: Int, length: Int): Unit = { - for (i <- 0 until length) if (ch(start+i) == 'a') ch(start+i) = 'b' + for (i <- 0.until(length)) if (ch(start+i) == 'a') ch(start+i) = 'b' super.characters(ch, start, length) } } diff --git a/shared/src/main/scala/scala/xml/Comment.scala b/shared/src/main/scala/scala/xml/Comment.scala index 1ca9771e6..1a0e05f4e 100644 --- a/shared/src/main/scala/scala/xml/Comment.scala +++ b/shared/src/main/scala/scala/xml/Comment.scala @@ -39,5 +39,5 @@ case class Comment(commentText: String) extends SpecialNode { * Appends "" to this string buffer. */ override def buildString(sb: StringBuilder): StringBuilder = - sb append "" + sb.append("") } diff --git a/shared/src/main/scala/scala/xml/Elem.scala b/shared/src/main/scala/scala/xml/Elem.scala index dcbe8f5a3..db3adc391 100755 --- a/shared/src/main/scala/scala/xml/Elem.scala +++ b/shared/src/main/scala/scala/xml/Elem.scala @@ -106,5 +106,5 @@ class Elem( /** * Returns concatenation of `text(n)` for each child `n`. */ - override def text: String = (child map (_.text)).mkString + override def text: String = child.map(_.text).mkString } diff --git a/shared/src/main/scala/scala/xml/Equality.scala b/shared/src/main/scala/scala/xml/Equality.scala index 8c406c9d3..d2b6e8ca9 100644 --- a/shared/src/main/scala/scala/xml/Equality.scala +++ b/shared/src/main/scala/scala/xml/Equality.scala @@ -63,7 +63,7 @@ object Equality { } def compareBlithely(x1: AnyRef, x2: AnyRef): Boolean = { if (x1 == null || x2 == null) - return x1 eq x2 + return x1.eq(x2) x2 match { case s: String => compareBlithely(x1, s) @@ -108,9 +108,9 @@ trait Equality extends scala.Equals { */ private def doComparison(other: Any, blithe: Boolean): Boolean = { val strictlyEqual: Boolean = other match { - case x: AnyRef if this eq x => true - case x: Equality => (x canEqual this) && (this strict_== x) - case _ => false + case x: AnyRef if this.eq(x) => true + case x: Equality => (x canEqual this) && (this strict_== x) + case _ => false } strictlyEqual || (blithe && compareBlithely(this, asRef(other))) diff --git a/shared/src/main/scala/scala/xml/Group.scala b/shared/src/main/scala/scala/xml/Group.scala index 586a5981b..c6280abda 100644 --- a/shared/src/main/scala/scala/xml/Group.scala +++ b/shared/src/main/scala/scala/xml/Group.scala @@ -29,7 +29,7 @@ final case class Group(nodes: Seq[Node]) extends Node { } override def strict_==(other: Equality): Boolean = other match { - case Group(xs) => nodes sameElements xs + case Group(xs) => nodes.sameElements(xs) case _ => false } @@ -39,7 +39,7 @@ final case class Group(nodes: Seq[Node]) extends Node { * Since Group is very much a hack it throws an exception if you * try to do anything with it. */ - private def fail(msg: String): Nothing = throw new UnsupportedOperationException("class Group does not support method '%s'" format msg) + private def fail(msg: String): Nothing = throw new UnsupportedOperationException("class Group does not support method '%s'".format(msg)) override def label: Nothing = fail("label") override def attributes: Nothing = fail("attributes") diff --git a/shared/src/main/scala/scala/xml/MetaData.scala b/shared/src/main/scala/scala/xml/MetaData.scala index 45ea6eaf1..194307f53 100644 --- a/shared/src/main/scala/scala/xml/MetaData.scala +++ b/shared/src/main/scala/scala/xml/MetaData.scala @@ -29,8 +29,8 @@ object MetaData { */ @tailrec def concatenate(attribs: MetaData, new_tail: MetaData): MetaData = - if (attribs eq Null) new_tail - else concatenate(attribs.next, attribs copy new_tail) + if (attribs.eq(Null)) new_tail + else concatenate(attribs.next, attribs.copy(new_tail)) /** * returns normalized MetaData, with all duplicates removed and namespace prefixes resolved to @@ -38,16 +38,16 @@ object MetaData { */ def normalize(attribs: MetaData, scope: NamespaceBinding): MetaData = { def iterate(md: MetaData, normalized_attribs: MetaData, set: Set[String]): MetaData = { - if (md eq Null) { + if (md.eq(Null)) { normalized_attribs - } else if (md.value eq null) { + } else if (md.value.eq(null)) { iterate(md.next, normalized_attribs, set) } else { val key: String = getUniversalKey(md, scope) if (set(key)) { iterate(md.next, normalized_attribs, set) } else { - md copy iterate(md.next, normalized_attribs, set + key) + md.copy(iterate(md.next, normalized_attribs, set + key)) } } } @@ -154,8 +154,8 @@ abstract class MetaData /** filters this sequence of meta data */ override def filter(f: MetaData => Boolean): MetaData = - if (f(this)) copy(next filter f) - else next filter f + if (f(this)) copy(next.filter(f)) + else next.filter(f) def reverse: MetaData = foldLeft(Null: MetaData) { (x, xs) => @@ -181,7 +181,7 @@ abstract class MetaData * Returns a Map containing the attributes stored as key/value pairs. */ def asAttrMap: Map[String, String] = - (iterator map (x => (x.prefixedKey, x.value.text))).toMap + iterator.map(x => (x.prefixedKey, x.value.text)).toMap /** returns Null or the next MetaData item */ def next: MetaData @@ -217,9 +217,9 @@ abstract class MetaData override def toString: String = sbToString(buildString) def buildString(sb: StringBuilder): StringBuilder = { - sb append ' ' + sb.append(' ') toString1(sb) - next buildString sb + next.buildString(sb) } /** diff --git a/shared/src/main/scala/scala/xml/NamespaceBinding.scala b/shared/src/main/scala/scala/xml/NamespaceBinding.scala index 84c085f4e..b02111149 100644 --- a/shared/src/main/scala/scala/xml/NamespaceBinding.scala +++ b/shared/src/main/scala/scala/xml/NamespaceBinding.scala @@ -14,7 +14,6 @@ package scala package xml import scala.collection.Seq -import Utility.sbToString /** * The class `NamespaceBinding` represents namespace bindings @@ -30,7 +29,7 @@ case class NamespaceBinding(prefix: String, uri: String, parent: NamespaceBindin throw new IllegalArgumentException("zero length prefix not allowed") def getURI(_prefix: String): String = - if (prefix == _prefix) uri else parent getURI _prefix + if (prefix == _prefix) uri else parent.getURI(_prefix) /** * Returns some prefix that is mapped to the URI. @@ -40,13 +39,13 @@ case class NamespaceBinding(prefix: String, uri: String, parent: NamespaceBindin * if no prefix is mapped to the URI. */ def getPrefix(_uri: String): String = - if (_uri == uri) prefix else parent getPrefix _uri + if (_uri == uri) prefix else parent.getPrefix(_uri) - override def toString: String = sbToString(buildString(_, TopScope)) + override def toString: String = Utility.sbToString(buildString(_, TopScope)) private def shadowRedefined(stop: NamespaceBinding): NamespaceBinding = { def prefixList(x: NamespaceBinding): List[String] = - if ((x == null) || (x eq stop)) Nil + if ((x == null) || x.eq(stop)) Nil else x.prefix :: prefixList(x.parent) def fromPrefixList(l: List[String]): NamespaceBinding = l match { case Nil => stop @@ -70,7 +69,7 @@ case class NamespaceBinding(prefix: String, uri: String, parent: NamespaceBindin override def basisForHashCode: Seq[Any] = List(prefix, uri, parent) - def buildString(stop: NamespaceBinding): String = sbToString(buildString(_, stop)) + def buildString(stop: NamespaceBinding): String = Utility.sbToString(buildString(_, stop)) def buildString(sb: StringBuilder, stop: NamespaceBinding): Unit = { shadowRedefined(stop).doBuildString(sb, stop) @@ -83,6 +82,6 @@ case class NamespaceBinding(prefix: String, uri: String, parent: NamespaceBindin if (prefix != null) ":" + prefix else "", if (uri != null) uri else "" ) - parent.doBuildString(sb append s, stop) // copy(ignore) + parent.doBuildString(sb.append(s), stop) // copy(ignore) } } diff --git a/shared/src/main/scala/scala/xml/Node.scala b/shared/src/main/scala/scala/xml/Node.scala index 491f4ee92..7cd3aaab4 100755 --- a/shared/src/main/scala/scala/xml/Node.scala +++ b/shared/src/main/scala/scala/xml/Node.scala @@ -81,7 +81,7 @@ abstract class Node extends NodeSeq { * @return the namespace if `scope != null` and prefix was * found, else `null` */ - def getNamespace(pre: String): String = if (scope eq null) null else scope.getURI(pre) + def getNamespace(pre: String): String = if (scope.eq(null)) null else scope.getURI(pre) /** * Convenience method, looks up an unprefixed attribute in attributes of this node. @@ -124,7 +124,7 @@ abstract class Node extends NodeSeq { /** * Children which do not stringify to "" (needed for equality) */ - def nonEmptyChildren: Seq[Node] = child filterNot (_.toString == "") + def nonEmptyChildren: Seq[Node] = child.filterNot(_.toString == "") /** * Descendant axis (all descendants of this node, not including node itself) @@ -155,7 +155,7 @@ abstract class Node extends NodeSeq { (label == x.label) && (attributes == x.attributes) && // (scope == x.scope) // note - original code didn't compare scopes so I left it as is. - (nonEmptyChildren sameElements x.nonEmptyChildren) + nonEmptyChildren.sameElements(x.nonEmptyChildren) case _ => false } @@ -185,10 +185,10 @@ abstract class Node extends NodeSeq { */ def nameToString(sb: StringBuilder): StringBuilder = { if (null != prefix) { - sb append prefix - sb append ':' + sb.append(prefix) + sb.append(':') } - sb append label + sb.append(label) } /** diff --git a/shared/src/main/scala/scala/xml/NodeBuffer.scala b/shared/src/main/scala/scala/xml/NodeBuffer.scala index 363f2dea5..c379fd7f5 100644 --- a/shared/src/main/scala/scala/xml/NodeBuffer.scala +++ b/shared/src/main/scala/scala/xml/NodeBuffer.scala @@ -38,7 +38,7 @@ class NodeBuffer extends scala.collection.mutable.ArrayBuffer[Node] with ScalaVe def &+(o: Any): NodeBuffer = { o match { case null | _: Unit | Text("") => // ignore - case it: Iterator[_] => it foreach &+ + case it: Iterator[_] => it.foreach(&+) case n: Node => super.+=(n) case ns: Iterable[_] => this &+ ns.iterator case ns: Array[_] => this &+ ns.iterator diff --git a/shared/src/main/scala/scala/xml/NodeSeq.scala b/shared/src/main/scala/scala/xml/NodeSeq.scala index 0691ae74b..26880d266 100644 --- a/shared/src/main/scala/scala/xml/NodeSeq.scala +++ b/shared/src/main/scala/scala/xml/NodeSeq.scala @@ -37,7 +37,7 @@ object NodeSeq { implicit def canBuildFrom: CBF[Coll, Node, NodeSeq] = ScalaVersionSpecific.NodeSeqCBF // --- - def newBuilder: mutable.Builder[Node, NodeSeq] = new mutable.ListBuffer[Node] mapResult fromSeq + def newBuilder: mutable.Builder[Node, NodeSeq] = new mutable.ListBuffer[Node].mapResult(fromSeq) implicit def seqToNodeSeq(s: Seq[Node]): NodeSeq = fromSeq(s) } @@ -59,7 +59,7 @@ abstract class NodeSeq extends AbstractSeq[Node] with immutable.Seq[Node] with S val these: Iterator[Node] = this.iterator val those: Iterator[A] = that.iterator while (these.hasNext && those.hasNext) - if (these.next() xml_!= those.next()) + if (these.next().xml_!=(those.next())) return false !these.hasNext && !those.hasNext @@ -73,7 +73,7 @@ abstract class NodeSeq extends AbstractSeq[Node] with immutable.Seq[Node] with S } override def strict_==(other: Equality): Boolean = other match { - case x: NodeSeq => (length == x.length) && (theSeq sameElements x.theSeq) + case x: NodeSeq => (length == x.length) && theSeq.sameElements(x.theSeq) case _ => false } @@ -100,12 +100,12 @@ abstract class NodeSeq extends AbstractSeq[Node] with immutable.Seq[Node] with S val attr: Option[Seq[Node]] = if (that.length == 1) fail else if (that(1) == '{') { - val i: Int = that indexOf '}' + val i: Int = that.indexOf('}') if (i == -1) fail val (uri: String, key: String) = (that.substring(2, i), that.substring(i + 1, that.length)) if (uri == "" || key == "") fail else y.attribute(uri, key) - } else y.attribute(that drop 1) + } else y.attribute(that.drop(1)) attr match { case Some(x) => Group(x) @@ -114,7 +114,7 @@ abstract class NodeSeq extends AbstractSeq[Node] with immutable.Seq[Node] with S } def makeSeq(cond: Node => Boolean): NodeSeq = - NodeSeq fromSeq (this flatMap (_.child) filter cond) + NodeSeq.fromSeq(this.flatMap(_.child).filter(cond)) that match { case "" => fail @@ -144,11 +144,11 @@ abstract class NodeSeq extends AbstractSeq[Node] with immutable.Seq[Node] with S */ def \\(that: String): NodeSeq = { def fail: Nothing = throw new IllegalArgumentException(that) - def filt(cond: Node => Boolean): NodeSeq = this flatMap (_.descendant_or_self) filter cond + def filt(cond: Node => Boolean): NodeSeq = this.flatMap(_.descendant_or_self).filter(cond) that match { case "" => fail case "_" => filt(!_.isAtom) - case _ if that(0) == '@' => filt(!_.isAtom) flatMap (_ \ that) + case _ if that(0) == '@' => filt(!_.isAtom).flatMap(_ \ that) case _ => filt(x => !x.isAtom && x.label == that) } } @@ -161,5 +161,5 @@ abstract class NodeSeq extends AbstractSeq[Node] with immutable.Seq[Node] with S override def toString: String = theSeq.mkString - def text: String = (this map (_.text)).mkString + def text: String = this.map(_.text).mkString } diff --git a/shared/src/main/scala/scala/xml/PCData.scala b/shared/src/main/scala/scala/xml/PCData.scala index 372630ddc..7f21f6514 100644 --- a/shared/src/main/scala/scala/xml/PCData.scala +++ b/shared/src/main/scala/scala/xml/PCData.scala @@ -30,7 +30,7 @@ class PCData(data: String) extends Atom[String](data) { * @return the input string buffer with the formatted CDATA section */ override def buildString(sb: StringBuilder): StringBuilder = - sb append "".format(data.replaceAll("]]>", "]]]]>")) + sb.append("".format(data.replaceAll("]]>", "]]]]>"))) } /** diff --git a/shared/src/main/scala/scala/xml/PrefixedAttribute.scala b/shared/src/main/scala/scala/xml/PrefixedAttribute.scala index fcbeaccf4..90acf84a7 100644 --- a/shared/src/main/scala/scala/xml/PrefixedAttribute.scala +++ b/shared/src/main/scala/scala/xml/PrefixedAttribute.scala @@ -29,11 +29,11 @@ class PrefixedAttribute( override val value: Seq[Node], val next1: MetaData) extends Attribute { - override val next: MetaData = if (value ne null) next1 else next1.remove(key) + override val next: MetaData = if (value.ne(null)) next1 else next1.remove(key) /** same as this(pre, key, Text(value), next), or no attribute if value is null */ def this(pre: String, key: String, value: String, next: MetaData) = - this(pre, key, if (value ne null) Text(value) else null: NodeSeq, next) + this(pre, key, if (value.ne(null)) Text(value) else null: NodeSeq, next) /** same as this(pre, key, value.get, next), or no attribute if value is None */ def this(pre: String, key: String, value: Option[Seq[Node]], next: MetaData) = diff --git a/shared/src/main/scala/scala/xml/PrettyPrinter.scala b/shared/src/main/scala/scala/xml/PrettyPrinter.scala index a02369d44..dbc3d8111 100755 --- a/shared/src/main/scala/scala/xml/PrettyPrinter.scala +++ b/shared/src/main/scala/scala/xml/PrettyPrinter.scala @@ -59,7 +59,7 @@ class PrettyPrinter(width: Int, step: Int, minimizeEmpty: Boolean) { val tmp: Int = width - cur if (s.length <= tmp) return List(Box(ind, s)) - var i: Int = s indexOf ' ' + var i: Int = s.indexOf(' ') if (i > tmp || i == -1) throw new BrokenException() // cannot break var last: List[Int] = Nil @@ -87,7 +87,7 @@ class PrettyPrinter(width: Int, step: Int, minimizeEmpty: Boolean) { if (cur + s.length > width) { // fits in this line items ::= Box(ind, s) cur += s.length - } else try cut(s, ind) foreach (items ::= _) // break it up + } else try cut(s, ind).foreach(items ::= _) // break it up catch { case _: BrokenException => makePara(ind, s) } // give up, para // dont respect indent in para, but afterwards @@ -104,10 +104,10 @@ class PrettyPrinter(width: Int, step: Int, minimizeEmpty: Boolean) { protected def leafTag(n: Node): String = { def mkLeaf(sb: StringBuilder): Unit = { - sb append '<' - n nameToString sb - n.attributes buildString sb - sb append "/>" + sb.append('<') + n.nameToString(sb) + n.attributes.buildString(sb) + sb.append("/>") } sbToString(mkLeaf) } @@ -115,21 +115,21 @@ class PrettyPrinter(width: Int, step: Int, minimizeEmpty: Boolean) { protected def startTag(n: Node, pscope: NamespaceBinding): (String, Int) = { var i: Int = 0 def mkStart(sb: StringBuilder): Unit = { - sb append '<' - n nameToString sb + sb.append('<') + n.nameToString(sb) i = sb.length + 1 - n.attributes buildString sb + n.attributes.buildString(sb) n.scope.buildString(sb, pscope) - sb append '>' + sb.append('>') } (sbToString(mkStart), i) } protected def endTag(n: Node): String = { def mkEnd(sb: StringBuilder): Unit = { - sb append "' + sb.append("') } sbToString(mkEnd) } @@ -139,7 +139,7 @@ class PrettyPrinter(width: Int, step: Int, minimizeEmpty: Boolean) { case _: Atom[_] | _: Comment | _: EntityRef | _: ProcInstr => true case _ => false } - n.child forall isLeaf + n.child.forall(isLeaf) } protected def fits(test: String): Boolean = @@ -236,20 +236,20 @@ class PrettyPrinter(width: Int, step: Int, minimizeEmpty: Boolean) { lastwasbreak = true cur = 0 // while (cur < last) { - // sb append ' ' + // sb.append(' ') // cur += 1 // } case Box(i, s) => lastwasbreak = false while (cur < i) { - sb append ' ' + sb.append(' ') cur += 1 } sb.append(s) case Para(s) => lastwasbreak = false - sb append s + sb.append(s) } } @@ -284,5 +284,5 @@ class PrettyPrinter(width: Int, step: Int, minimizeEmpty: Boolean) { * @param sb the string buffer to which to append to */ def formatNodes(nodes: Seq[Node], pscope: NamespaceBinding, sb: StringBuilder): Unit = - nodes foreach (n => sb append format(n, pscope)) + nodes.foreach(n => sb.append(format(n, pscope))) } diff --git a/shared/src/main/scala/scala/xml/ProcInstr.scala b/shared/src/main/scala/scala/xml/ProcInstr.scala index 7dbdab978..67833e097 100644 --- a/shared/src/main/scala/scala/xml/ProcInstr.scala +++ b/shared/src/main/scala/scala/xml/ProcInstr.scala @@ -23,7 +23,7 @@ package xml case class ProcInstr(target: String, proctext: String) extends SpecialNode { if (!Utility.isName(target)) throw new IllegalArgumentException(target + " must be an XML Name") - if (proctext contains "?>") + if (proctext.contains("?>")) throw new IllegalArgumentException(proctext + " may not contain \"?>\"") if (target.toLowerCase == "xml") throw new IllegalArgumentException(target + " is reserved") @@ -39,5 +39,5 @@ case class ProcInstr(target: String, proctext: String) extends SpecialNode { * to this stringbuffer. */ override def buildString(sb: StringBuilder): StringBuilder = - sb append "".format(target, if (proctext == "") "" else " " + proctext) + sb.append("".format(target, if (proctext == "") "" else " " + proctext)) } diff --git a/shared/src/main/scala/scala/xml/TextBuffer.scala b/shared/src/main/scala/scala/xml/TextBuffer.scala index fc9e8ba9a..a56fde475 100644 --- a/shared/src/main/scala/scala/xml/TextBuffer.scala +++ b/shared/src/main/scala/scala/xml/TextBuffer.scala @@ -17,7 +17,7 @@ import scala.collection.Seq import Utility.isSpace object TextBuffer { - def fromString(str: String): TextBuffer = new TextBuffer() append str + def fromString(str: String): TextBuffer = new TextBuffer().append(str) } /** @@ -33,9 +33,9 @@ class TextBuffer { * Appends this string to the text buffer, trimming whitespaces as needed. */ def append(cs: Seq[Char]): this.type = { - cs foreach { c => - if (!isSpace(c)) sb append c - else if (sb.isEmpty || !isSpace(sb.last)) sb append ' ' + cs.foreach { c => + if (!isSpace(c)) sb.append(c) + else if (sb.isEmpty || !isSpace(sb.last)) sb.append(' ') } this } diff --git a/shared/src/main/scala/scala/xml/Unparsed.scala b/shared/src/main/scala/scala/xml/Unparsed.scala index 0781018a1..019bb4cf1 100644 --- a/shared/src/main/scala/scala/xml/Unparsed.scala +++ b/shared/src/main/scala/scala/xml/Unparsed.scala @@ -27,7 +27,7 @@ class Unparsed(data: String) extends Atom[String](data) { * specification. */ override def buildString(sb: StringBuilder): StringBuilder = - sb append data + sb.append(data) } /** diff --git a/shared/src/main/scala/scala/xml/UnprefixedAttribute.scala b/shared/src/main/scala/scala/xml/UnprefixedAttribute.scala index c33e5587f..fab4e1632 100644 --- a/shared/src/main/scala/scala/xml/UnprefixedAttribute.scala +++ b/shared/src/main/scala/scala/xml/UnprefixedAttribute.scala @@ -26,11 +26,11 @@ class UnprefixedAttribute( next1: MetaData) extends Attribute { final override val pre: scala.Null = null - override val next: MetaData = if (value ne null) next1 else next1.remove(key) + override val next: MetaData = if (value.ne(null)) next1 else next1.remove(key) /** same as this(key, Text(value), next), or no attribute if value is null */ def this(key: String, value: String, next: MetaData) = - this(key, if (value ne null) Text(value) else null: NodeSeq, next) + this(key, if (value.ne(null)) Text(value) else null: NodeSeq, next) /** same as this(key, value.get, next), or no attribute if value is None */ def this(key: String, value: Option[Seq[Node]], next: MetaData) = diff --git a/shared/src/main/scala/scala/xml/Utility.scala b/shared/src/main/scala/scala/xml/Utility.scala index 07d40154d..a1c6fd998 100755 --- a/shared/src/main/scala/scala/xml/Utility.scala +++ b/shared/src/main/scala/scala/xml/Utility.scala @@ -76,11 +76,11 @@ object Utility extends AnyRef with parsing.TokenTests { } /** returns a sorted attribute list */ - def sort(md: MetaData): MetaData = if ((md eq Null) || (md.next eq Null)) md else { + def sort(md: MetaData): MetaData = if (md.eq(Null) || md.next.eq(Null)) md else { val key: String = md.key val smaller: MetaData = sort(md.filter { m => m.key < key }) val greater: MetaData = sort(md.filter { m => m.key > key }) - smaller.foldRight (md copy greater) ((x, xs) => x copy xs) + smaller.foldRight(md.copy(greater)) ((x, xs) => x.copy(xs)) } /** @@ -89,7 +89,7 @@ object Utility extends AnyRef with parsing.TokenTests { */ def sort(n: Node): Node = n match { case Elem(pre, lab, md, scp, child@_*) => - val children: Seq[Node] = child map sort + val children: Seq[Node] = child.map(sort) Elem(pre, lab, sort(md), scp, children.isEmpty, children: _*) case _ => n } @@ -111,7 +111,7 @@ object Utility extends AnyRef with parsing.TokenTests { "quot" -> '"', "apos" -> '\'' ) - val escMap: Map[Char, String] = (pairs - "apos") map { case (s, c) => c -> ("&%s;" format s) } + val escMap: Map[Char, String] = (pairs - "apos").map { case (s, c) => c -> "&%s;".format(s) } val unescMap: Map[String, Char] = pairs } import Escapes.{ escMap, unescMap } @@ -138,7 +138,7 @@ object Utility extends AnyRef with parsing.TokenTests { * @return `'''null'''` if `ref` was not a predefined entity. */ final def unescape(ref: String, s: StringBuilder): StringBuilder = - ((unescMap get ref) map (s append _)).orNull + unescMap.get(ref).map(s.append).orNull /** * Returns a set of all namespaces used in a sequence of nodes @@ -190,10 +190,10 @@ object Utility extends AnyRef with parsing.TokenTests { stripComments: Boolean = false, decodeEntities: Boolean = true, preserveWhitespace: Boolean = false, - minimizeTags: Boolean = false): StringBuilder = - { - serialize(x, pscope, sb, stripComments, decodeEntities, preserveWhitespace, if (minimizeTags) MinimizeMode.Always else MinimizeMode.Never) - } + minimizeTags: Boolean = false + ): StringBuilder = { + serialize(x, pscope, sb, stripComments, decodeEntities, preserveWhitespace, if (minimizeTags) MinimizeMode.Always else MinimizeMode.Never) + } /** * Serialize an XML Node to a StringBuilder. @@ -210,35 +210,35 @@ object Utility extends AnyRef with parsing.TokenTests { stripComments: Boolean = false, decodeEntities: Boolean = true, preserveWhitespace: Boolean = false, - minimizeTags: MinimizeMode.Value = MinimizeMode.Default): StringBuilder = - { - x match { - case c: Comment => if (!stripComments) c buildString sb; sb - case s: SpecialNode => s buildString sb - case g: Group => - for (c <- g.nodes) serialize(c, g.scope, sb, stripComments, decodeEntities, preserveWhitespace, minimizeTags); sb - case el: Elem => - // print tag with namespace declarations - sb.append('<') + minimizeTags: MinimizeMode.Value = MinimizeMode.Default + ): StringBuilder = { + x match { + case c: Comment => if (!stripComments) c.buildString(sb); sb + case s: SpecialNode => s.buildString(sb) + case g: Group => + for (c <- g.nodes) serialize(c, g.scope, sb, stripComments, decodeEntities, preserveWhitespace, minimizeTags); sb + case el: Elem => + // print tag with namespace declarations + sb.append('<') + el.nameToString(sb) + if (el.attributes.ne(null)) el.attributes.buildString(sb) + el.scope.buildString(sb, pscope) + if (el.child.isEmpty && + (minimizeTags == MinimizeMode.Always || + (minimizeTags == MinimizeMode.Default && el.minimizeEmpty))) { + // no children, so use short form: + sb.append("/>") + } else { + // children, so use long form: ... + sb.append('>') + sequenceToXML(el.child, el.scope, sb, stripComments, decodeEntities, preserveWhitespace, minimizeTags) + sb.append(" - sb.append("/>") - } else { - // children, so use long form: ... - sb.append('>') - sequenceToXML(el.child, el.scope, sb, stripComments, decodeEntities, preserveWhitespace, minimizeTags) - sb.append("') - } - case _ => throw new IllegalArgumentException("Don't know how to serialize a " + x.getClass.getName) - } + sb.append('>') + } + case _ => throw new IllegalArgumentException("Don't know how to serialize a " + x.getClass.getName) } + } def sequenceToXML( children: Seq[Node], @@ -248,20 +248,19 @@ object Utility extends AnyRef with parsing.TokenTests { decodeEntities: Boolean = true, preserveWhitespace: Boolean = false, minimizeTags: MinimizeMode.Value = MinimizeMode.Default - ): Unit = - { - if (children.isEmpty) () - else if (children forall isAtomAndNotText) { // add space - val it: Iterator[Node] = children.iterator - val f: Node = it.next() - serialize(f, pscope, sb, stripComments, decodeEntities, preserveWhitespace, minimizeTags) - while (it.hasNext) { - val x: Node = it.next() - sb.append(' ') - serialize(x, pscope, sb, stripComments, decodeEntities, preserveWhitespace, minimizeTags) - } - } else children foreach { serialize(_, pscope, sb, stripComments, decodeEntities, preserveWhitespace, minimizeTags) } - } + ): Unit = { + if (children.isEmpty) () + else if (children.forall(isAtomAndNotText)) { // add space + val it: Iterator[Node] = children.iterator + val f: Node = it.next() + serialize(f, pscope, sb, stripComments, decodeEntities, preserveWhitespace, minimizeTags) + while (it.hasNext) { + val x: Node = it.next() + sb.append(' ') + serialize(x, pscope, sb, stripComments, decodeEntities, preserveWhitespace, minimizeTags) + } + } else children.foreach { serialize(_, pscope, sb, stripComments, decodeEntities, preserveWhitespace, minimizeTags) } + } def splitName(name: String): (Option[String], String) = { val colon: Int = name.indexOf(':') @@ -287,7 +286,7 @@ object Utility extends AnyRef with parsing.TokenTests { * 's' otherwise. */ def appendQuoted(s: String, sb: StringBuilder): StringBuilder = { - val ch: Char = if (s contains '"') '\'' else '"' + val ch: Char = if (s.contains('"')) '\'' else '"' sb.append(ch).append(s).append(ch) } @@ -307,8 +306,8 @@ object Utility extends AnyRef with parsing.TokenTests { def getName(s: String, index: Int): String = { if (index >= s.length) null else { - val xs: String = s drop index - if (xs.nonEmpty && isNameStart(xs.head)) xs takeWhile isNameChar + val xs: String = s.drop(index) + if (xs.nonEmpty && isNameStart(xs.head)) xs.takeWhile(isNameChar) else "" } } @@ -325,7 +324,7 @@ object Utility extends AnyRef with parsing.TokenTests { return "< not allowed in attribute value" case '&' => val n: String = getName(value, i + 1) - if (n eq null) + if (n.eq(null)) return "malformed entity reference in attribute value [" + value + "]" i = i + n.length + 1 if (i >= value.length || value.charAt(i) != ';') @@ -353,8 +352,8 @@ object Utility extends AnyRef with parsing.TokenTests { val theChar: String = parseCharRef ({ () => c }, { () => c = it.next() }, { s => throw new RuntimeException(s) }, { s => throw new RuntimeException(s) }) sb.append(theChar) } else { - if (rfb eq null) rfb = new StringBuilder() - rfb append c + if (rfb.eq(null)) rfb = new StringBuilder() + rfb.append(c) c = it.next() while (c != ';') { rfb.append(c) @@ -372,7 +371,7 @@ object Utility extends AnyRef with parsing.TokenTests { case _ => } } - } else sb append c + } else sb.append(c) } if (sb.nonEmpty) { // flush buffer val x: Text = Text(sb.toString) diff --git a/shared/src/main/scala/scala/xml/XML.scala b/shared/src/main/scala/scala/xml/XML.scala index 1aad3139c..43135acf9 100755 --- a/shared/src/main/scala/scala/xml/XML.scala +++ b/shared/src/main/scala/scala/xml/XML.scala @@ -126,7 +126,7 @@ object XML extends XMLLoader[Elem] { ): Unit = { /* TODO: optimize by giving writer parameter to toXML*/ if (xmlDecl) w.write("\n") - if (doctype ne null) w.write(doctype.toString + "\n") + if (doctype.ne(null)) w.write(doctype.toString + "\n") w.write(Utility.serialize(node, minimizeTags = minimizeTags).toString) } } diff --git a/shared/src/main/scala/scala/xml/Xhtml.scala b/shared/src/main/scala/scala/xml/Xhtml.scala index 962a4d734..b30175eea 100644 --- a/shared/src/main/scala/scala/xml/Xhtml.scala +++ b/shared/src/main/scala/scala/xml/Xhtml.scala @@ -49,40 +49,40 @@ object Xhtml { stripComments: Boolean = false, decodeEntities: Boolean = false, preserveWhitespace: Boolean = false, - minimizeTags: Boolean = true): Unit = - { - def decode(er: EntityRef): StringBuilder = XhtmlEntities.entMap.get(er.entityName) match { - case Some(chr) if chr.toInt >= 128 => sb.append(chr) - case _ => er.buildString(sb) - } - def shortForm: Boolean = - minimizeTags && - (x.child == null || x.child.isEmpty) && - (minimizableElements contains x.label) + minimizeTags: Boolean = true + ): Unit = { + def decode(er: EntityRef): StringBuilder = XhtmlEntities.entMap.get(er.entityName) match { + case Some(chr) if chr.toInt >= 128 => sb.append(chr) + case _ => er.buildString(sb) + } + def shortForm: Boolean = + minimizeTags && + (x.child == null || x.child.isEmpty) && + minimizableElements.contains(x.label) - x match { - case c: Comment => if (!stripComments) c buildString sb - case er: EntityRef if decodeEntities => decode(er) - case x: SpecialNode => x buildString sb - case g: Group => - g.nodes foreach { toXhtml(_, x.scope, sb, stripComments, decodeEntities, preserveWhitespace, minimizeTags) } + x match { + case c: Comment => if (!stripComments) c.buildString(sb) + case er: EntityRef if decodeEntities => decode(er) + case x: SpecialNode => x.buildString(sb) + case g: Group => + g.nodes.foreach { toXhtml(_, x.scope, sb, stripComments, decodeEntities, preserveWhitespace, minimizeTags) } - case _ => - sb.append('<') - x.nameToString(sb) - if (x.attributes ne null) x.attributes.buildString(sb) - x.scope.buildString(sb, pscope) + case _ => + sb.append('<') + x.nameToString(sb) + if (x.attributes.ne(null)) x.attributes.buildString(sb) + x.scope.buildString(sb, pscope) - if (shortForm) sb.append(" />") - else { - sb.append('>') - sequenceToXML(x.child, x.scope, sb, stripComments, decodeEntities, preserveWhitespace, minimizeTags) - sb.append("') - } - } + if (shortForm) sb.append(" />") + else { + sb.append('>') + sequenceToXML(x.child, x.scope, sb, stripComments, decodeEntities, preserveWhitespace, minimizeTags) + sb.append("') + } } + } /** * Amounts to calling toXhtml(node, ...) with the given parameters on each node. @@ -94,16 +94,16 @@ object Xhtml { stripComments: Boolean = false, decodeEntities: Boolean = false, preserveWhitespace: Boolean = false, - minimizeTags: Boolean = true): Unit = - { - if (children.isEmpty) - return + minimizeTags: Boolean = true + ): Unit = { + if (children.isEmpty) + return - val doSpaces: Boolean = children forall isAtomAndNotText // interleave spaces - for (c <- children.take(children.length - 1)) { - toXhtml(c, pscope, sb, stripComments, decodeEntities, preserveWhitespace, minimizeTags) - if (doSpaces) sb append ' ' - } - toXhtml(children.last, pscope, sb, stripComments, decodeEntities, preserveWhitespace, minimizeTags) + val doSpaces: Boolean = children.forall(isAtomAndNotText) // interleave spaces + for (c <- children.take(children.length - 1)) { + toXhtml(c, pscope, sb, stripComments, decodeEntities, preserveWhitespace, minimizeTags) + if (doSpaces) sb.append(' ') } + toXhtml(children.last, pscope, sb, stripComments, decodeEntities, preserveWhitespace, minimizeTags) + } } diff --git a/shared/src/main/scala/scala/xml/dtd/ContentModel.scala b/shared/src/main/scala/scala/xml/dtd/ContentModel.scala index ad944b0e9..b626bbf48 100644 --- a/shared/src/main/scala/scala/xml/dtd/ContentModel.scala +++ b/shared/src/main/scala/scala/xml/dtd/ContentModel.scala @@ -38,7 +38,7 @@ object ContentModel extends WordExp { } case class ElemName(name: String) extends Label { - override def toString: String = """ElemName("%s")""" format name + override def toString: String = """ElemName("%s")""".format(name) } def isMixed(cm: ContentModel): Boolean = cond(cm) { case _: MIXED => true } @@ -48,8 +48,8 @@ object ContentModel extends WordExp { def traverse(r: RegExp): Set[String] = r match { // !!! check for match translation problem case Letter(ElemName(name)) => Set(name) case Star(x@_) => traverse(x) // bug if x@_* - case Sequ(xs@_*) => Set(xs flatMap traverse: _*) - case Alt(xs@_*) => Set(xs flatMap traverse: _*) + case Sequ(xs@_*) => Set(xs.flatMap(traverse): _*) + case Alt(xs@_*) => Set(xs.flatMap(traverse): _*) } traverse(r) @@ -61,16 +61,16 @@ object ContentModel extends WordExp { private def buildString(rs: Seq[RegExp], sb: StringBuilder, sep: Char): Unit = { buildString(rs.head, sb) for (z <- rs.tail) { - sb append sep + sb.append(sep) buildString(z, sb) } } def buildString(c: ContentModel, sb: StringBuilder): StringBuilder = c match { - case ANY => sb append "ANY" - case EMPTY => sb append "EMPTY" - case PCDATA => sb append "(#PCDATA)" - case ELEMENTS(_) | MIXED(_) => c buildString sb + case ANY => sb.append("ANY") + case EMPTY => sb.append("EMPTY") + case PCDATA => sb.append("(#PCDATA)") + case ELEMENTS(_) | MIXED(_) => c.buildString(sb) } def buildString(r: RegExp, sb: StringBuilder): StringBuilder = @@ -118,11 +118,11 @@ case class MIXED(override val r: RegExp) extends DFAContentModel { import ContentModel.Alt override def buildString(sb: StringBuilder): StringBuilder = { - val newAlt: Alt = r match { case Alt(rs@_*) => Alt(rs drop 1: _*) } + val newAlt: Alt = r match { case Alt(rs@_*) => Alt(rs.drop(1): _*) } - sb append "(#PCDATA|" + sb.append("(#PCDATA|") ContentModel.buildString(newAlt: RegExp, sb) - sb append ")*" + sb.append(")*") } } diff --git a/shared/src/main/scala/scala/xml/dtd/Decl.scala b/shared/src/main/scala/scala/xml/dtd/Decl.scala index 08f4a8535..bbd7f022e 100644 --- a/shared/src/main/scala/scala/xml/dtd/Decl.scala +++ b/shared/src/main/scala/scala/xml/dtd/Decl.scala @@ -40,17 +40,17 @@ sealed abstract class MarkupDecl extends Decl { case class ElemDecl(name: String, contentModel: ContentModel) extends MarkupDecl { override def buildString(sb: StringBuilder): StringBuilder = { - sb append "' + sb.append('>') } } case class AttListDecl(name: String, attrs: List[AttrDecl]) extends MarkupDecl { override def buildString(sb: StringBuilder): StringBuilder = { - sb append "") + sb.append("")) } } @@ -63,8 +63,8 @@ case class AttrDecl(name: String, tpe: String, default: DefaultDecl) { override def toString: String = sbToString(buildString) def buildString(sb: StringBuilder): StringBuilder = { - sb append " " append name append ' ' append tpe append ' ' - default buildString sb + sb.append(" ").append(name).append(' ').append(tpe).append(' ') + default.buildString(sb) } } @@ -75,31 +75,31 @@ sealed abstract class EntityDecl extends MarkupDecl /** a parsed general entity declaration */ case class ParsedEntityDecl(name: String, entdef: EntityDef) extends EntityDecl { override def buildString(sb: StringBuilder): StringBuilder = { - sb append "' + sb.append("') } } /** a parameter entity declaration */ case class ParameterEntityDecl(name: String, entdef: EntityDef) extends EntityDecl { override def buildString(sb: StringBuilder): StringBuilder = { - sb append "' + sb.append("') } } /** an unparsed entity declaration */ case class UnparsedEntityDecl(name: String, extID: ExternalID, notation: String) extends EntityDecl { override def buildString(sb: StringBuilder): StringBuilder = { - sb append "' + sb.append("') } } /** a notation declaration */ case class NotationDecl(name: String, extID: ExternalID) extends MarkupDecl { override def buildString(sb: StringBuilder): StringBuilder = { - sb append " 1) sb.append('s') - allKeys foreach (k => sb append "'%s'".format(k)) + allKeys.foreach(k => sb.append("'%s'".format(k))) ValidationException(sb.toString) } diff --git a/shared/src/main/scala/scala/xml/dtd/impl/Base.scala b/shared/src/main/scala/scala/xml/dtd/impl/Base.scala index 8180459be..fa4e64929 100644 --- a/shared/src/main/scala/scala/xml/dtd/impl/Base.scala +++ b/shared/src/main/scala/scala/xml/dtd/impl/Base.scala @@ -38,7 +38,7 @@ private[dtd] abstract class Base { } class Alt private (val rs: _regexpT*) extends RegExp { - final override val isNullable: Boolean = rs exists (_.isNullable) + final override val isNullable: Boolean = rs.exists(_.isNullable) } object Sequ { @@ -48,7 +48,7 @@ private[dtd] abstract class Base { } class Sequ private (val rs: _regexpT*) extends RegExp { - final override val isNullable: Boolean = rs forall (_.isNullable) + final override val isNullable: Boolean = rs.forall(_.isNullable) } case class Star(r: _regexpT) extends RegExp { diff --git a/shared/src/main/scala/scala/xml/dtd/impl/BaseBerrySethi.scala b/shared/src/main/scala/scala/xml/dtd/impl/BaseBerrySethi.scala index 33d6e76d8..6a055bf81 100644 --- a/shared/src/main/scala/scala/xml/dtd/impl/BaseBerrySethi.scala +++ b/shared/src/main/scala/scala/xml/dtd/impl/BaseBerrySethi.scala @@ -42,12 +42,12 @@ private[dtd] abstract class BaseBerrySethi { final val emptySet: Set[Int] = Set() private def doComp(r: RegExp, compFunction: RegExp => Set[Int]): Set[Int] = r match { - case x: Alt => (x.rs map compFirst).foldLeft(emptySet)(_ ++ _) + case x: Alt => x.rs.map(compFirst).foldLeft(emptySet)(_ ++ _) case Eps => emptySet case x: Meta => compFunction(x.r) case x: Sequ => - val (l1: Seq[lang._regexpT], l2: Seq[lang._regexpT]) = x.rs span (_.isNullable) - ((l1 ++ (l2 take 1)) map compFunction).foldLeft(emptySet)(_ ++ _) + val (l1: Seq[lang._regexpT], l2: Seq[lang._regexpT]) = x.rs.span(_.isNullable) + (l1 ++ l2.take(1)).map(compFunction).foldLeft(emptySet)(_ ++ _) case Star(t) => compFunction(t) case _ => throw new IllegalArgumentException("unexpected pattern " + r.getClass) } @@ -98,8 +98,8 @@ private[dtd] abstract class BaseBerrySethi { */ protected def traverse(r: RegExp): Unit = r match { // (is tree automaton stuff, more than Berry-Sethi) - case x: Alt => x.rs foreach traverse - case x: Sequ => x.rs foreach traverse + case x: Alt => x.rs.foreach(traverse) + case x: Sequ => x.rs.foreach(traverse) case x: Meta => traverse(x.r) case Star(t) => traverse(t) case _ => throw new IllegalArgumentException("unexp pattern " + r.getClass) diff --git a/shared/src/main/scala/scala/xml/dtd/impl/DetWordAutom.scala b/shared/src/main/scala/scala/xml/dtd/impl/DetWordAutom.scala index 3b6b8663c..5eb986035 100644 --- a/shared/src/main/scala/scala/xml/dtd/impl/DetWordAutom.scala +++ b/shared/src/main/scala/scala/xml/dtd/impl/DetWordAutom.scala @@ -42,10 +42,10 @@ private[dtd] abstract class DetWordAutom[T <: AnyRef] { sb.append(map.toString) sb.append(" delta=\n") - for (i <- 0 until nstates) { - sb append "%d->%s\n".format(i, delta(i)) + for (i <- 0.until(nstates)) { + sb.append("%d->%s\n".format(i, delta(i))) if (i < default.length) - sb append "_>%s\n".format(default(i)) + sb.append("_>%s\n".format(default(i))) } sb.toString } diff --git a/shared/src/main/scala/scala/xml/dtd/impl/NondetWordAutom.scala b/shared/src/main/scala/scala/xml/dtd/impl/NondetWordAutom.scala index e12a72a2f..afa6c8ab9 100644 --- a/shared/src/main/scala/scala/xml/dtd/impl/NondetWordAutom.scala +++ b/shared/src/main/scala/scala/xml/dtd/impl/NondetWordAutom.scala @@ -39,10 +39,10 @@ private[dtd] abstract class NondetWordAutom[T <: AnyRef] { final def finalTag(state: Int): Int = finals(state) /** @return true if the set of states contains at least one final state */ - final def containsFinal(Q: immutable.BitSet): Boolean = Q exists isFinal + final def containsFinal(Q: immutable.BitSet): Boolean = Q.exists(isFinal) /** @return true if there are no accepting states */ - final def isEmpty: Boolean = (0 until nstates) forall (x => !isFinal(x)) + final def isEmpty: Boolean = 0.until(nstates).forall(x => !isFinal(x)) /** @return a immutable.BitSet with the next states for given state and label */ def next(q: Int, a: T): immutable.BitSet = delta(q).getOrElse(a, default(q)) @@ -54,11 +54,11 @@ private[dtd] abstract class NondetWordAutom[T <: AnyRef] { private def next(Q: immutable.BitSet, f: Int => immutable.BitSet): immutable.BitSet = Q.toSet.map(f).foldLeft(immutable.BitSet.empty)(_ ++ _) - private def finalStates: immutable.Seq[Int] = 0 until nstates filter isFinal + private def finalStates: immutable.Seq[Int] = 0.until(nstates).filter(isFinal) override def toString: String = { - val finalString: String = Map(finalStates map (j => j -> finals(j)): _*).toString - val deltaString: String = (0 until nstates) + val finalString: String = Map(finalStates.map(j => j -> finals(j)): _*).toString + val deltaString: String = 0.until(nstates) .map(i => " %d->%s\n _>%s\n".format(i, delta(i), default(i))).mkString "[NondetWordAutom nstates=%d finals=%s delta=\n%s".format(nstates, finalString, deltaString) diff --git a/shared/src/main/scala/scala/xml/dtd/impl/SubsetConstruction.scala b/shared/src/main/scala/scala/xml/dtd/impl/SubsetConstruction.scala index 7c73932a1..37eaea1ca 100644 --- a/shared/src/main/scala/scala/xml/dtd/impl/SubsetConstruction.scala +++ b/shared/src/main/scala/scala/xml/dtd/impl/SubsetConstruction.scala @@ -20,7 +20,7 @@ private[dtd] class SubsetConstruction[T <: AnyRef](val nfa: NondetWordAutom[T]) import nfa.labels def selectTag(Q: immutable.BitSet, finals: Array[Int]): Int = - (Q map finals filter (_ > 0)).min + Q.map(finals).filter(_ > 0).min def determinize: DetWordAutom[T] = { // for assigning numbers to bitsets @@ -42,7 +42,7 @@ private[dtd] class SubsetConstruction[T <: AnyRef](val nfa: NondetWordAutom[T]) rest = q0 :: sink :: rest def addFinal(q: immutable.BitSet): Unit = { - if (nfa containsFinal q) + if (nfa.containsFinal(q)) finals(q) = selectTag(q, nfa.finals) } def add(Q: immutable.BitSet): Unit = { @@ -67,7 +67,7 @@ private[dtd] class SubsetConstruction[T <: AnyRef](val nfa: NondetWordAutom[T]) val Pdelta: mutable.HashMap[T, immutable.BitSet] = new mutable.HashMap[T, immutable.BitSet] delta.update(P, Pdelta) - labels foreach { label => + labels.foreach { label => val Q: immutable.BitSet = nfa.next(P, label) Pdelta.update(label, Q) add(Q) @@ -102,7 +102,7 @@ private[dtd] class SubsetConstruction[T <: AnyRef](val nfa: NondetWordAutom[T]) defaultR(q) = qDef } - finals foreach { case (k, v) => finalsR(indexMap(k)) = v } + finals.foreach { case (k, v) => finalsR(indexMap(k)) = v } new DetWordAutom[T] { override val nstates: Int = nstatesR diff --git a/shared/src/main/scala/scala/xml/dtd/impl/WordBerrySethi.scala b/shared/src/main/scala/scala/xml/dtd/impl/WordBerrySethi.scala index 2692859af..3aee10a30 100644 --- a/shared/src/main/scala/scala/xml/dtd/impl/WordBerrySethi.scala +++ b/shared/src/main/scala/scala/xml/dtd/impl/WordBerrySethi.scala @@ -109,7 +109,7 @@ private[dtd] abstract class WordBerrySethi extends BaseBerrySethi { this.pos = 0 // determine "Sethi-length" of the regexp - subexpr foreach traverse + subexpr.foreach(traverse) this.initials = Set(0) } @@ -119,14 +119,14 @@ private[dtd] abstract class WordBerrySethi extends BaseBerrySethi { deltaq = new Array[mutable.HashMap[_labelT, List[Int]]](pos) // delta defaultq = new Array[List[Int]](pos) // default transitions - for (j <- 0 until pos) { + for (j <- 0.until(pos)) { deltaq(j) = mutable.HashMap[_labelT, List[Int]]() defaultq(j) = Nil } } protected def collectTransitions(): Unit = // make transitions - for (j <- 0 until pos; fol = follow(j); k <- fol) { + for (j <- 0.until(pos); fol = follow(j); k <- fol) { if (pos == k) finals = finals.updated(j, finalTag) else makeTransition(j, k, labelAt(k)) } @@ -149,14 +149,14 @@ private[dtd] abstract class WordBerrySethi extends BaseBerrySethi { finals = finals.updated(0, finalTag) val delta1: immutable.Map[Int, mutable.HashMap[lang._labelT, List[Int]]] = deltaq.zipWithIndex.map(_.swap).toMap - val finalsArr: Array[Int] = (0 until pos map (k => finals.getOrElse(k, 0))).toArray // 0 == not final + val finalsArr: Array[Int] = 0.until(pos).map(k => finals.getOrElse(k, 0)).toArray // 0 == not final val deltaArr: Array[mutable.Map[_labelT, immutable.BitSet]] = - (0 until pos map { x => - mutable.HashMap(delta1(x).toSeq map { case (k, v) => k -> immutable.BitSet(v: _*) }: _*) - }).toArray + 0.until(pos).map { x => + mutable.HashMap(delta1(x).toSeq.map { case (k, v) => k -> immutable.BitSet(v: _*) }: _*) + }.toArray - val defaultArr: Array[immutable.BitSet] = (0 until pos map (k => immutable.BitSet(defaultq(k): _*))).toArray + val defaultArr: Array[immutable.BitSet] = 0.until(pos).map(k => immutable.BitSet(defaultq(k): _*)).toArray new NondetWordAutom[_labelT] { override val nstates: Int = pos diff --git a/shared/src/main/scala/scala/xml/factory/NodeFactory.scala b/shared/src/main/scala/scala/xml/factory/NodeFactory.scala index 4f83c48b9..7f7a376fa 100644 --- a/shared/src/main/scala/scala/xml/factory/NodeFactory.scala +++ b/shared/src/main/scala/scala/xml/factory/NodeFactory.scala @@ -32,7 +32,7 @@ trait NodeFactory[A <: Node] { } def eqElements(ch1: Seq[Node], ch2: Seq[Node]): Boolean = - ch1.view.zipAll(ch2.view, null, null) forall { case (x, y) => x eq y } + ch1.view.zipAll(ch2.view, null, null).forall { case (x, y) => x.eq(y) } def nodeEquals(n: Node, pre: String, name: String, attrSeq: MetaData, scope: NamespaceBinding, children: Seq[Node]): Boolean = n.prefix == pre && diff --git a/shared/src/main/scala/scala/xml/include/sax/XIncludeFilter.scala b/shared/src/main/scala/scala/xml/include/sax/XIncludeFilter.scala index 3f0a382e7..0b8ab37c5 100644 --- a/shared/src/main/scala/scala/xml/include/sax/XIncludeFilter.scala +++ b/shared/src/main/scala/scala/xml/include/sax/XIncludeFilter.scala @@ -143,13 +143,13 @@ class XIncludeFilter extends XMLFilterImpl { throw new SAXException("Missing href attribute") } - var parse: String = atts getValue "parse" + var parse: String = atts.getValue("parse") if (parse == null) parse = "xml" - if (parse equals "text") { - val encoding: String = atts getValue "encoding" + if (parse.equals("text")) { + val encoding: String = atts.getValue("encoding") includeTextDocument(href, encoding) - } else if (parse equals "xml") { + } else if (parse.equals("xml")) { includeXMLDocument(href) } // Need to check this also in DOM and JDOM???? else { @@ -346,7 +346,7 @@ class XIncludeFilter extends XMLFilterImpl { // save old level and base val previousLevel: Int = level this.level = 0 - if (bases contains source) + if (bases.contains(source)) throw new SAXException( "Circular XInclude Reference", new CircularIncludeException("Circular XInclude Reference to " + source + getLocation) diff --git a/shared/src/main/scala/scala/xml/parsing/ExternalSources.scala b/shared/src/main/scala/scala/xml/parsing/ExternalSources.scala index f03ffa165..74e49c237 100644 --- a/shared/src/main/scala/scala/xml/parsing/ExternalSources.scala +++ b/shared/src/main/scala/scala/xml/parsing/ExternalSources.scala @@ -26,12 +26,12 @@ trait ExternalSources { self: ExternalSources with MarkupParser with MarkupHandler => def externalSource(systemId: String): Source = { - if (systemId startsWith "http:") - return Source fromURL new URL(systemId) + if (systemId.startsWith("http:")) + return Source.fromURL(new URL(systemId)) val fileStr: String = input.descr match { - case x if x startsWith "file:" => x drop 5 - case x => x take ((x lastIndexOf separator) + 1) + case x if x.startsWith("file:") => x.drop(5) + case x => x.take(x.lastIndexOf(separator) + 1) } Source.fromFile(fileStr + systemId) diff --git a/shared/src/main/scala/scala/xml/parsing/FactoryAdapter.scala b/shared/src/main/scala/scala/xml/parsing/FactoryAdapter.scala index 536d269f8..9c170b6e7 100644 --- a/shared/src/main/scala/scala/xml/parsing/FactoryAdapter.scala +++ b/shared/src/main/scala/scala/xml/parsing/FactoryAdapter.scala @@ -211,7 +211,7 @@ abstract class FactoryAdapter extends DefaultHandler2 with factory.XMLLoader[Nod } override def startPrefixMapping(prefix: String, uri: String): Unit = - prefixMappings ::= (prefix, uri) + prefixMappings ::= ((prefix, uri)) override def endPrefixMapping(prefix: String): Unit = () @@ -242,9 +242,9 @@ abstract class FactoryAdapter extends DefaultHandler2 with factory.XMLLoader[Nod if (scopeStack.isEmpty) TopScope else scopeStack.head - for (i <- (0 until attributes.getLength).reverse) { - val qname: String = attributes getQName i - val value: String = attributes getValue i + for (i <- 0.until(attributes.getLength).reverse) { + val qname: String = attributes.getQName(i) + val value: String = attributes.getValue(i) val (pre: Option[String], key: String) = Utility.splitName(qname) def nullIfEmpty(s: String): String = if (s == "") null else s @@ -316,9 +316,9 @@ abstract class FactoryAdapter extends DefaultHandler2 with factory.XMLLoader[Nod while (it.hasNext) { val c: Char = it.next() val isSpace: Boolean = c.isWhitespace - buffer append (if (isSpace) ' ' else c) + buffer.append(if (isSpace) ' ' else c) if (isSpace) - it = it dropWhile (_.isWhitespace) + it = it.dropWhile(_.isWhitespace) } } } diff --git a/shared/src/main/scala/scala/xml/parsing/MarkupHandler.scala b/shared/src/main/scala/scala/xml/parsing/MarkupHandler.scala index 505e5b00f..1628a75a1 100755 --- a/shared/src/main/scala/scala/xml/parsing/MarkupHandler.scala +++ b/shared/src/main/scala/scala/xml/parsing/MarkupHandler.scala @@ -40,9 +40,9 @@ abstract class MarkupHandler { def replacementText(entityName: String): Source = Source.fromString(ent.get(entityName) match { case Some(ParsedEntityDecl(_, IntDef(value))) => value - case Some(ParameterEntityDecl(_, IntDef(value))) => " %s " format value - case Some(_) => "" format entityName - case None => "" format entityName + case Some(ParameterEntityDecl(_, IntDef(value))) => " %s ".format(value) + case Some(_) => "".format(entityName) + case None => "".format(entityName) }) def endDTD(n: String): Unit = () diff --git a/shared/src/main/scala/scala/xml/parsing/MarkupParser.scala b/shared/src/main/scala/scala/xml/parsing/MarkupParser.scala index f62549bd1..3bd46c0c0 100755 --- a/shared/src/main/scala/scala/xml/parsing/MarkupParser.scala +++ b/shared/src/main/scala/scala/xml/parsing/MarkupParser.scala @@ -202,7 +202,7 @@ trait MarkupParser extends MarkupParserCommon with TokenTests { if (m.length - n != 0) { val s: String = if (isProlog) "SDDecl? " else "" - reportSyntaxError("VersionInfo EncodingDecl? %sor '?>' expected!" format s) + reportSyntaxError("VersionInfo EncodingDecl? %sor '?>' expected!".format(s)) } (info_ver, info_enc, info_stdl) @@ -283,7 +283,7 @@ trait MarkupParser extends MarkupParserCommon with TokenTests { } /** append Unicode character to name buffer*/ - protected def putChar(c: Char): StringBuilder = cbuf append c + protected def putChar(c: Char): StringBuilder = cbuf.append(c) /** * As the current code requires you to call nextch once manually @@ -480,7 +480,7 @@ trait MarkupParser extends MarkupParserCommon with TokenTests { val n: String = xName xToken(';') - if (unescape contains n) { + if (unescape.contains(n)) { handle.entityRef(tmppos, n) ts &+ unescape(n) } else push(n) @@ -523,7 +523,7 @@ trait MarkupParser extends MarkupParserCommon with TokenTests { */ def parseDTD(): Unit = { // dirty but fast var extID: ExternalID = null - if (this.dtd ne null) + if (this.dtd.ne(null)) reportSyntaxError("unexpected character (DOCTYPE already defined") xToken("DOCTYPE") xSpace() @@ -562,7 +562,7 @@ trait MarkupParser extends MarkupParserCommon with TokenTests { /*override val */ decls = handle.decls.reverse } //this.dtd.initializeEntities(); - if (doc ne null) + if (doc.ne(null)) doc.dtd = this.dtd handle.endDTD(n) diff --git a/shared/src/main/scala/scala/xml/parsing/MarkupParserCommon.scala b/shared/src/main/scala/scala/xml/parsing/MarkupParserCommon.scala index 2606b98ff..1f77c06fa 100644 --- a/shared/src/main/scala/scala/xml/parsing/MarkupParserCommon.scala +++ b/shared/src/main/scala/scala/xml/parsing/MarkupParserCommon.scala @@ -68,7 +68,7 @@ private[scala] trait MarkupParserCommon extends TokenTests { // well-formedness constraint if (ch == '<') reportSyntaxError("'<' not allowed in attrib value") else if (ch == SU) truncatedError("") - else buf append ch_returning_nextch + else buf.append(ch_returning_nextch) } ch_returning_nextch // @todo: normalize attribute value @@ -85,7 +85,7 @@ private[scala] trait MarkupParserCommon extends TokenTests { val buf: StringBuilder = new StringBuilder while (it.hasNext) it.next() match { case `end` => return buf.toString - case ch => buf append ch + case ch => buf.append(ch) } scala.sys.error("Expected '%s'".format(end)) } @@ -115,16 +115,16 @@ private[scala] trait MarkupParserCommon extends TokenTests { if (ch == SU) truncatedError("") else if (!isNameStart(ch)) - return errorAndResult("name expected, but char '%s' cannot start a name" format ch, "") + return errorAndResult("name expected, but char '%s' cannot start a name".format(ch), "") val buf: StringBuilder = new StringBuilder - while ({ buf append ch_returning_nextch + while ({ buf.append(ch_returning_nextch) ; isNameChar(ch)}) () if (buf.last == ':') { reportSyntaxError("name cannot end in ':'") - buf.toString dropRight 1 + buf.toString.dropRight(1) } else buf.toString } @@ -146,10 +146,9 @@ private[scala] trait MarkupParserCommon extends TokenTests { val buf: StringBuilder = new StringBuilder val it: BufferedIterator[Char] = attval.iterator.buffered - while (it.hasNext) buf append (it.next() match { + while (it.hasNext) buf.append(it.next() match { case ' ' | '\t' | '\n' | '\r' => " " - case '&' if it.head == '#' => - it.next(); xCharRef(it) + case '&' if it.head == '#' => it.next(); xCharRef(it) case '&' => attr_unescape(takeUntilChar(it, ';')) case c => c }) @@ -208,7 +207,7 @@ private[scala] trait MarkupParserCommon extends TokenTests { if (ch == that) nextch() else xHandleError(that, "'%s' expected instead of '%s'".format(that, ch)) } - def xToken(that: Seq[Char]): Unit = { that foreach xToken } + def xToken(that: Seq[Char]): Unit = that.foreach(xToken) /** scan [S] '=' [S]*/ def xEQ(): Unit = { xSpaceOpt(); xToken('='); xSpaceOpt() } @@ -251,7 +250,7 @@ private[scala] trait MarkupParserCommon extends TokenTests { else if (ch == SU || eof) truncatedError(s"died parsing until $until") // throws TruncatedXMLControl in compiler - sb append ch + sb.append(ch) nextch() } unreachable @@ -264,9 +263,9 @@ private[scala] trait MarkupParserCommon extends TokenTests { * and leave input unchanged. */ private def peek(lookingFor: String): Boolean = - (lookahead() take lookingFor.length sameElements lookingFor.iterator) && { + lookahead().take(lookingFor.length).sameElements(lookingFor.iterator) && { // drop the chars from the real reader (all lookahead + orig) - (0 to lookingFor.length) foreach (_ => nextch()) + 0.to(lookingFor.length).foreach(_ => nextch()) true } } diff --git a/shared/src/main/scala/scala/xml/parsing/TokenTests.scala b/shared/src/main/scala/scala/xml/parsing/TokenTests.scala index ec3ad851a..3875d4683 100644 --- a/shared/src/main/scala/scala/xml/parsing/TokenTests.scala +++ b/shared/src/main/scala/scala/xml/parsing/TokenTests.scala @@ -35,7 +35,7 @@ trait TokenTests { * (#x20 | #x9 | #xD | #xA)+ * }}} */ - final def isSpace(cs: Seq[Char]): Boolean = cs.nonEmpty && (cs forall isSpace) + final def isSpace(cs: Seq[Char]): Boolean = cs.nonEmpty && cs.forall(isSpace) /** These are 99% sure to be redundant but refactoring on the safe side. */ def isAlpha(c: Char): Boolean = (c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z') @@ -56,7 +56,7 @@ trait TokenTests { case COMBINING_SPACING_MARK | ENCLOSING_MARK | NON_SPACING_MARK | MODIFIER_LETTER | DECIMAL_DIGIT_NUMBER => true - case _ => ".-:·" contains ch + case _ => ".-:·".contains(ch) }) } @@ -88,11 +88,11 @@ trait TokenTests { * See [5] of XML 1.0 specification. */ def isName(s: String): Boolean = - s.nonEmpty && isNameStart(s.head) && (s.tail forall isNameChar) + s.nonEmpty && isNameStart(s.head) && s.tail.forall(isNameChar) def isPubIDChar(ch: Char): Boolean = isAlphaDigit(ch) || (isSpace(ch) && ch != '\u0009') || - ("""-\()+,./:=?;!*#@$_%""" contains ch) + """-\()+,./:=?;!*#@$_%""".contains(ch) /** * Returns `true` if the encoding name is a valid IANA encoding. @@ -103,12 +103,12 @@ trait TokenTests { * @param ianaEncoding The IANA encoding name. */ def isValidIANAEncoding(ianaEncoding: Seq[Char]): Boolean = { - def charOK(c: Char): Boolean = isAlphaDigit(c) || ("._-" contains c) + def charOK(c: Char): Boolean = isAlphaDigit(c) || "._-".contains(c) ianaEncoding.nonEmpty && isAlpha(ianaEncoding.head) && - (ianaEncoding.tail forall charOK) + ianaEncoding.tail.forall(charOK) } - def checkSysID(s: String): Boolean = List('"', '\'') exists (c => !(s contains c)) - def checkPubID(s: String): Boolean = s forall isPubIDChar + def checkSysID(s: String): Boolean = List('"', '\'').exists(c => !s.contains(c)) + def checkPubID(s: String): Boolean = s.forall(isPubIDChar) } diff --git a/shared/src/main/scala/scala/xml/transform/BasicTransformer.scala b/shared/src/main/scala/scala/xml/transform/BasicTransformer.scala index ebbc92a54..999fe4b75 100644 --- a/shared/src/main/scala/scala/xml/transform/BasicTransformer.scala +++ b/shared/src/main/scala/scala/xml/transform/BasicTransformer.scala @@ -37,7 +37,7 @@ abstract class BasicTransformer extends (Node => Node) { * otherwise a new sequence of concatenated results. */ def transform(ns: Seq[Node]): Seq[Node] = { - val changed: Seq[Node] = ns flatMap transform + val changed: Seq[Node] = ns.flatMap(transform) if (changed.length != ns.length || changed.zip(ns).exists(p => p._1 != p._2)) changed else ns } @@ -49,7 +49,7 @@ abstract class BasicTransformer extends (Node => Node) { val ch: Seq[Node] = n.child val nch: Seq[Node] = transform(ch) - if (ch eq nch) n + if (ch.eq(nch)) n else Elem(n.prefix, n.label, n.attributes, n.scope, nch.isEmpty, nch: _*) } else n diff --git a/shared/src/test/scala-2.x/scala/xml/XMLTest2x.scala b/shared/src/test/scala-2.x/scala/xml/XMLTest2x.scala index d7cb8b5e0..7ac8d5f4f 100644 --- a/shared/src/test/scala-2.x/scala/xml/XMLTest2x.scala +++ b/shared/src/test/scala-2.x/scala/xml/XMLTest2x.scala @@ -1,7 +1,5 @@ package scala.xml -import language.postfixOps - import org.junit.{Test => UnitTest} import org.junit.Assert.assertTrue import org.junit.Assert.assertEquals @@ -30,5 +28,4 @@ class XMLTest2x { assertTrue(f) assertTrue(g) } - } diff --git a/shared/src/test/scala/scala/xml/AttributeTest.scala b/shared/src/test/scala/scala/xml/AttributeTest.scala index bae4be959..908042660 100644 --- a/shared/src/test/scala/scala/xml/AttributeTest.scala +++ b/shared/src/test/scala/scala/xml/AttributeTest.scala @@ -19,9 +19,9 @@ class AttributeTest { val z: UnprefixedAttribute = new UnprefixedAttribute("foo", null:NodeSeq, x) assertEquals(None, z.get("foo")) - var appended: MetaData = x append x append x append x + var appended: MetaData = x.append(x).append(x).append(x) var len: Int = 0 - while (appended ne Null) { + while (appended.ne(Null)) { appended = appended.next len = len + 1 } diff --git a/shared/src/test/scala/scala/xml/PatternMatchingTest.scala b/shared/src/test/scala/scala/xml/PatternMatchingTest.scala index d2d809c93..829180e62 100644 --- a/shared/src/test/scala/scala/xml/PatternMatchingTest.scala +++ b/shared/src/test/scala/scala/xml/PatternMatchingTest.scala @@ -57,7 +57,7 @@ class PatternMatchingTest { object SafeNodeSeq { def unapplySeq(any: Any): Option[Seq[Node]] = any match { - case s: Seq[_] => Some(s flatMap { + case s: Seq[_] => Some(s.flatMap { case n: Node => n case _ => NodeSeq.Empty }) diff --git a/shared/src/test/scala/scala/xml/ShouldCompile.scala b/shared/src/test/scala/scala/xml/ShouldCompile.scala index 12c1e841b..df8a237da 100644 --- a/shared/src/test/scala/scala/xml/ShouldCompile.scala +++ b/shared/src/test/scala/scala/xml/ShouldCompile.scala @@ -26,8 +26,8 @@ class t2281B { var outstr: StringBuffer = new StringBuffer var prevspace: Boolean = false val ctext: String = text.replaceAll("\n+", "\n") - ctext foreach { c => - outstr append c + ctext.foreach { c => + outstr.append(c) if (c == '.' || c == '!' || c == '?' || c == '\n' || c == ':' || c == ';' || (prevspace && c == '-')) { outarr += outstr.toString outstr = new StringBuffer diff --git a/shared/src/test/scala/scala/xml/XMLSyntaxTest.scala b/shared/src/test/scala/scala/xml/XMLSyntaxTest.scala index 9f873abc3..83e6829bf 100644 --- a/shared/src/test/scala/scala/xml/XMLSyntaxTest.scala +++ b/shared/src/test/scala/scala/xml/XMLSyntaxTest.scala @@ -15,14 +15,14 @@ class XMLSyntaxTest { @Test def test1(): Unit = { val xNull: Elem = {null} // these used to be Atom(unit), changed to empty children - assertTrue(xNull.child sameElements Nil) + assertTrue(xNull.child.sameElements(Nil)) val x0: Elem = {} // these used to be Atom(unit), changed to empty children val x00: Elem = { } // dto. val xa: Elem = { "world" } - assertTrue(x0.child sameElements Nil) - assertTrue(x00.child sameElements Nil) + assertTrue(x0.child.sameElements(Nil)) + assertTrue(x00.child.sameElements(Nil)) assertEquals("world", handle[String](xa)) val xb: Elem = { 1.5 } diff --git a/shared/src/test/scala/scala/xml/XMLTest.scala b/shared/src/test/scala/scala/xml/XMLTest.scala index 3472e95ce..19d28c39b 100644 --- a/shared/src/test/scala/scala/xml/XMLTest.scala +++ b/shared/src/test/scala/scala/xml/XMLTest.scala @@ -1,7 +1,5 @@ package scala.xml -import language.postfixOps - import org.junit.{Test => UnitTest} import org.junit.Assert.assertTrue import org.junit.Assert.assertFalse @@ -31,8 +29,8 @@ class XMLTest { } val pelems_2: NodeSeq = NodeSeq.fromSeq(List(Text("38!"), Text("58!"))) - assertTrue(pelems_1 sameElements pelems_2) - assertTrue(Text("8") sameElements (p \\ "@bazValue")) + assertTrue(pelems_1.sameElements(pelems_2)) + assertTrue(Text("8").sameElements(p \\ "@bazValue")) } @UnitTest From 374237047a70147ec0ec09c15169de71ae9458cf Mon Sep 17 00:00:00 2001 From: Leonid Dubinsky Date: Mon, 19 Jun 2023 16:49:14 -0400 Subject: [PATCH 669/789] Added all missing type annotations. - introduced `ScalaVersionSpecificReturnTypes`; - split MIMA exclusions by Scala version; - removed exclusions that are no longer needed; - made Circle CI task names not mention the exact Scala version; - provisioned for Scala 2.13-specific code; - Scala 2.13- is only Scala 2.12 now that Scala 11 is no longer supported :) - marked classes used by the compiler. --- .circleci/config.yml | 30 ++++++------ build.sbt | 46 +++++++++++-------- .../scala/xml/ScalaVersionSpecific.scala | 1 + .../scala/xml/ScalaVersionSpecific.scala | 1 + .../xml/ScalaVersionSpecificReturnTypes.scala | 36 +++++++++++++++ .../xml/ScalaVersionSpecificReturnTypes.scala | 36 +++++++++++++++ .../src/main/scala/scala/xml/Attribute.scala | 2 +- shared/src/main/scala/scala/xml/Comment.scala | 1 + shared/src/main/scala/scala/xml/Elem.scala | 11 +++-- .../src/main/scala/scala/xml/EntityRef.scala | 1 + shared/src/main/scala/scala/xml/Group.scala | 3 +- .../src/main/scala/scala/xml/MetaData.scala | 1 + .../scala/scala/xml/NamespaceBinding.scala | 1 + shared/src/main/scala/scala/xml/Node.scala | 5 +- .../src/main/scala/scala/xml/NodeBuffer.scala | 1 + shared/src/main/scala/scala/xml/Null.scala | 19 ++++---- shared/src/main/scala/scala/xml/PCData.scala | 2 + .../scala/scala/xml/PrefixedAttribute.scala | 3 +- .../src/main/scala/scala/xml/ProcInstr.scala | 1 + shared/src/main/scala/scala/xml/QNode.scala | 3 +- .../main/scala/scala/xml/SpecialNode.scala | 2 +- shared/src/main/scala/scala/xml/Text.scala | 2 + .../src/main/scala/scala/xml/Unparsed.scala | 1 + .../scala/scala/xml/UnprefixedAttribute.scala | 3 +- .../main/scala/scala/xml/dtd/ExternalID.scala | 6 +-- .../xml/parsing/MarkupParserCommon.scala | 1 + 26 files changed, 161 insertions(+), 58 deletions(-) rename shared/src/main/{scala-2.13- => scala-2.12}/scala/xml/ScalaVersionSpecific.scala (95%) create mode 100644 shared/src/main/scala-2/scala/xml/ScalaVersionSpecificReturnTypes.scala create mode 100644 shared/src/main/scala-3/scala/xml/ScalaVersionSpecificReturnTypes.scala diff --git a/.circleci/config.yml b/.circleci/config.yml index 63248b6a8..02ee2b509 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -92,56 +92,56 @@ workflows: build: jobs: - scala_job: - name: 2.12.18 + name: 2.12.x java_version: jdk8 scala_version: 2.12.18 - scala_job: - name: 2.13.11 + name: 2.13.x java_version: jdk8 scala_version: 2.13.11 - scala_job: - name: 3.3.0 + name: 3.x java_version: jdk8 scala_version: 3.3.0 - scala_job: - name: jdk11_2.12 + name: jdk11_2.12.x java_version: jdk11 scala_version: 2.12.18 - scala_job: - name: jdk11_2.13 + name: jdk11_2.13.x java_version: jdk11 scala_version: 2.13.11 - scala_job: - name: jdk11_3.1 + name: jdk11_3.x java_version: jdk11 scala_version: 3.3.0 - scala_job: - name: jdk17_2.12 + name: jdk17_2.12.x java_version: jdk17 scala_version: 2.12.18 - scala_job: - name: jdk17_2.13 + name: jdk17_2.13.x java_version: jdk17 scala_version: 2.13.11 - scala_job: - name: jdk17_3.3 + name: jdk17_3.x java_version: jdk17 scala_version: 3.3.0 - scalajs_job: - name: sjs1.0_2.12 + name: sjs1.0_2.12.x scala_version: 2.12.18 - scalajs_job: - name: sjs1.0_2.13 + name: sjs1.0_2.13.x scala_version: 2.13.11 - scalajs_job: - name: sjs1.0_3.3 + name: sjs1.0_3.x scala_version: 3.3.0 - scalanative_job: - name: native0.4_2.12 + name: native0.4_2.12.x scala_version: 2.12.18 - scalanative_job: - name: native0.4_2.13 + name: native0.4_2.13.x scala_version: 2.13.11 - scalanative_job: - name: native0.4_3 + name: native0.4_3.x scala_version: 3.3.0 diff --git a/build.sbt b/build.sbt index a195e9df6..a7b82237a 100644 --- a/build.sbt +++ b/build.sbt @@ -9,20 +9,20 @@ ThisBuild / licenses += (("Apache-2.0", url("https://www.apache.org/licenses/LIC ThisBuild / libraryDependencySchemes += "org.scala-js" %% "scalajs-library" % "semver-spec" ThisBuild / apiURL := Some(url("https://javadoc.io/doc/org.scala-lang.modules/scala-xml_2.13/")) -lazy val configSettings: Seq[Setting[_]] = Seq( +lazy val configSettings: Seq[Setting[?]] = Seq( unmanagedSourceDirectories ++= { unmanagedSourceDirectories.value.flatMap { dir => - val sv = scalaVersion.value - Seq( - CrossVersion.partialVersion(sv) match { - case Some((major, minor)) if major > 2 || (major == 2 && minor >= 13) => file(dir.getPath ++ "-2.13+") - case _ => file(dir.getPath ++ "-2.13-") - }, - CrossVersion.partialVersion(sv) match { - case Some((2, _)) => file(dir.getPath ++ "-2.x") - case _ => file(dir.getPath ++ "-3.x") - } - ) + def forVersion(version: String): File = file(dir.getPath ++ "-" ++ version) + CrossVersion.partialVersion(scalaVersion.value) match { + case Some((3, _)) => Seq(forVersion("3"), forVersion("2.13+")) + case Some((2, minor)) => + Seq(forVersion("2")) ++ (minor match { + case 13 => Seq(forVersion("2.13"), forVersion("2.13+")) + case 12 => Seq(forVersion("2.12")) + case _ => Seq() + }) + case _ => Seq() + } } } ) @@ -65,13 +65,21 @@ lazy val xml = crossProject(JSPlatform, JVMPlatform, NativePlatform) versionPolicyIntention := Compatibility.BinaryCompatible, // Note: See discussion on non-JVM Mima in https://github.com/scala/scala-xml/pull/517 mimaBinaryIssueFilters ++= { - import com.typesafe.tools.mima.core._ - import com.typesafe.tools.mima.core.ProblemFilters._ - Seq( - // necessitated by the introduction of new abstract methods in FactoryAdapter: - exclude[ReversedMissingMethodProblem]("scala.xml.parsing.FactoryAdapter.createComment"), // see #549 - exclude[ReversedMissingMethodProblem]("scala.xml.parsing.FactoryAdapter.createPCData") // see #558 - ) + //import com.typesafe.tools.mima.core.{} + //import com.typesafe.tools.mima.core.ProblemFilters + Seq( // exclusions for all Scala versions + ) ++ (CrossVersion.partialVersion(scalaVersion.value) match { + case Some((3, _)) => Seq( // Scala 3-specific exclusions + ) + case Some((2, minor)) => Seq( // Scala 2-specific exclusions + ) ++ (minor match { + case 13 => Seq( // Scala 2.13-specific exclusions + ) + case 12 => Seq( // Scala 2.12-specific exclusions + ) + }) + case _ => Seq() + }) }, // Mima signature checking stopped working after 3.0.2 upgrade, see #557 mimaReportSignatureProblems := (CrossVersion.partialVersion(scalaVersion.value) match { diff --git a/shared/src/main/scala-2.13-/scala/xml/ScalaVersionSpecific.scala b/shared/src/main/scala-2.12/scala/xml/ScalaVersionSpecific.scala similarity index 95% rename from shared/src/main/scala-2.13-/scala/xml/ScalaVersionSpecific.scala rename to shared/src/main/scala-2.12/scala/xml/ScalaVersionSpecific.scala index 35d6d0e26..b74e3183c 100644 --- a/shared/src/main/scala-2.13-/scala/xml/ScalaVersionSpecific.scala +++ b/shared/src/main/scala-2.12/scala/xml/ScalaVersionSpecific.scala @@ -22,6 +22,7 @@ private[xml] object ScalaVersionSpecific { override def apply(from: Coll): mutable.Builder[Node, NodeSeq] = NodeSeq.newBuilder override def apply(): mutable.Builder[Node, NodeSeq] = NodeSeq.newBuilder } + type SeqNodeUnapplySeq = scala.collection.Seq[Node] } private[xml] trait ScalaVersionSpecificNodeSeq extends SeqLike[Node, NodeSeq] { self: NodeSeq => diff --git a/shared/src/main/scala-2.13+/scala/xml/ScalaVersionSpecific.scala b/shared/src/main/scala-2.13+/scala/xml/ScalaVersionSpecific.scala index f2cdb817d..e08d9ad9f 100644 --- a/shared/src/main/scala-2.13+/scala/xml/ScalaVersionSpecific.scala +++ b/shared/src/main/scala-2.13+/scala/xml/ScalaVersionSpecific.scala @@ -24,6 +24,7 @@ private[xml] object ScalaVersionSpecific { def newBuilder(from: Coll): Builder[Node, NodeSeq] = NodeSeq.newBuilder def fromSpecific(from: Coll)(it: IterableOnce[Node]): NodeSeq = (NodeSeq.newBuilder ++= from).result() } + type SeqNodeUnapplySeq = scala.collection.immutable.Seq[Node] } private[xml] trait ScalaVersionSpecificNodeSeq diff --git a/shared/src/main/scala-2/scala/xml/ScalaVersionSpecificReturnTypes.scala b/shared/src/main/scala-2/scala/xml/ScalaVersionSpecificReturnTypes.scala new file mode 100644 index 000000000..22820dea9 --- /dev/null +++ b/shared/src/main/scala-2/scala/xml/ScalaVersionSpecificReturnTypes.scala @@ -0,0 +1,36 @@ +/* + * Scala (https://www.scala-lang.org) + * + * Copyright EPFL and Lightbend, Inc. + * + * Licensed under Apache License 2.0 + * (http://www.apache.org/licenses/LICENSE-2.0). + * + * See the NOTICE file distributed with this work for + * additional information regarding copyright ownership. + */ + +package scala.xml + +/* + Unlike other Scala-version-specific things, this class is not filling any gaps in capabilities + between different versions of Scala; instead, it mostly documents the types that different versions of the + Scala compiler inferred in the unfortunate absence of the explicit type annotations. + What should have been specified explicitly is given in the comments; + next time we break binary compatibility the types should be changed in the code and this class removed. + */ +private[xml] object ScalaVersionSpecificReturnTypes { // should be + type ExternalIDAttribute = MetaData // Null.type + type NoExternalIDId = scala.Null + type NodeNoAttributes = MetaData // Null.type + type NullFilter = MetaData // Null.type + type NullGetNamespace = scala.Null + type NullNext = scala.Null + type NullKey = scala.Null + type NullValue = scala.Null + type NullApply1 = scala.collection.Seq[Node] // scala.Null + type NullApply3 = scala.Null + type NullRemove = Null.type + type SpecialNodeChild = Nil.type + type GroupChild = Nothing +} diff --git a/shared/src/main/scala-3/scala/xml/ScalaVersionSpecificReturnTypes.scala b/shared/src/main/scala-3/scala/xml/ScalaVersionSpecificReturnTypes.scala new file mode 100644 index 000000000..8e7fcdfc0 --- /dev/null +++ b/shared/src/main/scala-3/scala/xml/ScalaVersionSpecificReturnTypes.scala @@ -0,0 +1,36 @@ +/* + * Scala (https://www.scala-lang.org) + * + * Copyright EPFL and Lightbend, Inc. + * + * Licensed under Apache License 2.0 + * (http://www.apache.org/licenses/LICENSE-2.0). + * + * See the NOTICE file distributed with this work for + * additional information regarding copyright ownership. + */ + +package scala.xml + +/* + Unlike other Scala-version-specific things, this class is not filling any gaps in capabilities + between different versions of Scala; instead, it mostly documents the types that different versions of the + Scala compiler inferred in the unfortunate absence of the explicit type annotations. + What should have been specified explicitly is given in the comments; + next time we break binary compatibility the types should be changed in the code and this class removed. + */ +private[xml] object ScalaVersionSpecificReturnTypes { // should be + type ExternalIDAttribute = MetaData // Null.type + type NoExternalIDId = String // scala.Null + type NodeNoAttributes = MetaData // Null.type + type NullFilter = MetaData // Null.type + type NullGetNamespace = String // scala.Null + type NullNext = MetaData // scala.Null + type NullKey = String // scala.Null + type NullValue = scala.collection.Seq[Node] // scala.Null + type NullApply1 = scala.collection.Seq[Node] // scala.Null + type NullApply3 = scala.collection.Seq[Node] // scala.Null + type NullRemove = MetaData // Null.type + type SpecialNodeChild = scala.collection.Seq[Node] // Nil.type + type GroupChild = scala.collection.Seq[Node] // Nothing +} diff --git a/shared/src/main/scala/scala/xml/Attribute.scala b/shared/src/main/scala/scala/xml/Attribute.scala index 26d079c11..9d2be60de 100644 --- a/shared/src/main/scala/scala/xml/Attribute.scala +++ b/shared/src/main/scala/scala/xml/Attribute.scala @@ -22,7 +22,7 @@ import scala.collection.Seq * @author Burak Emir */ object Attribute { - def unapply(x: Attribute) /* TODO type annotation */ = x match { + def unapply(x: Attribute): Option[(String, Seq[Node], MetaData)] = x match { case PrefixedAttribute(_, key, value, next) => Some((key, value, next)) case UnprefixedAttribute(key, value, next) => Some((key, value, next)) case _ => None diff --git a/shared/src/main/scala/scala/xml/Comment.scala b/shared/src/main/scala/scala/xml/Comment.scala index 1a0e05f4e..76d1be4a1 100644 --- a/shared/src/main/scala/scala/xml/Comment.scala +++ b/shared/src/main/scala/scala/xml/Comment.scala @@ -21,6 +21,7 @@ package xml * and the final character may not be `-` to prevent a closing span of `-->` * which is invalid. [[https://www.w3.org/TR/xml11//#IDA5CES]] */ +// Note: used by the Scala compiler. case class Comment(commentText: String) extends SpecialNode { override def label: String = "#REM" diff --git a/shared/src/main/scala/scala/xml/Elem.scala b/shared/src/main/scala/scala/xml/Elem.scala index db3adc391..bd420e53e 100755 --- a/shared/src/main/scala/scala/xml/Elem.scala +++ b/shared/src/main/scala/scala/xml/Elem.scala @@ -21,15 +21,17 @@ import scala.collection.Seq * any `Node` instance (that is not a `SpecialNode` or a `Group`) using the * syntax `case Elem(prefix, label, attribs, scope, child @ _*) => ...` */ +// Note: used by the Scala compiler. object Elem { def apply(prefix: String, label: String, attributes: MetaData, scope: NamespaceBinding, minimizeEmpty: Boolean, child: Node*): Elem = new Elem(prefix, label, attributes, scope, minimizeEmpty, child: _*) - def unapplySeq(n: Node) /* TODO type annotation */ = n match { - case _: SpecialNode | _: Group => None - case _ => Some((n.prefix, n.label, n.attributes, n.scope, n.child.toSeq)) - } + def unapplySeq(n: Node): Option[(String, String, MetaData, NamespaceBinding, ScalaVersionSpecific.SeqNodeUnapplySeq)] = + n match { + case _: SpecialNode | _: Group => None + case _ => Some((n.prefix, n.label, n.attributes, n.scope, n.child.toSeq)) + } } /** @@ -51,6 +53,7 @@ object Elem { * empty; `false` if it should be written out in long form. * @param child the children of this node */ +// Note: used by the Scala compiler. class Elem( override val prefix: String, override val label: String, diff --git a/shared/src/main/scala/scala/xml/EntityRef.scala b/shared/src/main/scala/scala/xml/EntityRef.scala index 38f20689a..07be3c5a3 100644 --- a/shared/src/main/scala/scala/xml/EntityRef.scala +++ b/shared/src/main/scala/scala/xml/EntityRef.scala @@ -19,6 +19,7 @@ package xml * @author Burak Emir * @param entityName the name of the entity reference, for example `amp`. */ +// Note: used by the Scala compiler. case class EntityRef(entityName: String) extends SpecialNode { final override def doCollectNamespaces: Boolean = false final override def doTransform: Boolean = false diff --git a/shared/src/main/scala/scala/xml/Group.scala b/shared/src/main/scala/scala/xml/Group.scala index c6280abda..b212899a7 100644 --- a/shared/src/main/scala/scala/xml/Group.scala +++ b/shared/src/main/scala/scala/xml/Group.scala @@ -20,6 +20,7 @@ import scala.collection.Seq * * @author Burak Emir */ +// Note: used by the Scala compiler. final case class Group(nodes: Seq[Node]) extends Node { override def theSeq: Seq[Node] = nodes @@ -44,6 +45,6 @@ final case class Group(nodes: Seq[Node]) extends Node { override def label: Nothing = fail("label") override def attributes: Nothing = fail("attributes") override def namespace: Nothing = fail("namespace") - override def child /* TODO type annotation */ = fail("child") + override def child: ScalaVersionSpecificReturnTypes.GroupChild = fail("child") def buildString(sb: StringBuilder): Nothing = fail("toString(StringBuilder)") } diff --git a/shared/src/main/scala/scala/xml/MetaData.scala b/shared/src/main/scala/scala/xml/MetaData.scala index 194307f53..9d621aa58 100644 --- a/shared/src/main/scala/scala/xml/MetaData.scala +++ b/shared/src/main/scala/scala/xml/MetaData.scala @@ -80,6 +80,7 @@ object MetaData { * Namespace URIs are obtained by using the namespace scope of the element * owning this attribute (see `getNamespace`). */ +// Note: used by the Scala compiler. abstract class MetaData extends AbstractIterable[MetaData] with Iterable[MetaData] diff --git a/shared/src/main/scala/scala/xml/NamespaceBinding.scala b/shared/src/main/scala/scala/xml/NamespaceBinding.scala index b02111149..6ddeb99ce 100644 --- a/shared/src/main/scala/scala/xml/NamespaceBinding.scala +++ b/shared/src/main/scala/scala/xml/NamespaceBinding.scala @@ -23,6 +23,7 @@ import scala.collection.Seq * * @author Burak Emir */ +// Note: used by the Scala compiler. @SerialVersionUID(0 - 2518644165573446725L) case class NamespaceBinding(prefix: String, uri: String, parent: NamespaceBinding) extends AnyRef with Equality { if (prefix == "") diff --git a/shared/src/main/scala/scala/xml/Node.scala b/shared/src/main/scala/scala/xml/Node.scala index 7cd3aaab4..ee7a9f50e 100755 --- a/shared/src/main/scala/scala/xml/Node.scala +++ b/shared/src/main/scala/scala/xml/Node.scala @@ -23,12 +23,13 @@ import scala.collection.Seq */ object Node { /** the constant empty attribute sequence */ - final def NoAttributes: MetaData = Null + final def NoAttributes: ScalaVersionSpecificReturnTypes.NodeNoAttributes = Null /** the empty namespace */ val EmptyNamespace: String = "" - def unapplySeq(n: Node) /* TODO type annotation */ = Some((n.label, n.attributes, n.child.toSeq)) + def unapplySeq(n: Node): Some[(String, MetaData, ScalaVersionSpecific.SeqNodeUnapplySeq)] = + Some((n.label, n.attributes, n.child.toSeq)) } /** diff --git a/shared/src/main/scala/scala/xml/NodeBuffer.scala b/shared/src/main/scala/scala/xml/NodeBuffer.scala index c379fd7f5..c6364226d 100644 --- a/shared/src/main/scala/scala/xml/NodeBuffer.scala +++ b/shared/src/main/scala/scala/xml/NodeBuffer.scala @@ -23,6 +23,7 @@ package xml * * @author Burak Emir */ +// Note: used by the Scala compiler. class NodeBuffer extends scala.collection.mutable.ArrayBuffer[Node] with ScalaVersionSpecificNodeBuffer { /** * Append given object to this buffer, returns reference on this diff --git a/shared/src/main/scala/scala/xml/Null.scala b/shared/src/main/scala/scala/xml/Null.scala index 7e057f4f9..0ece843a9 100644 --- a/shared/src/main/scala/scala/xml/Null.scala +++ b/shared/src/main/scala/scala/xml/Null.scala @@ -23,19 +23,20 @@ import scala.collection.Seq * * @author Burak Emir */ +// Note: used by the Scala compiler. case object Null extends MetaData { override def iterator: Iterator[Nothing] = Iterator.empty override def size: Int = 0 override def append(m: MetaData, scope: NamespaceBinding = TopScope): MetaData = m - override def filter(f: MetaData => Boolean): MetaData = this + override def filter(f: MetaData => Boolean): ScalaVersionSpecificReturnTypes.NullFilter = this override def copy(next: MetaData): MetaData = next - override def getNamespace(owner: Node) /* TODO type annotation */ = null + override def getNamespace(owner: Node): ScalaVersionSpecificReturnTypes.NullGetNamespace = null override def hasNext: Boolean = false - override def next /* TODO type annotation */ = null - override def key /* TODO type annotation */ = null - override def value /* TODO type annotation */ = null + override def next: ScalaVersionSpecificReturnTypes.NullNext = null + override def key: ScalaVersionSpecificReturnTypes.NullKey = null + override def value: ScalaVersionSpecificReturnTypes.NullValue = null override def isPrefixed: Boolean = false override def length: Int = 0 @@ -47,8 +48,8 @@ case object Null extends MetaData { } override protected def basisForHashCode: Seq[Any] = Nil - override def apply(namespace: String, scope: NamespaceBinding, key: String) /* TODO type annotation */ = null - override def apply(key: String) /* TODO type annotation */ = + override def apply(namespace: String, scope: NamespaceBinding, key: String): ScalaVersionSpecificReturnTypes.NullApply3 = null + override def apply(key: String): ScalaVersionSpecificReturnTypes.NullApply1 = if (Utility.isNameStart(key.head)) null else throw new IllegalArgumentException("not a valid attribute name '" + key + "', so can never match !") @@ -61,6 +62,6 @@ case object Null extends MetaData { override def wellformed(scope: NamespaceBinding): Boolean = true - override def remove(key: String) /* TODO type annotation */ = this - override def remove(namespace: String, scope: NamespaceBinding, key: String) /* TODO type annotation */ = this + override def remove(key: String): ScalaVersionSpecificReturnTypes.NullRemove = this + override def remove(namespace: String, scope: NamespaceBinding, key: String): ScalaVersionSpecificReturnTypes.NullRemove = this } diff --git a/shared/src/main/scala/scala/xml/PCData.scala b/shared/src/main/scala/scala/xml/PCData.scala index 7f21f6514..c5da01d7c 100644 --- a/shared/src/main/scala/scala/xml/PCData.scala +++ b/shared/src/main/scala/scala/xml/PCData.scala @@ -20,6 +20,7 @@ package xml * * @author Burak Emir */ +// Note: used by the Scala compiler (before Scala 3). class PCData(data: String) extends Atom[String](data) { /** @@ -39,6 +40,7 @@ class PCData(data: String) extends Atom[String](data) { * * @author Burak Emir */ +// Note: used by the Scala compiler (before Scala 3). object PCData { def apply(data: String): PCData = new PCData(data) def unapply(other: Any): Option[String] = other match { diff --git a/shared/src/main/scala/scala/xml/PrefixedAttribute.scala b/shared/src/main/scala/scala/xml/PrefixedAttribute.scala index 90acf84a7..bba655d59 100644 --- a/shared/src/main/scala/scala/xml/PrefixedAttribute.scala +++ b/shared/src/main/scala/scala/xml/PrefixedAttribute.scala @@ -23,6 +23,7 @@ import scala.collection.Seq * @param value the attribute value * @param next1 */ +// Note: used by the Scala compiler. class PrefixedAttribute( override val pre: String, override val key: String, @@ -64,5 +65,5 @@ class PrefixedAttribute( } object PrefixedAttribute { - def unapply(x: PrefixedAttribute) /* TODO type annotation */ = Some((x.pre, x.key, x.value, x.next)) + def unapply(x: PrefixedAttribute): Some[(String, String, Seq[Node], MetaData)] = Some((x.pre, x.key, x.value, x.next)) } diff --git a/shared/src/main/scala/scala/xml/ProcInstr.scala b/shared/src/main/scala/scala/xml/ProcInstr.scala index 67833e097..b2433ec87 100644 --- a/shared/src/main/scala/scala/xml/ProcInstr.scala +++ b/shared/src/main/scala/scala/xml/ProcInstr.scala @@ -20,6 +20,7 @@ package xml * @param target target name of this PI * @param proctext text contained in this node, may not contain "?>" */ +// Note: used by the Scala compiler. case class ProcInstr(target: String, proctext: String) extends SpecialNode { if (!Utility.isName(target)) throw new IllegalArgumentException(target + " must be an XML Name") diff --git a/shared/src/main/scala/scala/xml/QNode.scala b/shared/src/main/scala/scala/xml/QNode.scala index 9b1e56e26..c5128eb45 100644 --- a/shared/src/main/scala/scala/xml/QNode.scala +++ b/shared/src/main/scala/scala/xml/QNode.scala @@ -20,5 +20,6 @@ package xml * @author Burak Emir */ object QNode { - def unapplySeq(n: Node) /* TODO type annotation */ = Some((n.scope.getURI(n.prefix), n.label, n.attributes, n.child.toSeq)) + def unapplySeq(n: Node): Some[(String, String, MetaData, ScalaVersionSpecific.SeqNodeUnapplySeq)] = + Some((n.scope.getURI(n.prefix), n.label, n.attributes, n.child.toSeq)) } diff --git a/shared/src/main/scala/scala/xml/SpecialNode.scala b/shared/src/main/scala/scala/xml/SpecialNode.scala index 0569bc4ed..abb151de8 100644 --- a/shared/src/main/scala/scala/xml/SpecialNode.scala +++ b/shared/src/main/scala/scala/xml/SpecialNode.scala @@ -28,7 +28,7 @@ abstract class SpecialNode extends Node { final override def namespace: scala.Null = null /** always empty */ - final override def child /* TODO type annotation */ = Nil + final override def child: ScalaVersionSpecificReturnTypes.SpecialNodeChild = Nil /** Append string representation to the given string buffer argument. */ def buildString(sb: StringBuilder): StringBuilder diff --git a/shared/src/main/scala/scala/xml/Text.scala b/shared/src/main/scala/scala/xml/Text.scala index a2085b0f2..118cb48e2 100644 --- a/shared/src/main/scala/scala/xml/Text.scala +++ b/shared/src/main/scala/scala/xml/Text.scala @@ -20,6 +20,7 @@ package xml * @author Burak Emir * @param data the text contained in this node, may not be null. */ +// Note: used by the Scala compiler. class Text(data: String) extends Atom[String](data) { /** @@ -36,6 +37,7 @@ class Text(data: String) extends Atom[String](data) { * * @author Burak Emir */ +// Note: used by the Scala compiler. object Text { def apply(data: String): Text = new Text(data) def unapply(other: Any): Option[String] = other match { diff --git a/shared/src/main/scala/scala/xml/Unparsed.scala b/shared/src/main/scala/scala/xml/Unparsed.scala index 019bb4cf1..fc477313d 100644 --- a/shared/src/main/scala/scala/xml/Unparsed.scala +++ b/shared/src/main/scala/scala/xml/Unparsed.scala @@ -20,6 +20,7 @@ package xml * @author Burak Emir * @param data content in this node, may not be null. */ +// Note: used by the Scala compiler. class Unparsed(data: String) extends Atom[String](data) { /** diff --git a/shared/src/main/scala/scala/xml/UnprefixedAttribute.scala b/shared/src/main/scala/scala/xml/UnprefixedAttribute.scala index fab4e1632..86cf538e7 100644 --- a/shared/src/main/scala/scala/xml/UnprefixedAttribute.scala +++ b/shared/src/main/scala/scala/xml/UnprefixedAttribute.scala @@ -20,6 +20,7 @@ import scala.collection.Seq * * @author Burak Emir */ +// Note: used by the Scala compiler. class UnprefixedAttribute( override val key: String, override val value: Seq[Node], @@ -62,5 +63,5 @@ class UnprefixedAttribute( next(namespace, scope, key) } object UnprefixedAttribute { - def unapply(x: UnprefixedAttribute) /* TODO type annotation */ = Some((x.key, x.value, x.next)) + def unapply(x: UnprefixedAttribute): Some[(String, Seq[Node], MetaData)] = Some((x.key, x.value, x.next)) } diff --git a/shared/src/main/scala/scala/xml/dtd/ExternalID.scala b/shared/src/main/scala/scala/xml/dtd/ExternalID.scala index d1540f9b5..f2a5d40fc 100644 --- a/shared/src/main/scala/scala/xml/dtd/ExternalID.scala +++ b/shared/src/main/scala/scala/xml/dtd/ExternalID.scala @@ -73,7 +73,7 @@ case class PublicID(override val publicId: String, override val systemId: String def label: String = "#PI" /** always empty */ - def attribute: MetaData = Node.NoAttributes + def attribute: ScalaVersionSpecificReturnTypes.ExternalIDAttribute = Node.NoAttributes /** always empty */ def child: Nil.type = Nil @@ -85,8 +85,8 @@ case class PublicID(override val publicId: String, override val systemId: String * @author Michael Bayne */ object NoExternalID extends ExternalID { - override val publicId /* TODO type annotation */ = null - override val systemId /* TODO type annotation */ = null + override val publicId: ScalaVersionSpecificReturnTypes.NoExternalIDId = null + override val systemId: ScalaVersionSpecificReturnTypes.NoExternalIDId = null override def toString: String = "" } diff --git a/shared/src/main/scala/scala/xml/parsing/MarkupParserCommon.scala b/shared/src/main/scala/scala/xml/parsing/MarkupParserCommon.scala index 1f77c06fa..c30cc0e4b 100644 --- a/shared/src/main/scala/scala/xml/parsing/MarkupParserCommon.scala +++ b/shared/src/main/scala/scala/xml/parsing/MarkupParserCommon.scala @@ -22,6 +22,7 @@ import Utility.SU * between the library level XML parser and the compiler's. * All members should be accessed through those. */ +// Note: this is no longer true; Scala compiler uses its own copy since at least 2013. private[scala] trait MarkupParserCommon extends TokenTests { protected def unreachable: Nothing = truncatedError("Cannot be reached.") From 0203fae7ff1e370702a6efbc9b772564ee688946 Mon Sep 17 00:00:00 2001 From: Leonid Dubinsky Date: Wed, 7 Jun 2023 21:36:36 -0400 Subject: [PATCH 670/789] Capture more of the Document - handle Locator2, DTDHandler, DeclHandler, and LexicalHandler DTD and entity methods; - introduce DtdBuilder and delegate DTD methods to it; - introduce ElementContentModel and delegate parsing of the element content model in the DTD element declarations to it; - XMLLoader.loadDocument() returns baseURI, XML version, encoding and standAlone flag and DTD; - tests demonstrating the new returns; --- jvm/src/test/resources/scala/xml/utf16.xml | Bin 0 -> 92 bytes jvm/src/test/resources/scala/xml/utf8.xml | 2 + jvm/src/test/scala/scala/xml/XMLTest.scala | 179 +++++++++++++- shared/src/main/scala/scala/xml/dtd/DTD.scala | 2 +- .../src/main/scala/scala/xml/dtd/Decl.scala | 3 +- .../scala/scala/xml/factory/XMLLoader.scala | 12 +- .../scala/scala/xml/parsing/DtdBuilder.scala | 190 +++++++++++++++ .../xml/parsing/ElementContentModel.scala | 229 ++++++++++++++++++ .../scala/xml/parsing/FactoryAdapter.scala | 146 +++++++++-- 9 files changed, 723 insertions(+), 40 deletions(-) create mode 100644 jvm/src/test/resources/scala/xml/utf16.xml create mode 100644 jvm/src/test/resources/scala/xml/utf8.xml create mode 100644 shared/src/main/scala/scala/xml/parsing/DtdBuilder.scala create mode 100644 shared/src/main/scala/scala/xml/parsing/ElementContentModel.scala diff --git a/jvm/src/test/resources/scala/xml/utf16.xml b/jvm/src/test/resources/scala/xml/utf16.xml new file mode 100644 index 0000000000000000000000000000000000000000..52c4fbaa3646ce43cf77ecd28d47489100780446 GIT binary patch literal 92 zcmW-ZJq|!n7zC$wiWj}VMupco0S6F7BzzJQae6G(ZgwVnKNNT_Ru&v5BRdB(8%9Y; eMog-7B1W%$5H+Tswlvg4vT`||ia>uI$=6;!1P=xP literal 0 HcmV?d00001 diff --git a/jvm/src/test/resources/scala/xml/utf8.xml b/jvm/src/test/resources/scala/xml/utf8.xml new file mode 100644 index 000000000..bb59f58cb --- /dev/null +++ b/jvm/src/test/resources/scala/xml/utf8.xml @@ -0,0 +1,2 @@ + + diff --git a/jvm/src/test/scala/scala/xml/XMLTest.scala b/jvm/src/test/scala/scala/xml/XMLTest.scala index 49ca15974..9d14219b4 100644 --- a/jvm/src/test/scala/scala/xml/XMLTest.scala +++ b/jvm/src/test/scala/scala/xml/XMLTest.scala @@ -1,9 +1,10 @@ package scala.xml import org.junit.{Test => UnitTest} -import org.junit.Assert.{assertEquals, assertFalse, assertTrue} +import org.junit.Assert.{assertEquals, assertFalse, assertNull, assertThrows, assertTrue} import java.io.StringWriter import java.io.ByteArrayOutputStream +import java.net.URL import scala.xml.dtd.{DocType, PublicID} import scala.xml.parsing.ConstructingParser import scala.xml.Utility.sort @@ -681,6 +682,8 @@ class XMLTestJVM { assertTrue(gotAnError) } + def resourceUrl(resourceName: String): URL = getClass.getResource(s"$resourceName.xml") + // Here we see that opening InputStream prematurely, as was done previously, breaks XInclude. @UnitTest(expected = classOf[org.xml.sax.SAXParseException]) def xIncludeNeedsSystemId(): Unit = { val parserFactory = xercesInternal @@ -688,7 +691,7 @@ class XMLTestJVM { parserFactory.setXIncludeAware(true) XML .withSAXParser(parserFactory.newSAXParser) - .load(getClass.getResource("site.xml").openStream()) + .load(resourceUrl("site").openStream()) .toString } @@ -703,7 +706,7 @@ class XMLTestJVM { parserFactory.setXIncludeAware(true) val actual: String = XML .withSAXParser(parserFactory.newSAXParser) - .load(getClass.getResource(resourceName)) + .load(resourceUrl(resourceName)) .toString assertEquals(expected, actual) @@ -718,8 +721,8 @@ class XMLTestJVM { | |""".stripMargin - @UnitTest def xIncludeWithExternalXerces(): Unit = check(xercesExternal, "includer.xml", includerExpected) - @UnitTest def xIncludeWithInternalXerces(): Unit = check(xercesInternal, "includer.xml", includerExpected) + @UnitTest def xIncludeWithExternalXerces(): Unit = check(xercesExternal, "includer", includerExpected) + @UnitTest def xIncludeWithInternalXerces(): Unit = check(xercesInternal, "includer", includerExpected) // And here we demonstrate that both external and built-in Xerces report incorrect `xml:base` // when the XML file included contains its own include, and included files are not in the same directory: @@ -750,8 +753,170 @@ class XMLTestJVM { // // I find it utterly incomprehensible that foundational library shipped with JDK and used everywhere // has a bug in its core functionality for years and it never gets fixed, but sadly, it is the state of affairs: - @UnitTest def xIncludeFailWithExternalXerces(): Unit = check(xercesExternal, "site.xml", siteUnfortunatelyExpected) - @UnitTest def xIncludeFailWithInternalXerces(): Unit = check(xercesInternal, "site.xml", siteUnfortunatelyExpected) + @UnitTest def xIncludeFailWithExternalXerces(): Unit = check(xercesExternal, "site", siteUnfortunatelyExpected) + @UnitTest def xIncludeFailWithInternalXerces(): Unit = check(xercesInternal, "site", siteUnfortunatelyExpected) + + @UnitTest + def documentBaseURI(): Unit = { + val url: URL = resourceUrl("site") + // XMLLoader returns the document's baseURI: + assert(XML.withSAXParser(xercesInternal.newSAXParser).loadDocument(url).baseURI.endsWith("/test-classes/scala/xml/site.xml")) + assert(XML.withSAXParser(xercesExternal.newSAXParser).loadDocument(url).baseURI.endsWith("/test-classes/scala/xml/site.xml")) + // ConstructingParser does not return it of course: since it uses scala.io.Source it has no idea where is the XML coming from: + assertNull(ConstructingParser.fromSource(scala.io.Source.fromURI(url.toURI), preserveWS = false).document().baseURI) + } + + @UnitTest + def xmlStandAlone(): Unit = { + val standAlone: String = s"""""" + val nonStandAlone: String = s"""""" + val default: String = s"""""" + val noXmlDeclaration: String = s"""""" + + // ConstructingParser returns standAlone status of the document straight from the `xml` declaration: + assertEquals(Some(true ), ConstructingParser.fromSource(scala.io.Source.fromString(standAlone), preserveWS = false).document().standAlone) + assertEquals(Some(false), ConstructingParser.fromSource(scala.io.Source.fromString(nonStandAlone), preserveWS = false).document().standAlone) + assertTrue(ConstructingParser.fromSource(scala.io.Source.fromString(default), preserveWS = false).document().standAlone.isEmpty) + // ConstructingParser incorrectly returns null standAlone value when the document does not have the xml declaration: + assertNull(ConstructingParser.fromSource(scala.io.Source.fromString(noXmlDeclaration), preserveWS = false).document().standAlone) + + // XMLLoader returns standAlone status of the document straight from the `xml` declaration: + assertTrue(XML.withSAXParser(xercesInternal.newSAXParser).loadStringDocument(standAlone).standAlone.contains(true)) + assertTrue(XML.withSAXParser(xercesInternal.newSAXParser).loadStringDocument(nonStandAlone).standAlone.contains(false)) + assertTrue(XML.withSAXParser(xercesInternal.newSAXParser).loadStringDocument(default).standAlone.contains(false)) + assertTrue(XML.withSAXParser(xercesInternal.newSAXParser).loadStringDocument(noXmlDeclaration).standAlone.contains(false)) + } + + @UnitTest + def xmlVersion(): Unit = { + val xml10 = s"""""" + val xml11 = s"""""" + val noXmlDeclaration: String = s"""""" + + // ConstructingParser returns XML version of the document straight from the `xml` declaration for version="1.0": + assertEquals(Some("1.0"), ConstructingParser.fromSource(scala.io.Source.fromString(xml10), preserveWS = false).document().version) + // ConstructingParser returns incorrect version value when the the version is "1.1" (and prints "cannot deal with versions != 1.0a"): + assertTrue(ConstructingParser.fromSource(scala.io.Source.fromString(xml11), preserveWS = false).document().version.isEmpty) + // ConstructingParser incorrectly returns null version value when the document does not have the xml declaration: + assertNull(ConstructingParser.fromSource(scala.io.Source.fromString(noXmlDeclaration), preserveWS = false).document().version) + + // XMLLoader returns XML version of the document straight from the `xml` declaration + assertTrue(xercesInternal.getFeature("http://xml.org/sax/features/xml-1.1")) + assertEquals(Some("1.0"), XML.withSAXParser(xercesInternal.newSAXParser).loadStringDocument(xml10).version) + assertEquals(Some("1.1"), XML.withSAXParser(xercesInternal.newSAXParser).loadStringDocument(xml11).version) + assertEquals(Some("1.0"), XML.withSAXParser(xercesInternal.newSAXParser).loadStringDocument(noXmlDeclaration).version) + } + + @UnitTest + def xmlEncoding(): Unit = { + val utf8: String = s"""""" + val utf16: String = s"""""" + val default: String = s"""""" + val noXmlDeclaration: String = s"""""" + + // ConstructingParser returns XML encoding name canonicalized from the `xml` declaration: + assertEquals(Some("UTF-8" ), ConstructingParser.fromSource(scala.io.Source.fromString(utf8 ), preserveWS = false).document().encoding) + assertEquals(Some("UTF-16"), ConstructingParser.fromSource(scala.io.Source.fromString(utf16 ), preserveWS = false).document().encoding) + assertEquals(None , ConstructingParser.fromSource(scala.io.Source.fromString(default), preserveWS = false).document().encoding) + // ConstructingParser incorrectly returns null encoding value when the document does not have the xml declaration: + assertNull(ConstructingParser.fromSource(scala.io.Source.fromString(noXmlDeclaration), preserveWS = false).document().encoding) + + // XMLLoader does not return the encoding specified in the `xml` declaration: + assertEquals(None, XML.loadStringDocument(utf8).encoding) + assertEquals(None, XML.loadStringDocument(utf16).encoding) + assertEquals(None, XML.loadStringDocument(default).encoding) + assertEquals(None, XML.loadStringDocument(noXmlDeclaration).encoding) + + // XMLLoader returns the encoding determined from the Byte Order Mark in the document itself: + assertEquals(Some("UTF-8"), XML.loadDocument(resourceUrl("utf8")).encoding) + assertEquals(Some("UTF-16BE"), XML.loadDocument(resourceUrl("utf16")).encoding) + + // ConstructingParser doesn't seem to be able to parse XML with Byte Order Mark: + assertThrows( + classOf[java.nio.charset.MalformedInputException], + () => ConstructingParser.fromSource(scala.io.Source.fromURI(resourceUrl("utf16").toURI), preserveWS = false).document().encoding + ) + } + + @UnitTest + def loadDtd(): Unit = { + val parserFactory: javax.xml.parsers.SAXParserFactory = xercesExternal + parserFactory.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false) + + val xml: String = + s""" + | + | + | + | + | + | + | + | + | + |]> + |&AUTHOR; + |""".stripMargin + + val document: Document = XML.withSAXParser(parserFactory.newSAXParser).loadStringDocument(xml) + + // XMLLoader parses and returns DTD. + // Note: dtd.ContentModel that DTD uses to represent the element content model lacks fidelity: + // occurrence indicators "?" and "+" can not be expressed. + // Note: spurious parentheses come from the dtd.ContentModel's toString() methods... + assertEquals( + """DTD PUBLIC "-//OASIS//DTD DocBook V5.0//EN" "http://www.oasis-open.org/docbook/xml/5.0/docbook.dtd" [ + | + | + | + | + | + | + | + | + | + | + |]""".stripMargin, + document.dtd.toString) + + // XMLLoader resolves entities defined in the DTD - + // XML parser parses and uses the DTD internally, so there is no need to install any additional entity resolvers: + assertEquals("""John Doe""", document.docElem.toString) + + val document2: Document = ConstructingParser.fromSource(scala.io.Source.fromString(xml), preserveWS = false).document() + + // ConstructingParser + // ignores + // element declarations + // attribute list declarations + // some entity declarations + // notations + // captures + // decls: List[Decl] - for EntityDecl and PEReference + // ent: Map[String, EntityDecl] + // returns only + // decls + assertEquals( + s"""DTD PUBLIC "-//OASIS//DTD DocBook V5.0//EN" "http://www.oasis-open.org/docbook/xml/5.0/docbook.dtd" [ + | + |]""".stripMargin, + document2.dtd.toString) + + // ConstructingParser resolves entities defined in the DTD + assertEquals("""John Doe""", document2.docElem.toString) + } @UnitTest def nodeSeqNs(): Unit = { diff --git a/shared/src/main/scala/scala/xml/dtd/DTD.scala b/shared/src/main/scala/scala/xml/dtd/DTD.scala index 6c5772210..a3f588ecc 100644 --- a/shared/src/main/scala/scala/xml/dtd/DTD.scala +++ b/shared/src/main/scala/scala/xml/dtd/DTD.scala @@ -33,7 +33,7 @@ abstract class DTD { var ent: mutable.Map[String, EntityDecl] = new mutable.HashMap[String, EntityDecl]() override def toString: String = - "DTD [\n%s%s]".format( + "DTD %s [\n%s]".format( Option(externalID).getOrElse(""), decls.mkString("", "\n", "\n") ) diff --git a/shared/src/main/scala/scala/xml/dtd/Decl.scala b/shared/src/main/scala/scala/xml/dtd/Decl.scala index bbd7f022e..bdde03372 100644 --- a/shared/src/main/scala/scala/xml/dtd/Decl.scala +++ b/shared/src/main/scala/scala/xml/dtd/Decl.scala @@ -95,11 +95,12 @@ case class UnparsedEntityDecl(name: String, extID: ExternalID, notation: String) extID.buildString(sb).append(" NDATA ").append(notation).append('>') } } + /** a notation declaration */ case class NotationDecl(name: String, extID: ExternalID) extends MarkupDecl { override def buildString(sb: StringBuilder): StringBuilder = { sb.append("') } } diff --git a/shared/src/main/scala/scala/xml/factory/XMLLoader.scala b/shared/src/main/scala/scala/xml/factory/XMLLoader.scala index 0aa36e699..afe54330a 100644 --- a/shared/src/main/scala/scala/xml/factory/XMLLoader.scala +++ b/shared/src/main/scala/scala/xml/factory/XMLLoader.scala @@ -55,17 +55,14 @@ trait XMLLoader[T <: Node] { * The methods available in scala.xml.XML use the XML parser in the JDK * (unless another parser is present on the classpath). */ - private def getDocElem(document: Document): T = document.docElem.asInstanceOf[T] - - def loadXML(inputSource: InputSource, parser: SAXParser): T = getDocElem(loadDocument(inputSource, parser)) - def loadXMLNodes(inputSource: InputSource, parser: SAXParser): Seq[Node] = loadDocument(inputSource, parser).children - private def loadDocument(inputSource: InputSource, parser: SAXParser): Document = adapter.loadDocument(inputSource, parser) - private def loadDocument(inputSource: InputSource, reader: XMLReader): Document = adapter.loadDocument(inputSource, reader) + // TODO remove + def loadXML(inputSource: InputSource, parser: SAXParser): T = getDocElem(adapter.loadDocument(inputSource, parser.getXMLReader)) + def loadXMLNodes(inputSource: InputSource, parser: SAXParser): Seq[Node] = adapter.loadDocument(inputSource, parser.getXMLReader).children def adapter: parsing.FactoryAdapter = new parsing.NoBindingFactoryAdapter() /** Loads XML Document. */ - def loadDocument(source: InputSource): Document = loadDocument(source, reader) + def loadDocument(inputSource: InputSource): Document = adapter.loadDocument(inputSource, reader) def loadFileDocument(fileName: String): Document = loadDocument(Source.fromFile(fileName)) def loadFileDocument(file: File): Document = loadDocument(Source.fromFile(file)) def loadDocument(url: URL): Document = loadDocument(Source.fromUrl(url)) @@ -76,6 +73,7 @@ trait XMLLoader[T <: Node] { def loadStringDocument(string: String): Document = loadDocument(Source.fromString(string)) /** Loads XML element. */ + private def getDocElem(document: Document): T = document.docElem.asInstanceOf[T] def load(inputSource: InputSource): T = getDocElem(loadDocument(inputSource)) def loadFile(fileName: String): T = getDocElem(loadFileDocument(fileName)) def loadFile(file: File): T = getDocElem(loadFileDocument(file)) diff --git a/shared/src/main/scala/scala/xml/parsing/DtdBuilder.scala b/shared/src/main/scala/scala/xml/parsing/DtdBuilder.scala new file mode 100644 index 000000000..df8e3a2f7 --- /dev/null +++ b/shared/src/main/scala/scala/xml/parsing/DtdBuilder.scala @@ -0,0 +1,190 @@ +/* + * Scala (https://www.scala-lang.org) + * + * Copyright EPFL and Lightbend, Inc. + * + * Licensed under Apache License 2.0 + * (http://www.apache.org/licenses/LICENSE-2.0). + * + * See the NOTICE file distributed with this work for + * additional information regarding copyright ownership. + */ + +package scala +package xml +package parsing + +import scala.xml.dtd._ + +// Note: this is private to avoid it becoming a part of binary compatibility checks +final private[parsing] class DtdBuilder( + name: String, + externalID: ExternalID +) { + private var elements: List[ElemDecl] = List.empty + private var attributeLists: List[AttListDecl] = List.empty + private var entities: List[EntityDecl] = List.empty + private var notations: List[NotationDecl] = List.empty + private var unparsedEntities: List[UnparsedEntityDecl] = List.empty + private var parameterReferences: List[PEReference] = List.empty + + // AttListDecl under construction + private var elementName: Option[String] = None + private var attributes: List[AttrDecl] = List.empty + + private def flushAttributes(): Unit = if (elementName.isDefined) { + attributeLists ::= AttListDecl(elementName.get, attributes.reverse) + attributes = List.empty + elementName = None + } + + private var done: Boolean = false + def isDone: Boolean = done + + def endDTD(): Unit = { + flushAttributes() + done = true + } + + def dtd: DTD = new DTD { + // Note: weirdly, unlike DocType, DTD does not have a 'name'... + this.externalID = DtdBuilder.this.externalID + this.elem ++= elements.map(d => d.name -> d).toMap + this.attr ++= attributeLists.map(d => d.name -> d).toMap + this.ent ++= entities.map { d => + val name: String = d match { + case ParsedEntityDecl(name, _) => name + case ParameterEntityDecl(name, _) => name + case UnparsedEntityDecl(name, _, _) => name + } + name -> d + }.toMap + this.decls = + elements.reverse ++ + attributeLists.reverse ++ + entities.reverse ++ + DtdBuilder.this.notations.reverse ++ + parameterReferences.reverse + + override val notations: Seq[NotationDecl] = DtdBuilder.this.notations.reverse + override val unparsedEntities: Seq[EntityDecl] = DtdBuilder.this.unparsedEntities.reverse + } + + + def elementDecl(name: String, model: String): Unit = { + flushAttributes() + elements ::= ElemDecl(name, ElementContentModel.parseContentModel(model)) + } + + // The type will be one of the strings "CDATA", "ID", "IDREF", "IDREFS", "NMTOKEN", "NMTOKENS", "ENTITY", "ENTITIES", + // a parenthesized token group with the separator "|" and all whitespace removed, + // or the word "NOTATION" followed by a space followed by a parenthesized token group with all whitespace removed. + def attributeDecl( + eName: String, + aName: String, + `type`: String, + mode: String, + value: String + ): Unit = { + if (!elementName.contains(eName)) { + flushAttributes() + elementName = Some(eName) + } + + val attribute: AttrDecl = AttrDecl( + aName, + `type`, + mode match { + case "#REQUIRED" => REQUIRED + case "#IMPLIED" => IMPLIED + case "#FIXED" => DEFAULT(fixed = true, value) + case _ => DEFAULT(fixed = false, value) + } + ) + + attributes ::= attribute + } + + // General entities are reported with their regular names, + // parameter entities have '%' prepended to their names, + // and the external DTD subset has the pseudo-entity name "[dtd]". + def startEntity(name: String): Unit = { + flushAttributes() + if (name.startsWith("%")) parameterReferences ::= PEReference(name.tail.trim) + } + + def endEntity(name: String): Unit = { + } + + def notationDecl( + name: String, + publicId: String, + systemId: String + ): Unit = { + flushAttributes() + notations ::= NotationDecl(name, DtdBuilder.mkExternalID(publicId, systemId)) + } + + def unparsedEntityDecl( + name: String, + publicId: String, + systemId: String, + notationName: String + ): Unit = { + flushAttributes() + val unparsedEntity: UnparsedEntityDecl = + UnparsedEntityDecl(name, DtdBuilder.mkExternalID(publicId, systemId), notationName) + entities ::= unparsedEntity + unparsedEntities ::= unparsedEntity + } + + def internalEntityDecl( + name: String, + value: String + ): Unit = { + flushAttributes() + entityDecl(name, IntDef(value)) + } + + def externalEntityDecl( + name: String, + publicId: String, + systemId: String + ): Unit = { + flushAttributes() + entityDecl(name, ExtDef(DtdBuilder.mkExternalID(publicId, systemId))) + } + + private def entityDecl( + name: String, + entityDef: EntityDef + ): Unit = { + val entity: EntityDecl = + if (name.startsWith("%")) ParameterEntityDecl(name.tail.trim, entityDef) + else ParsedEntityDecl(name, entityDef) + entities ::= entity + } + + // DTD class currently does not provide for capturing processing instructions + def processingInstruction(target: String, data: String): Unit = () + + // DTD class currently does not provide for capturing comments + def comment(commentText: String): Unit = () +} + +// Note: this is private to avoid it becoming a part of binary compatibility checks +private[parsing] object DtdBuilder { + def apply( + name: String, + publicId: String, + systemId: String + ): DtdBuilder = new DtdBuilder( + name, + mkExternalID(publicId, systemId) + ) + + private def mkExternalID(publicId: String, systemId: String): ExternalID = + if (publicId != null) PublicID(publicId, systemId) + else if (systemId != null) SystemID(systemId) + else NoExternalID +} diff --git a/shared/src/main/scala/scala/xml/parsing/ElementContentModel.scala b/shared/src/main/scala/scala/xml/parsing/ElementContentModel.scala new file mode 100644 index 000000000..832297c5a --- /dev/null +++ b/shared/src/main/scala/scala/xml/parsing/ElementContentModel.scala @@ -0,0 +1,229 @@ +/* + * Scala (https://www.scala-lang.org) + * + * Copyright EPFL and Lightbend, Inc. + * + * Licensed under Apache License 2.0 + * (http://www.apache.org/licenses/LICENSE-2.0). + * + * See the NOTICE file distributed with this work for + * additional information regarding copyright ownership. + */ + +package scala.xml.parsing + +import scala.annotation.tailrec +import scala.xml.dtd + +// Note: this is private to avoid it becoming a part of binary compatibility checks. + +// The content model will consist of the string "EMPTY", the string "ANY", or a parenthesised group, +// optionally followed by an occurrence indicator. +// The model will be normalized so that all parameter entities are fully resolved and all whitespace is removed, +// and will include the enclosing parentheses. +// Other normalization (such as removing redundant parentheses or simplifying occurrence indicators) +// is at the discretion of the parser. + +// elementdecl ::= '' +// contentspec ::= 'EMPTY' | 'ANY' | Mixed | children +// children ::= (choice | seq) ('?' | '*' | '+')? +// cp ::= (Name | choice | seq) ('?' | '*' | '+')? +// choice ::= '(' S? cp ( S? '|' S? cp )+ S? ')' +// seq ::= '(' S? cp ( S? ',' S? cp )* S? ')' +// Mixed ::= '(' S? '#PCDATA' (S? '|' S? Name)* S? ')*' +// | '(' S? '#PCDATA' S? ')' +private[parsing] object ElementContentModel { + def parseContentModel(model: String): dtd.ContentModel = ContentSpec.parse(model) match { + case ContentSpec.Empty => dtd.EMPTY + case ContentSpec.Any => dtd.ANY + case ContentSpec.PCData => dtd.PCDATA + case ContentSpec.Children(elements, occurrence) => dtd.ELEMENTS(convertOccurrence(elements, occurrence)) + case ContentSpec.Mixed(elements) => + val result: List[dtd.ContentModel.RegExp] = + dtd.ContentModel.Letter(dtd.ContentModel.ElemName(ContentSpec.PCData.value)) +: + elements.map(convertElements) + // TODO scala.xml.dtd.impl.Alt.apply() insists on there being al least two alternatives, + // which causes an exception in MIXED.toString() when there is only one alternative besides #PCDATA. + // I think this is a bug. + dtd.MIXED(dtd.ContentModel.Alt(result: _*)) + } + + private def convertElements(elements: Elements): dtd.ContentModel.RegExp = { + def convertCp(cp: Cp): dtd.ContentModel.RegExp = convertOccurrence(cp.elements, cp.occurrence) + elements match { + case Elements.Element(name) => dtd.ContentModel.Letter(dtd.ContentModel.ElemName(name)) + case Elements.Choice(children) => dtd.ContentModel.Alt(children.map(convertCp): _*) + case Elements.Sequence(children) => dtd.ContentModel.Sequ(children.map(convertCp): _*) + } + } + + private def convertOccurrence(elements: Elements, occurrence: Occurrence): dtd.ContentModel.RegExp = { + val result: dtd.ContentModel.RegExp = convertElements(elements) + occurrence match { + case Occurrence.Once => result + case Occurrence.RepeatOptional => dtd.ContentModel.Star(result) + case Occurrence.OnceOptional => dtd.ContentModel.Star(result) // TODO fidelity lost! + case Occurrence.Repeat => dtd.ContentModel.Star(result) // TODO fidelity lost! + } + } + + sealed trait ContentSpec + object ContentSpec { + sealed trait Simple extends ContentSpec { + final override def toString: String = value + val value: String + } + case object Empty extends Simple { + override val value: String = "EMPTY" + } + case object Any extends Simple { + override val value: String = "ANY" + } + case object PCData extends ContentSpec { + override def toString: String = s"($value)" + val value: String = "#PCDATA" + } + final case class Mixed(elements: List[Elements.Element]) extends ContentSpec { + override def toString: String = { + val names: String = elements.mkString("|") + s"(${PCData.value}|$names)*" + } + } + final case class Children(elements: Elements.Many, occurrence: Occurrence) extends ContentSpec { + override def toString: String = s"$elements$occurrence" + } + object Children { + def parse(string: String, occurrence: Occurrence): Children = + Children(Elements.Many.parse(string), occurrence) + } + def parse(model: String): ContentSpec = model match { + case Empty.value => Empty + case Any.value => Any + case model => + val (parenthesized: String, occurrence: Occurrence) = Occurrence.parse(model) + require(isParenthesized(parenthesized)) + val string: String = removeParentheses(parenthesized) + if (occurrence == Occurrence.Once && string == PCData.value) PCData else if (occurrence == Occurrence.RepeatOptional) { + val choice: List[String] = Elements.Choice.split(string) + if (choice.length > 1 && choice.head == PCData.value) Mixed(choice.tail.map(Elements.Element)) + else Children.parse(string, occurrence) + } else Children.parse(string, occurrence) + } + } + + sealed trait Elements + object Elements { + final case class Element(name: String) extends Elements { + override def toString: String = name + } + sealed abstract class ManyCompanion(val separator: Char) { + final def split(string: String): List[String] = ElementContentModel.split(string, separator) + } + sealed abstract class Many(children: List[Cp]) extends Elements { + final override def toString: String = children.map(_.toString).mkString("(", companion.separator.toString, ")") + def companion: ManyCompanion + } + object Choice extends ManyCompanion(separator = '|') + final case class Choice(children: List[Cp]) extends Many(children) { + override def companion: ManyCompanion = Choice + } + object Sequence extends ManyCompanion(separator = ',') + final case class Sequence(children: List[Cp]) extends Many(children) { + override def companion: ManyCompanion = Sequence + } + object Many { + def parse(string: String): Many = { + val choice: List[String] = Choice.split(string) + if (choice.length > 1) Choice(choice.map(Cp.parse)) + else Sequence(Sequence.split(string).map(Cp.parse)) + } + } + def parse(string: String): Elements = + if (!isParenthesized(string)) Element(string) + else Many.parse(removeParentheses(string)) + } + + final case class Cp(elements: Elements, occurrence: Occurrence) { + override def toString: String = s"$elements$occurrence" + } + object Cp { + def parse(string: String): Cp = { + val (maybeParenthesized: String, occurrence: Occurrence) = Occurrence.parse(string) + Cp(Elements.parse(maybeParenthesized), occurrence) + } + } + + sealed class Occurrence + object Occurrence { + case object Once extends Occurrence { + override def toString: String = "" + } + sealed trait Signed extends Occurrence { + final override def toString: String = sign + def sign: String + } + case object OnceOptional extends Signed { + override def sign: String = "?" + } + case object Repeat extends Signed { + override def sign: String = "+" + } + case object RepeatOptional extends Signed { + override def sign: String = "*" + } + def parse(string: String): (String, Occurrence) = + if (string.endsWith(OnceOptional.sign)) (string.init, OnceOptional) else + if (string.endsWith(RepeatOptional.sign)) (string.init, RepeatOptional) else + if (string.endsWith(Repeat.sign)) (string.init, Repeat) else + (string, Once) + } + + private def isParenthesized(string: String): Boolean = { + @tailrec + def isParenthesized(level: Int, tail: String): Boolean = { + val current: Char = tail.head + val nextTail: String = tail.tail + val nextLevel: Int = if (current == '(') level + 1 else if (current == ')') level - 1 else level + if (nextTail.isEmpty) nextLevel == 0 else if (nextLevel == 0) false else isParenthesized(nextLevel, nextTail) + } + + string.startsWith("(") && isParenthesized(0, string) + } + + @tailrec + private def removeParentheses(string: String): String = + if (!isParenthesized(string)) string + else removeParentheses(string.tail.init) + + // split at the top level of parentheses + private def split(string: String, separator: Char): List[String] = { + @tailrec + def split( + result: List[String], + level: Int, + init: String, + tail: String + ): List[String] = if (tail.isEmpty) if (init.isEmpty) result else result :+ init else { + val current: Char = tail.head + val nextTail: String = tail.tail + if (level == 0 && current == separator) split( + result :+ init, + level, + "", + nextTail + ) else split( + result, + if (current == '(') level + 1 else if (current == ')') level - 1 else level, + init :+ current, + nextTail + ) + } + + split( + List.empty, + 0, + "", + string + ) + } +} diff --git a/shared/src/main/scala/scala/xml/parsing/FactoryAdapter.scala b/shared/src/main/scala/scala/xml/parsing/FactoryAdapter.scala index 9c170b6e7..362c15160 100644 --- a/shared/src/main/scala/scala/xml/parsing/FactoryAdapter.scala +++ b/shared/src/main/scala/scala/xml/parsing/FactoryAdapter.scala @@ -15,8 +15,8 @@ package xml package parsing import scala.collection.Seq -import org.xml.sax.{Attributes, SAXNotRecognizedException, SAXNotSupportedException} -import org.xml.sax.ext.DefaultHandler2 +import org.xml.sax.{Attributes, Locator, SAXNotRecognizedException, SAXNotSupportedException} +import org.xml.sax.ext.{DefaultHandler2, Locator2} // can be mixed into FactoryAdapter if desired trait ConsoleErrorHandler extends DefaultHandler2 { @@ -42,10 +42,21 @@ trait ConsoleErrorHandler extends DefaultHandler2 { abstract class FactoryAdapter extends DefaultHandler2 with factory.XMLLoader[Node] { val normalizeWhitespace: Boolean = false + // reference to the XMLReader that parses the document; this is used to query + // features (e.g., 'is-standalone') and properties (e.g., document-xml-version) - + // see http://www.saxproject.org/apidoc/org/xml/sax/package-summary.html + private var xmlReader: Option[XMLReader] = None + + private var dtdBuilder: Option[DtdBuilder] = None + private def inDtd: Boolean = dtdBuilder.isDefined && !dtdBuilder.get.isDone + private var document: Option[Document] = None + private var baseURI: Option[String] = None + private var xmlEncoding: Option[String] = None private var prefixMappings: List[(String, String)] = List.empty + // TODO all the variables should be private, but - binary compatibility... var prolog: List[Node] = List.empty var rootElem: Node = _ var epilogue: List[Node] = List.empty @@ -100,16 +111,10 @@ abstract class FactoryAdapter extends DefaultHandler2 with factory.XMLLoader[Nod } /** - * Load XML document from the source using the parser. - */ - def loadDocument(source: InputSource, parser: SAXParser): Document = - loadDocument(source, parser.getXMLReader) - - /** - * Load XML document from the source using the reader. + * Load XML document from the inputSource using the xmlReader. */ - def loadDocument(source: InputSource, xmlReader: XMLReader): Document = { - if (source == null) throw new IllegalArgumentException("InputSource cannot be null") + def loadDocument(inputSource: InputSource, xmlReader: XMLReader): Document = { + if (inputSource == null) throw new IllegalArgumentException("InputSource cannot be null") xmlReader.setContentHandler(this) xmlReader.setDTDHandler(this) @@ -126,7 +131,16 @@ abstract class FactoryAdapter extends DefaultHandler2 with factory.XMLLoader[Nod case _: SAXNotSupportedException => } - xmlReader.parse(source) + /* Use DeclHandler if it is supported by the xmlReader. */ + try { + xmlReader.setProperty("http://xml.org/sax/properties/declaration-handler", this) + } catch { + case _: SAXNotRecognizedException => + case _: SAXNotSupportedException => + } + + this.xmlReader = Some(xmlReader) + xmlReader.parse(inputSource) document.get } @@ -175,8 +189,25 @@ abstract class FactoryAdapter extends DefaultHandler2 with factory.XMLLoader[Nod /* ContentHandler methods */ + // Since Java 14, ContentHandler has a method that delivers the values from the XML declaration: + // def declaration(version: String, encoding: String, standalone: String): Unit = () + // but it'll be years until we are all on Java 14 *and* Xerces starts calling this method... + + override def setDocumentLocator(locator: Locator): Unit = { + baseURI = Option(locator.getSystemId) + locator match { + case locator2: Locator2 => + // Note: Xerces calls setDocumentLocator() (and startDocument()) *before* it even reads the XML declaration; + // the version delivered here - locator2.getXMLVersion - is always "1.0"; + // the real version is retrieved as a property of the XML reader in endDocument(). + + xmlEncoding = Option(locator2.getEncoding) + case _ => + } + } + override def startDocument(): Unit = { - scopeStack ::= TopScope // TODO remove + scopeStack ::= TopScope // TODO turn into a parameter } override def endDocument(): Unit = { @@ -187,13 +218,33 @@ abstract class FactoryAdapter extends DefaultHandler2 with factory.XMLLoader[Nod this.document = Some(document) document.children = prolog ++ rootElem ++ epilogue document.docElem = rootElem - document.dtd = null - document.baseURI = null - document.encoding = None - document.standAlone = None - document.version = None + document.dtd = dtdBuilder.map(_.dtd).orNull + document.baseURI = baseURI.orNull + document.encoding = xmlEncoding + + document.version = + try { + Option(xmlReader.get.getProperty("http://xml.org/sax/properties/document-xml-version").asInstanceOf[String]) + } catch { + case _: SAXNotRecognizedException => None + case _: SAXNotSupportedException => None + } + + document.standAlone = + try { + Some(xmlReader.get.getFeature("http://xml.org/sax/features/is-standalone")) + } catch { + case _: SAXNotRecognizedException => None + case _: SAXNotSupportedException => None + } // Note: resetting to the freshly-created state; needed only if this instance is reused, which we do not do... + dtdBuilder = None + xmlReader = None + + baseURI = None + xmlEncoding = None + hStack = hStack.last :: Nil // TODO List.empty scopeStack = scopeStack.tail // TODO List.empty @@ -322,13 +373,36 @@ abstract class FactoryAdapter extends DefaultHandler2 with factory.XMLLoader[Nod } } } + + override def ignorableWhitespace(ch: Array[Char], offset: Int, length: Int): Unit = () + /** * Processing instruction. */ - override def processingInstruction(target: String, data: String): Unit = { - captureText() - hStack = hStack.reverse_:::(createProcInstr(target, data).toList) - } + override def processingInstruction(target: String, data: String): Unit = + if (inDtd) dtdBuilder.foreach(_.processingInstruction(target, data)) else { + captureText() + hStack = hStack.reverse_:::(createProcInstr(target, data).toList) + } + + override def skippedEntity(name: String): Unit = () + + /* LexicalHandler methods (see https://docs.oracle.com/javase/8/docs/api/org/xml/sax/ext/LexicalHandler.html) */ + + override def startDTD( + name: String, + publicId: String, + systemId: String + ): Unit = dtdBuilder = Some(DtdBuilder( + name, + publicId, + systemId + )) + + override def endDTD(): Unit = dtdBuilder.foreach(_.endDTD()) + + override def startEntity(name: String): Unit = dtdBuilder.foreach(_.startEntity(name)) + override def endEntity(name: String): Unit = dtdBuilder.foreach(_.endEntity(name)) /** * Start of a CDATA section. @@ -347,8 +421,32 @@ abstract class FactoryAdapter extends DefaultHandler2 with factory.XMLLoader[Nod * Comment. */ override def comment(ch: Array[Char], start: Int, length: Int): Unit = { - captureText() val commentText: String = String.valueOf(ch.slice(start, start + length)) - hStack = hStack.reverse_:::(createComment(commentText).toList) + if (inDtd) dtdBuilder.foreach(_.comment(commentText)) else { + captureText() + hStack = hStack.reverse_:::(createComment(commentText).toList) + } } + + /* DTDHandler methods (see https://docs.oracle.com/javase/8/docs/api/org/xml/sax/DTDHandler.html) */ + + override def notationDecl(name: String, publicId: String, systemId: String): Unit = + dtdBuilder.foreach(_.notationDecl(name, publicId, systemId)) + + override def unparsedEntityDecl(name: String, publicId: String, systemId: String, notationName: String): Unit = + dtdBuilder.foreach(_.unparsedEntityDecl(name, publicId, systemId, notationName)) + + /* DeclHandler methods (see https://docs.oracle.com/javase/8/docs/api/org/xml/sax/ext/DeclHandler.html) */ + + override def elementDecl(name: String, model: String): Unit = + dtdBuilder.foreach(_.elementDecl(name, model)) + + override def attributeDecl(eName: String, aName: String, `type`: String, mode: String, value: String): Unit = + dtdBuilder.foreach(_.attributeDecl(eName, aName, `type`, mode, value)) + + override def internalEntityDecl(name: String, value: String): Unit = + dtdBuilder.foreach(_.internalEntityDecl(name, value)) + + override def externalEntityDecl(name: String, publicId: String, systemId: String): Unit = + dtdBuilder.foreach(_.externalEntityDecl(name, publicId, systemId)) } From 7b97e37cca88a20e5ced78af51e3aff92eb9b2d7 Mon Sep 17 00:00:00 2001 From: Lukas Rytz Date: Wed, 21 Jun 2023 14:50:40 +0200 Subject: [PATCH 671/789] make Node.toString stack safe --- shared/src/main/scala/scala/xml/Utility.scala | 95 ++++++++++++------- .../test/scala/scala/xml/UtilityTest.scala | 6 ++ 2 files changed, 65 insertions(+), 36 deletions(-) diff --git a/shared/src/main/scala/scala/xml/Utility.scala b/shared/src/main/scala/scala/xml/Utility.scala index a1c6fd998..44c2ca83b 100755 --- a/shared/src/main/scala/scala/xml/Utility.scala +++ b/shared/src/main/scala/scala/xml/Utility.scala @@ -13,6 +13,7 @@ package scala package xml +import scala.annotation.tailrec import scala.collection.mutable import scala.language.implicitConversions import scala.collection.Seq @@ -191,9 +192,8 @@ object Utility extends AnyRef with parsing.TokenTests { decodeEntities: Boolean = true, preserveWhitespace: Boolean = false, minimizeTags: Boolean = false - ): StringBuilder = { + ): StringBuilder = serialize(x, pscope, sb, stripComments, decodeEntities, preserveWhitespace, if (minimizeTags) MinimizeMode.Always else MinimizeMode.Never) - } /** * Serialize an XML Node to a StringBuilder. @@ -212,32 +212,64 @@ object Utility extends AnyRef with parsing.TokenTests { preserveWhitespace: Boolean = false, minimizeTags: MinimizeMode.Value = MinimizeMode.Default ): StringBuilder = { - x match { - case c: Comment => if (!stripComments) c.buildString(sb); sb - case s: SpecialNode => s.buildString(sb) - case g: Group => - for (c <- g.nodes) serialize(c, g.scope, sb, stripComments, decodeEntities, preserveWhitespace, minimizeTags); sb - case el: Elem => - // print tag with namespace declarations - sb.append('<') - el.nameToString(sb) - if (el.attributes.ne(null)) el.attributes.buildString(sb) - el.scope.buildString(sb, pscope) - if (el.child.isEmpty && - (minimizeTags == MinimizeMode.Always || - (minimizeTags == MinimizeMode.Default && el.minimizeEmpty))) { - // no children, so use short form: - sb.append("/>") - } else { - // children, so use long form: ... - sb.append('>') - sequenceToXML(el.child, el.scope, sb, stripComments, decodeEntities, preserveWhitespace, minimizeTags) + serializeImpl(List(x), pscope, false, stripComments, minimizeTags, sb) + sb + } + + private def serializeImpl( + ns: Seq[Node], + pscope: NamespaceBinding, + spaced: Boolean, + stripComments: Boolean, + minimizeTags: MinimizeMode.Value, + sb: StringBuilder + ): Unit = { + @tailrec def ser(nss: List[Seq[Node]], pscopes: List[NamespaceBinding], spaced: List[Boolean], toClose: List[Node]): Unit = nss match { + case List(ns) if ns.isEmpty => + case ns :: rests if ns.isEmpty => + if (toClose.head != null) { sb.append("') } - case _ => throw new IllegalArgumentException("Don't know how to serialize a " + x.getClass.getName) + ser(rests, pscopes.tail, spaced.tail, toClose.tail) + case ns1 :: r => + val (n, ns) = (ns1.head, ns1.tail) + def sp(): Unit = if (ns.nonEmpty && spaced.head) sb.append(' ') + n match { + case c: Comment => + if (!stripComments) { + c.buildString(sb) + sp() + } + ser(ns :: r, pscopes, spaced, toClose) + case s: SpecialNode => + s.buildString(sb) + sp() + ser(ns :: r, pscopes, spaced, toClose) + case g: Group => + ser(g.nodes :: ns :: r, g.scope :: pscopes, false :: spaced, null :: toClose) + case e: Elem => + sb.append('<') + e.nameToString(sb) + if (e.attributes.ne(null)) e.attributes.buildString(sb) + e.scope.buildString(sb, pscopes.head) + if (e.child.isEmpty && + (minimizeTags == MinimizeMode.Always || + (minimizeTags == MinimizeMode.Default && e.minimizeEmpty))) { + // no children, so use short form: + sb.append("/>") + sp() + ser(ns :: r, pscopes, spaced, toClose) + } else { + sb.append('>') + val csp = e.child.forall(isAtomAndNotText) + ser(e.child :: ns :: r, e.scope :: pscopes, csp :: spaced, e :: toClose) + } + case n => throw new IllegalArgumentException("Don't know how to serialize a " + n.getClass.getName) + } } + ser(List(ns), List(pscope), List(spaced), Nil) } def sequenceToXML( @@ -248,18 +280,9 @@ object Utility extends AnyRef with parsing.TokenTests { decodeEntities: Boolean = true, preserveWhitespace: Boolean = false, minimizeTags: MinimizeMode.Value = MinimizeMode.Default - ): Unit = { - if (children.isEmpty) () - else if (children.forall(isAtomAndNotText)) { // add space - val it: Iterator[Node] = children.iterator - val f: Node = it.next() - serialize(f, pscope, sb, stripComments, decodeEntities, preserveWhitespace, minimizeTags) - while (it.hasNext) { - val x: Node = it.next() - sb.append(' ') - serialize(x, pscope, sb, stripComments, decodeEntities, preserveWhitespace, minimizeTags) - } - } else children.foreach { serialize(_, pscope, sb, stripComments, decodeEntities, preserveWhitespace, minimizeTags) } + ): Unit = if (children.nonEmpty) { + val spaced = children.forall(isAtomAndNotText) + serializeImpl(children, pscope, spaced, stripComments, minimizeTags, sb) } def splitName(name: String): (Option[String], String) = { diff --git a/shared/src/test/scala/scala/xml/UtilityTest.scala b/shared/src/test/scala/scala/xml/UtilityTest.scala index 87384d3e4..4553a6f44 100644 --- a/shared/src/test/scala/scala/xml/UtilityTest.scala +++ b/shared/src/test/scala/scala/xml/UtilityTest.scala @@ -230,4 +230,10 @@ class UtilityTest { assertEquals("", result) } + @Test + def toStringStackSafe(): Unit = { + val xml = (1 to 5000).foldRight() { case (_, n) => {n}} + xml.toString + } + } From 5375483b9da428549289ecce3d9a28b67ee9744c Mon Sep 17 00:00:00 2001 From: Lukas Rytz Date: Thu, 22 Jun 2023 10:58:58 +0200 Subject: [PATCH 672/789] Use List[Node] in toString --- shared/src/main/scala/scala/xml/Utility.scala | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/shared/src/main/scala/scala/xml/Utility.scala b/shared/src/main/scala/scala/xml/Utility.scala index 44c2ca83b..bc6b02a87 100755 --- a/shared/src/main/scala/scala/xml/Utility.scala +++ b/shared/src/main/scala/scala/xml/Utility.scala @@ -224,17 +224,16 @@ object Utility extends AnyRef with parsing.TokenTests { minimizeTags: MinimizeMode.Value, sb: StringBuilder ): Unit = { - @tailrec def ser(nss: List[Seq[Node]], pscopes: List[NamespaceBinding], spaced: List[Boolean], toClose: List[Node]): Unit = nss match { - case List(ns) if ns.isEmpty => - case ns :: rests if ns.isEmpty => + @tailrec def ser(nss: List[List[Node]], pscopes: List[NamespaceBinding], spaced: List[Boolean], toClose: List[Node]): Unit = nss match { + case List(Nil) => + case Nil :: rests => if (toClose.head != null) { sb.append("') } ser(rests, pscopes.tail, spaced.tail, toClose.tail) - case ns1 :: r => - val (n, ns) = (ns1.head, ns1.tail) + case (n :: ns) :: r => def sp(): Unit = if (ns.nonEmpty && spaced.head) sb.append(' ') n match { case c: Comment => @@ -248,7 +247,7 @@ object Utility extends AnyRef with parsing.TokenTests { sp() ser(ns :: r, pscopes, spaced, toClose) case g: Group => - ser(g.nodes :: ns :: r, g.scope :: pscopes, false :: spaced, null :: toClose) + ser(g.nodes.toList :: ns :: r, g.scope :: pscopes, false :: spaced, null :: toClose) case e: Elem => sb.append('<') e.nameToString(sb) @@ -264,12 +263,12 @@ object Utility extends AnyRef with parsing.TokenTests { } else { sb.append('>') val csp = e.child.forall(isAtomAndNotText) - ser(e.child :: ns :: r, e.scope :: pscopes, csp :: spaced, e :: toClose) + ser(e.child.toList :: ns :: r, e.scope :: pscopes, csp :: spaced, e :: toClose) } case n => throw new IllegalArgumentException("Don't know how to serialize a " + n.getClass.getName) } } - ser(List(ns), List(pscope), List(spaced), Nil) + ser(List(ns.toList), List(pscope), List(spaced), Nil) } def sequenceToXML( From 671428d39f84197e984ca0898f16b0c567d77eba Mon Sep 17 00:00:00 2001 From: Leonid Dubinsky Date: Tue, 20 Jun 2023 16:06:46 -0400 Subject: [PATCH 673/789] mismatched quotes should not cause an infinite loop Resolves #656 --- .../scala/scala/xml/parsing/ConstructingParserTest.scala | 6 ++++++ .../main/scala/scala/xml/parsing/MarkupParserCommon.scala | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/jvm/src/test/scala/scala/xml/parsing/ConstructingParserTest.scala b/jvm/src/test/scala/scala/xml/parsing/ConstructingParserTest.scala index 1ee397e3d..f796070da 100644 --- a/jvm/src/test/scala/scala/xml/parsing/ConstructingParserTest.scala +++ b/jvm/src/test/scala/scala/xml/parsing/ConstructingParserTest.scala @@ -91,4 +91,10 @@ class ConstructingParserTest { val parser: ConstructingParser = ConstructingParser.fromSource(Source.fromString(xml), preserveWS = true) parser.document().docElem // shouldn't crash } + + @Test(expected = classOf[scala.xml.parsing.FatalError]) + def issue656(): Unit = { + // mismatched quotes should not cause an infinite loop + XhtmlParser(Source.fromString(""" Date: Fri, 16 Jun 2023 00:11:17 -0400 Subject: [PATCH 674/789] Use string interpolation instead of concatenation or format(). It looks like the code predates the introduction of the string interpolation... (I'd like to replace more uses of the StringBuilder with string interpolation, but binary compatibility is in the way.) --- .../scala-2.x/scala/xml/CompilerErrors.scala | 4 +-- shared/src/main/scala/scala/xml/Atom.scala | 2 +- .../src/main/scala/scala/xml/Attribute.scala | 4 +-- shared/src/main/scala/scala/xml/Comment.scala | 4 +-- .../src/main/scala/scala/xml/EntityRef.scala | 2 +- shared/src/main/scala/scala/xml/Group.scala | 2 +- .../src/main/scala/scala/xml/MetaData.scala | 2 +- .../scala/scala/xml/NamespaceBinding.scala | 8 ++--- shared/src/main/scala/scala/xml/Node.scala | 9 ++---- shared/src/main/scala/scala/xml/NodeSeq.scala | 2 +- shared/src/main/scala/scala/xml/Null.scala | 2 +- shared/src/main/scala/scala/xml/PCData.scala | 6 ++-- .../src/main/scala/scala/xml/ProcInstr.scala | 12 ++++---- shared/src/main/scala/scala/xml/Utility.scala | 15 +++++----- shared/src/main/scala/scala/xml/XML.scala | 4 +-- .../scala/scala/xml/dtd/ContentModel.scala | 2 +- shared/src/main/scala/scala/xml/dtd/DTD.scala | 5 +--- .../src/main/scala/scala/xml/dtd/Decl.scala | 25 +++++++--------- .../main/scala/scala/xml/dtd/DocType.scala | 4 +-- .../main/scala/scala/xml/dtd/ExternalID.scala | 13 ++++---- .../scala/xml/dtd/ValidationException.scala | 11 ++++--- .../scala/xml/dtd/impl/BaseBerrySethi.scala | 6 ++-- .../scala/xml/dtd/impl/DetWordAutom.scala | 10 ++----- .../scala/xml/dtd/impl/NondetWordAutom.scala | 5 ++-- .../xml/include/sax/XIncludeFilter.scala | 30 ++++++++----------- .../scala/xml/include/sax/XIncluder.scala | 26 +++++++--------- .../scala/xml/parsing/ExternalSources.scala | 2 +- .../scala/xml/parsing/FactoryAdapter.scala | 4 +-- .../scala/xml/parsing/MarkupHandler.scala | 6 ++-- .../scala/xml/parsing/MarkupParser.scala | 12 ++++---- .../xml/parsing/MarkupParserCommon.scala | 8 ++--- .../scala/xml/TransformersTest.scala | 2 +- shared/src/test/scala/scala/xml/XMLTest.scala | 4 ++- 33 files changed, 112 insertions(+), 141 deletions(-) diff --git a/jvm/src/test/scala-2.x/scala/xml/CompilerErrors.scala b/jvm/src/test/scala-2.x/scala/xml/CompilerErrors.scala index 2ad3a329b..9a0df05d5 100644 --- a/jvm/src/test/scala-2.x/scala/xml/CompilerErrors.scala +++ b/jvm/src/test/scala-2.x/scala/xml/CompilerErrors.scala @@ -193,7 +193,7 @@ class CompilerTesting { // note: `code` should have a | margin // the import's needed because toolbox compiler does not accumulate imports like the real one (TODO: verify hypothesis) def xmlErrorMessages(msg: String, code: String): List[String] = - errorMessages(msg)("import scala.xml.{TopScope => $scope}\n"+ code.stripMargin) + errorMessages(msg)("import scala.xml.{TopScope => $scope}\n"+ code.stripMargin) // TODO what is this $scope? def expectXmlError(msg: String, code: String): Unit = { val errors: List[String] = xmlErrorMessages(msg, code) @@ -203,6 +203,6 @@ class CompilerTesting { def expectXmlErrors(msgCount: Int, msg: String, code: String): Unit = { val errors: List[String] = xmlErrorMessages(msg, code) val errorCount: Int = errors.count(_.contains(msg)) - assert(errorCount == msgCount, s"$errorCount occurrences of \'$msg\' found -- expected $msgCount in:\n${errors.mkString("\n")}") + assert(errorCount == msgCount, s"$errorCount occurrences of '$msg' found -- expected $msgCount in:\n${errors.mkString("\n")}") } } diff --git a/shared/src/main/scala/scala/xml/Atom.scala b/shared/src/main/scala/scala/xml/Atom.scala index d79ce287d..d2e1c23dc 100644 --- a/shared/src/main/scala/scala/xml/Atom.scala +++ b/shared/src/main/scala/scala/xml/Atom.scala @@ -24,7 +24,7 @@ import scala.collection.Seq */ class Atom[+A](val data: A) extends SpecialNode with Serializable { if (data == null) - throw new IllegalArgumentException("cannot construct " + getClass.getSimpleName + " with null") + throw new IllegalArgumentException(s"cannot construct ${getClass.getSimpleName} with null") override protected def basisForHashCode: Seq[Any] = Seq(data) diff --git a/shared/src/main/scala/scala/xml/Attribute.scala b/shared/src/main/scala/scala/xml/Attribute.scala index 9d2be60de..cb2b2d979 100644 --- a/shared/src/main/scala/scala/xml/Attribute.scala +++ b/shared/src/main/scala/scala/xml/Attribute.scala @@ -98,9 +98,9 @@ trait Attribute extends MetaData { if (value == null) return if (isPrefixed) - sb.append(pre).append(':') + sb.append(s"$pre:") - sb.append(key).append('=') + sb.append(s"$key=") val sb2: StringBuilder = new StringBuilder() Utility.sequenceToXML(value, TopScope, sb2, stripComments = true) Utility.appendQuoted(sb2.toString, sb) diff --git a/shared/src/main/scala/scala/xml/Comment.scala b/shared/src/main/scala/scala/xml/Comment.scala index 76d1be4a1..aee8dc07c 100644 --- a/shared/src/main/scala/scala/xml/Comment.scala +++ b/shared/src/main/scala/scala/xml/Comment.scala @@ -30,7 +30,7 @@ case class Comment(commentText: String) extends SpecialNode { final override def doTransform: Boolean = false if (commentText.contains("--")) { - throw new IllegalArgumentException("text contains \"--\"") + throw new IllegalArgumentException(s"""text contains "--"""") } if (commentText.nonEmpty && commentText.charAt(commentText.length - 1) == '-') { throw new IllegalArgumentException("The final character of a XML comment may not be '-'. See https://www.w3.org/TR/xml11//#IDA5CES") @@ -40,5 +40,5 @@ case class Comment(commentText: String) extends SpecialNode { * Appends "" to this string buffer. */ override def buildString(sb: StringBuilder): StringBuilder = - sb.append("") + sb.append(s"") } diff --git a/shared/src/main/scala/scala/xml/EntityRef.scala b/shared/src/main/scala/scala/xml/EntityRef.scala index 07be3c5a3..5b5b1f2a5 100644 --- a/shared/src/main/scala/scala/xml/EntityRef.scala +++ b/shared/src/main/scala/scala/xml/EntityRef.scala @@ -41,5 +41,5 @@ case class EntityRef(entityName: String) extends SpecialNode { * @return the modified string buffer `sb`. */ override def buildString(sb: StringBuilder): StringBuilder = - sb.append("&").append(entityName).append(";") + sb.append(s"&$entityName;") } diff --git a/shared/src/main/scala/scala/xml/Group.scala b/shared/src/main/scala/scala/xml/Group.scala index b212899a7..4c8fd7baf 100644 --- a/shared/src/main/scala/scala/xml/Group.scala +++ b/shared/src/main/scala/scala/xml/Group.scala @@ -40,7 +40,7 @@ final case class Group(nodes: Seq[Node]) extends Node { * Since Group is very much a hack it throws an exception if you * try to do anything with it. */ - private def fail(msg: String): Nothing = throw new UnsupportedOperationException("class Group does not support method '%s'".format(msg)) + private def fail(msg: String): Nothing = throw new UnsupportedOperationException(s"class Group does not support method '$msg'") override def label: Nothing = fail("label") override def attributes: Nothing = fail("attributes") diff --git a/shared/src/main/scala/scala/xml/MetaData.scala b/shared/src/main/scala/scala/xml/MetaData.scala index 9d621aa58..b55b3187c 100644 --- a/shared/src/main/scala/scala/xml/MetaData.scala +++ b/shared/src/main/scala/scala/xml/MetaData.scala @@ -174,7 +174,7 @@ abstract class MetaData * prefixed, and "key" otherwise. */ def prefixedKey: String = this match { - case x: Attribute if x.isPrefixed => x.pre + ":" + key + case x: Attribute if x.isPrefixed => s"${x.pre}:$key" case _ => key } diff --git a/shared/src/main/scala/scala/xml/NamespaceBinding.scala b/shared/src/main/scala/scala/xml/NamespaceBinding.scala index 6ddeb99ce..7e851edae 100644 --- a/shared/src/main/scala/scala/xml/NamespaceBinding.scala +++ b/shared/src/main/scala/scala/xml/NamespaceBinding.scala @@ -79,10 +79,8 @@ case class NamespaceBinding(prefix: String, uri: String, parent: NamespaceBindin private def doBuildString(sb: StringBuilder, stop: NamespaceBinding): Unit = { if (List(null, stop, TopScope).contains(this)) return - val s: String = " xmlns%s=\"%s\"".format( - if (prefix != null) ":" + prefix else "", - if (uri != null) uri else "" - ) - parent.doBuildString(sb.append(s), stop) // copy(ignore) + val prefixStr: String = if (prefix != null) s":$prefix" else "" + val uriStr: String = if (uri != null) uri else "" + parent.doBuildString(sb.append(s""" xmlns$prefixStr="$uriStr""""), stop) // copy(ignore) } } diff --git a/shared/src/main/scala/scala/xml/Node.scala b/shared/src/main/scala/scala/xml/Node.scala index ee7a9f50e..ff719ec48 100755 --- a/shared/src/main/scala/scala/xml/Node.scala +++ b/shared/src/main/scala/scala/xml/Node.scala @@ -184,13 +184,8 @@ abstract class Node extends NodeSeq { /** * Appends qualified name of this node to `StringBuilder`. */ - def nameToString(sb: StringBuilder): StringBuilder = { - if (null != prefix) { - sb.append(prefix) - sb.append(':') - } - sb.append(label) - } + def nameToString(sb: StringBuilder): StringBuilder = + sb.append(s"${if (prefix == null) "" else s"$prefix:"}$label") /** * Returns a type symbol (e.g. DTD, XSD), default `'''null'''`. diff --git a/shared/src/main/scala/scala/xml/NodeSeq.scala b/shared/src/main/scala/scala/xml/NodeSeq.scala index 26880d266..cbb5b047e 100644 --- a/shared/src/main/scala/scala/xml/NodeSeq.scala +++ b/shared/src/main/scala/scala/xml/NodeSeq.scala @@ -157,7 +157,7 @@ abstract class NodeSeq extends AbstractSeq[Node] with immutable.Seq[Node] with S * Convenience method which returns string text of the named attribute. Use: * - `that \@ "foo"` to get the string text of attribute `"foo"`; */ - def \@(attributeName: String): String = (this \ ("@" + attributeName)).text + def \@(attributeName: String): String = (this \ s"@$attributeName").text override def toString: String = theSeq.mkString diff --git a/shared/src/main/scala/scala/xml/Null.scala b/shared/src/main/scala/scala/xml/Null.scala index 0ece843a9..5613a462f 100644 --- a/shared/src/main/scala/scala/xml/Null.scala +++ b/shared/src/main/scala/scala/xml/Null.scala @@ -51,7 +51,7 @@ case object Null extends MetaData { override def apply(namespace: String, scope: NamespaceBinding, key: String): ScalaVersionSpecificReturnTypes.NullApply3 = null override def apply(key: String): ScalaVersionSpecificReturnTypes.NullApply1 = if (Utility.isNameStart(key.head)) null - else throw new IllegalArgumentException("not a valid attribute name '" + key + "', so can never match !") + else throw new IllegalArgumentException(s"not a valid attribute name '$key', so can never match !") override protected def toString1(sb: StringBuilder): Unit = () override protected def toString1: String = "" diff --git a/shared/src/main/scala/scala/xml/PCData.scala b/shared/src/main/scala/scala/xml/PCData.scala index c5da01d7c..ee91aa240 100644 --- a/shared/src/main/scala/scala/xml/PCData.scala +++ b/shared/src/main/scala/scala/xml/PCData.scala @@ -30,8 +30,10 @@ class PCData(data: String) extends Atom[String](data) { * @param sb the input string buffer associated to some XML element * @return the input string buffer with the formatted CDATA section */ - override def buildString(sb: StringBuilder): StringBuilder = - sb.append("".format(data.replaceAll("]]>", "]]]]>"))) + override def buildString(sb: StringBuilder): StringBuilder = { + val dataStr: String = data.replaceAll("]]>", "]]]]>") + sb.append(s"") + } } /** diff --git a/shared/src/main/scala/scala/xml/ProcInstr.scala b/shared/src/main/scala/scala/xml/ProcInstr.scala index b2433ec87..4d09b373b 100644 --- a/shared/src/main/scala/scala/xml/ProcInstr.scala +++ b/shared/src/main/scala/scala/xml/ProcInstr.scala @@ -23,11 +23,11 @@ package xml // Note: used by the Scala compiler. case class ProcInstr(target: String, proctext: String) extends SpecialNode { if (!Utility.isName(target)) - throw new IllegalArgumentException(target + " must be an XML Name") + throw new IllegalArgumentException(s"$target must be an XML Name") if (proctext.contains("?>")) - throw new IllegalArgumentException(proctext + " may not contain \"?>\"") + throw new IllegalArgumentException(s"""$proctext may not contain "?>"""") if (target.toLowerCase == "xml") - throw new IllegalArgumentException(target + " is reserved") + throw new IllegalArgumentException(s"$target is reserved") final override def doCollectNamespaces: Boolean = false final override def doTransform: Boolean = false @@ -39,6 +39,8 @@ case class ProcInstr(target: String, proctext: String) extends SpecialNode { * appends "<?" target (" "+text)?+"?>" * to this stringbuffer. */ - override def buildString(sb: StringBuilder): StringBuilder = - sb.append("".format(target, if (proctext == "") "" else " " + proctext)) + override def buildString(sb: StringBuilder): StringBuilder = { + val textStr: String = if (proctext == "") "" else s" $proctext" + sb.append(s"") + } } diff --git a/shared/src/main/scala/scala/xml/Utility.scala b/shared/src/main/scala/scala/xml/Utility.scala index bc6b02a87..ab3592f2b 100755 --- a/shared/src/main/scala/scala/xml/Utility.scala +++ b/shared/src/main/scala/scala/xml/Utility.scala @@ -112,7 +112,7 @@ object Utility extends AnyRef with parsing.TokenTests { "quot" -> '"', "apos" -> '\'' ) - val escMap: Map[Char, String] = (pairs - "apos").map { case (s, c) => c -> "&%s;".format(s) } + val escMap: Map[Char, String] = (pairs - "apos").map { case (s, c) => c -> s"&$s;" } val unescMap: Map[String, Char] = pairs } import Escapes.{ escMap, unescMap } @@ -265,7 +265,7 @@ object Utility extends AnyRef with parsing.TokenTests { val csp = e.child.forall(isAtomAndNotText) ser(e.child.toList :: ns :: r, e.scope :: pscopes, csp :: spaced, e :: toClose) } - case n => throw new IllegalArgumentException("Don't know how to serialize a " + n.getClass.getName) + case n => throw new IllegalArgumentException(s"Don't know how to serialize a ${n.getClass.getName}") } } ser(List(ns.toList), List(pscope), List(spaced), Nil) @@ -309,7 +309,7 @@ object Utility extends AnyRef with parsing.TokenTests { */ def appendQuoted(s: String, sb: StringBuilder): StringBuilder = { val ch: Char = if (s.contains('"')) '\'' else '"' - sb.append(ch).append(s).append(ch) + sb.append(s"$ch$s$ch") } /** @@ -347,10 +347,10 @@ object Utility extends AnyRef with parsing.TokenTests { case '&' => val n: String = getName(value, i + 1) if (n.eq(null)) - return "malformed entity reference in attribute value [" + value + "]" + return s"malformed entity reference in attribute value [$value]" i = i + n.length + 1 if (i >= value.length || value.charAt(i) != ';') - return "malformed entity reference in attribute value [" + value + "]" + return s"malformed entity reference in attribute value [$value]" case _ => } i = i + 1 @@ -423,14 +423,13 @@ object Utility extends AnyRef with parsing.TokenTests { case 'a' | 'b' | 'c' | 'd' | 'e' | 'f' | 'A' | 'B' | 'C' | 'D' | 'E' | 'F' => if (!hex) - reportSyntaxError("hex char not allowed in decimal char ref\n" + - "Did you mean to write &#x ?") + reportSyntaxError("hex char not allowed in decimal char ref\nDid you mean to write &#x ?") else i = i * base + ch().asDigit case SU => reportTruncatedError("") case _ => - reportSyntaxError("character '" + ch() + "' not allowed in char ref\n") + reportSyntaxError(s"character '${ch()}' not allowed in char ref\n") } nextch() } diff --git a/shared/src/main/scala/scala/xml/XML.scala b/shared/src/main/scala/scala/xml/XML.scala index 43135acf9..9cf06d13c 100755 --- a/shared/src/main/scala/scala/xml/XML.scala +++ b/shared/src/main/scala/scala/xml/XML.scala @@ -125,8 +125,8 @@ object XML extends XMLLoader[Elem] { minimizeTags: MinimizeMode.Value = MinimizeMode.Default ): Unit = { /* TODO: optimize by giving writer parameter to toXML*/ - if (xmlDecl) w.write("\n") - if (doctype.ne(null)) w.write(doctype.toString + "\n") + if (xmlDecl) w.write(s"\n") + if (doctype.ne(null)) w.write(s"$doctype\n") w.write(Utility.serialize(node, minimizeTags = minimizeTags).toString) } } diff --git a/shared/src/main/scala/scala/xml/dtd/ContentModel.scala b/shared/src/main/scala/scala/xml/dtd/ContentModel.scala index b626bbf48..1c6b0a00d 100644 --- a/shared/src/main/scala/scala/xml/dtd/ContentModel.scala +++ b/shared/src/main/scala/scala/xml/dtd/ContentModel.scala @@ -38,7 +38,7 @@ object ContentModel extends WordExp { } case class ElemName(name: String) extends Label { - override def toString: String = """ElemName("%s")""".format(name) + override def toString: String = s"""ElemName("$name")""" } def isMixed(cm: ContentModel): Boolean = cond(cm) { case _: MIXED => true } diff --git a/shared/src/main/scala/scala/xml/dtd/DTD.scala b/shared/src/main/scala/scala/xml/dtd/DTD.scala index a3f588ecc..9b334a8dc 100644 --- a/shared/src/main/scala/scala/xml/dtd/DTD.scala +++ b/shared/src/main/scala/scala/xml/dtd/DTD.scala @@ -33,8 +33,5 @@ abstract class DTD { var ent: mutable.Map[String, EntityDecl] = new mutable.HashMap[String, EntityDecl]() override def toString: String = - "DTD %s [\n%s]".format( - Option(externalID).getOrElse(""), - decls.mkString("", "\n", "\n") - ) + s"DTD ${Option(externalID).getOrElse("")} [\n${decls.mkString("\n")}\n]" } diff --git a/shared/src/main/scala/scala/xml/dtd/Decl.scala b/shared/src/main/scala/scala/xml/dtd/Decl.scala index bdde03372..570669dc2 100644 --- a/shared/src/main/scala/scala/xml/dtd/Decl.scala +++ b/shared/src/main/scala/scala/xml/dtd/Decl.scala @@ -40,8 +40,7 @@ sealed abstract class MarkupDecl extends Decl { case class ElemDecl(name: String, contentModel: ContentModel) extends MarkupDecl { override def buildString(sb: StringBuilder): StringBuilder = { - sb.append("') } @@ -49,9 +48,8 @@ case class ElemDecl(name: String, contentModel: ContentModel) case class AttListDecl(name: String, attrs: List[AttrDecl]) extends MarkupDecl { - override def buildString(sb: StringBuilder): StringBuilder = { - sb.append("")) - } + override def buildString(sb: StringBuilder): StringBuilder = + sb.append(s"") } /** @@ -63,10 +61,9 @@ case class AttrDecl(name: String, tpe: String, default: DefaultDecl) { override def toString: String = sbToString(buildString) def buildString(sb: StringBuilder): StringBuilder = { - sb.append(" ").append(name).append(' ').append(tpe).append(' ') + sb.append(s" $name $tpe ") default.buildString(sb) } - } /** an entity declaration */ @@ -75,7 +72,7 @@ sealed abstract class EntityDecl extends MarkupDecl /** a parsed general entity declaration */ case class ParsedEntityDecl(name: String, entdef: EntityDef) extends EntityDecl { override def buildString(sb: StringBuilder): StringBuilder = { - sb.append("') } } @@ -83,7 +80,7 @@ case class ParsedEntityDecl(name: String, entdef: EntityDef) extends EntityDecl /** a parameter entity declaration */ case class ParameterEntityDecl(name: String, entdef: EntityDef) extends EntityDecl { override def buildString(sb: StringBuilder): StringBuilder = { - sb.append("') } } @@ -91,15 +88,15 @@ case class ParameterEntityDecl(name: String, entdef: EntityDef) extends EntityDe /** an unparsed entity declaration */ case class UnparsedEntityDecl(name: String, extID: ExternalID, notation: String) extends EntityDecl { override def buildString(sb: StringBuilder): StringBuilder = { - sb.append("') + sb.append(s"") } } /** a notation declaration */ case class NotationDecl(name: String, extID: ExternalID) extends MarkupDecl { override def buildString(sb: StringBuilder): StringBuilder = { - sb.append("') } } @@ -120,7 +117,7 @@ case class IntDef(value: String) extends EntityDef { val n: String = tmp.substring(ix, iz) if (!Utility.isName(n)) - throw new IllegalArgumentException("internal entity def: \"" + n + "\" must be an XML Name") + throw new IllegalArgumentException(s"""internal entity def: "$n" must be an XML Name""") tmp = tmp.substring(iz + 1, tmp.length) ix = tmp.indexOf('%') @@ -145,7 +142,7 @@ case class PEReference(ent: String) extends MarkupDecl { throw new IllegalArgumentException("ent must be an XML Name") override def buildString(sb: StringBuilder): StringBuilder = - sb.append('%').append(ent).append(';') + sb.append(s"%$ent;") } // default declarations for attributes diff --git a/shared/src/main/scala/scala/xml/dtd/DocType.scala b/shared/src/main/scala/scala/xml/dtd/DocType.scala index efdfcf839..1318e3b21 100644 --- a/shared/src/main/scala/scala/xml/dtd/DocType.scala +++ b/shared/src/main/scala/scala/xml/dtd/DocType.scala @@ -27,7 +27,7 @@ import scala.collection.Seq */ case class DocType(name: String, extID: ExternalID, intSubset: Seq[dtd.Decl]) { if (!Utility.isName(name)) - throw new IllegalArgumentException(name + " must be an XML Name") + throw new IllegalArgumentException(s"$name must be an XML Name") /** returns "<!DOCTYPE + name + extID? + ("["+intSubSet+"]")? >" */ final override def toString: String = { @@ -35,7 +35,7 @@ case class DocType(name: String, extID: ExternalID, intSubset: Seq[dtd.Decl]) { if (intSubset.isEmpty) "" else intSubset.mkString("[", "", "]") - """""".format(name, extID.toString, intString) + s"" } } diff --git a/shared/src/main/scala/scala/xml/dtd/ExternalID.scala b/shared/src/main/scala/scala/xml/dtd/ExternalID.scala index f2a5d40fc..80b9da867 100644 --- a/shared/src/main/scala/scala/xml/dtd/ExternalID.scala +++ b/shared/src/main/scala/scala/xml/dtd/ExternalID.scala @@ -22,19 +22,16 @@ package dtd sealed abstract class ExternalID extends parsing.TokenTests { def quoted(s: String): String = { val c: Char = if (s.contains('"')) '\'' else '"' - c.toString + s + c + s"$c$s$c" } // public != null: PUBLIC " " publicLiteral " " [systemLiteral] // public == null: SYSTEM " " systemLiteral - override def toString: String = { - lazy val quotedSystemLiteral: String = quoted(systemId) - lazy val quotedPublicLiteral: String = quoted(publicId) + override def toString: String = + if (publicId == null) s"SYSTEM ${quoted(systemId)}" else + if (systemId == null) s"PUBLIC ${quoted(publicId)}" else + s"PUBLIC ${quoted(publicId)} ${quoted(systemId)}" - if (publicId == null) "SYSTEM " + quotedSystemLiteral - else "PUBLIC " + quotedPublicLiteral + - (if (systemId == null) "" else " " + quotedSystemLiteral) - } def buildString(sb: StringBuilder): StringBuilder = sb.append(this.toString) diff --git a/shared/src/main/scala/scala/xml/dtd/ValidationException.scala b/shared/src/main/scala/scala/xml/dtd/ValidationException.scala index 71f741d8a..01d4cad02 100644 --- a/shared/src/main/scala/scala/xml/dtd/ValidationException.scala +++ b/shared/src/main/scala/scala/xml/dtd/ValidationException.scala @@ -21,25 +21,24 @@ case class ValidationException(e: String) extends Exception(e) */ object MakeValidationException { def fromFixedAttribute(k: String, value: String, actual: String): ValidationException = - ValidationException("value of attribute " + k + " FIXED to \"" + - value + "\", but document tries \"" + actual + "\"") + ValidationException(s"""value of attribute $k FIXED to "$value", but document tries "$actual"""") def fromNonEmptyElement(): ValidationException = ValidationException("element should be *empty*") def fromUndefinedElement(label: String): ValidationException = - ValidationException("element \"" + label + "\" not allowed here") + ValidationException(s"""element "$label" not allowed here""") def fromUndefinedAttribute(key: String): ValidationException = - ValidationException("attribute " + key + " not allowed here") + ValidationException(s"attribute $key not allowed here") def fromMissingAttribute(allKeys: Set[String]): ValidationException = { val sb: StringBuilder = new StringBuilder("missing value for REQUIRED attribute") if (allKeys.size > 1) sb.append('s') - allKeys.foreach(k => sb.append("'%s'".format(k))) + allKeys.foreach(k => sb.append(s"'$k'")) ValidationException(sb.toString) } def fromMissingAttribute(key: String, tpe: String): ValidationException = - ValidationException("missing value for REQUIRED attribute %s of type %s".format(key, tpe)) + ValidationException(s"missing value for REQUIRED attribute $key of type $tpe") } diff --git a/shared/src/main/scala/scala/xml/dtd/impl/BaseBerrySethi.scala b/shared/src/main/scala/scala/xml/dtd/impl/BaseBerrySethi.scala index 6a055bf81..267277e0e 100644 --- a/shared/src/main/scala/scala/xml/dtd/impl/BaseBerrySethi.scala +++ b/shared/src/main/scala/scala/xml/dtd/impl/BaseBerrySethi.scala @@ -49,7 +49,7 @@ private[dtd] abstract class BaseBerrySethi { val (l1: Seq[lang._regexpT], l2: Seq[lang._regexpT]) = x.rs.span(_.isNullable) (l1 ++ l2.take(1)).map(compFunction).foldLeft(emptySet)(_ ++ _) case Star(t) => compFunction(t) - case _ => throw new IllegalArgumentException("unexpected pattern " + r.getClass) + case _ => throw new IllegalArgumentException(s"unexpected pattern ${r.getClass}") } /** Computes `first(r)` for the word regexp `r`. */ @@ -90,7 +90,7 @@ private[dtd] abstract class BaseBerrySethi { if (p.isNullable) fol ++ first else first } - case _ => throw new IllegalArgumentException("unexpected pattern: " + r.getClass) + case _ => throw new IllegalArgumentException(s"unexpected pattern: ${r.getClass}") } /** @@ -102,6 +102,6 @@ private[dtd] abstract class BaseBerrySethi { case x: Sequ => x.rs.foreach(traverse) case x: Meta => traverse(x.r) case Star(t) => traverse(t) - case _ => throw new IllegalArgumentException("unexp pattern " + r.getClass) + case _ => throw new IllegalArgumentException(s"unexp pattern ${r.getClass}") } } diff --git a/shared/src/main/scala/scala/xml/dtd/impl/DetWordAutom.scala b/shared/src/main/scala/scala/xml/dtd/impl/DetWordAutom.scala index 5eb986035..944024518 100644 --- a/shared/src/main/scala/scala/xml/dtd/impl/DetWordAutom.scala +++ b/shared/src/main/scala/scala/xml/dtd/impl/DetWordAutom.scala @@ -35,17 +35,13 @@ private[dtd] abstract class DetWordAutom[T <: AnyRef] { def next(q: Int, label: T): Int = delta(q).getOrElse(label, default(q)) override def toString: String = { - val sb: StringBuilder = new StringBuilder("[DetWordAutom nstates=") - sb.append(nstates) - sb.append(" finals=") val map: Map[Int, Int] = finals.zipWithIndex.map(_.swap).toMap - sb.append(map.toString) - sb.append(" delta=\n") + val sb: StringBuilder = new StringBuilder(s"[DetWordAutom nstates=$nstates finals=$map delta=\n") for (i <- 0.until(nstates)) { - sb.append("%d->%s\n".format(i, delta(i))) + sb.append(s"$i->${delta(i)}\n") if (i < default.length) - sb.append("_>%s\n".format(default(i))) + sb.append(s"_>${default(i)}\n") } sb.toString } diff --git a/shared/src/main/scala/scala/xml/dtd/impl/NondetWordAutom.scala b/shared/src/main/scala/scala/xml/dtd/impl/NondetWordAutom.scala index afa6c8ab9..1bfefcc35 100644 --- a/shared/src/main/scala/scala/xml/dtd/impl/NondetWordAutom.scala +++ b/shared/src/main/scala/scala/xml/dtd/impl/NondetWordAutom.scala @@ -56,11 +56,10 @@ private[dtd] abstract class NondetWordAutom[T <: AnyRef] { private def finalStates: immutable.Seq[Int] = 0.until(nstates).filter(isFinal) override def toString: String = { - val finalString: String = Map(finalStates.map(j => j -> finals(j)): _*).toString val deltaString: String = 0.until(nstates) - .map(i => " %d->%s\n _>%s\n".format(i, delta(i), default(i))).mkString + .map(i => s" $i->${delta(i)}\n _>${default(i)}\n").mkString - "[NondetWordAutom nstates=%d finals=%s delta=\n%s".format(nstates, finalString, deltaString) + s"[NondetWordAutom nstates=$nstates finals=$finalString delta=\n$deltaString" } } diff --git a/shared/src/main/scala/scala/xml/include/sax/XIncludeFilter.scala b/shared/src/main/scala/scala/xml/include/sax/XIncludeFilter.scala index 0b8ab37c5..9c70136bf 100644 --- a/shared/src/main/scala/scala/xml/include/sax/XIncludeFilter.scala +++ b/shared/src/main/scala/scala/xml/include/sax/XIncludeFilter.scala @@ -95,7 +95,7 @@ class XIncludeFilter extends XMLFilterImpl { bases.push(new URL(base)) } catch { case _: MalformedURLException => - throw new UnsupportedOperationException("Unrecognized SYSTEM ID: " + base) + throw new UnsupportedOperationException(s"Unrecognized SYSTEM ID: $base") } super.setDocumentLocator(locator) } @@ -129,8 +129,7 @@ class XIncludeFilter extends XMLFilterImpl { currentBase = new URL(parentBase, base) } catch { case e: MalformedURLException => - throw new SAXException("Malformed base URL: " - + currentBase, e) + throw new SAXException(s"Malformed base URL: $currentBase", e) } } bases push currentBase @@ -154,7 +153,7 @@ class XIncludeFilter extends XMLFilterImpl { } // Need to check this also in DOM and JDOM???? else { throw new SAXException( - "Illegal value for parse attribute: " + parse) + s"Illegal value for parse attribute: $parse") } level += 1 } else { @@ -235,9 +234,7 @@ class XIncludeFilter extends XMLFilterImpl { line = locator.getLineNumber column = locator.getColumnNumber } - locationString = (" in document included from " + publicID - + " at " + systemID - + " at line " + line + ", column " + column) + locationString = s" in document included from $publicID at $systemID at line $line, column $column" locationString } @@ -263,10 +260,9 @@ class XIncludeFilter extends XMLFilterImpl { source = new URL(base, url) } catch { case e: MalformedURLException => - val ex: UnavailableResourceException = new UnavailableResourceException("Unresolvable URL " + url - + getLocation) + val ex: UnavailableResourceException = new UnavailableResourceException(s"Unresolvable URL $url$getLocation") ex.setRootCause(e) - throw new SAXException("Unresolvable URL " + url + getLocation, ex) + throw new SAXException(s"Unresolvable URL $url$getLocation", ex) } try { @@ -299,11 +295,9 @@ class XIncludeFilter extends XMLFilterImpl { } ; charsRead != -1}) () } catch { case e: UnsupportedEncodingException => - throw new SAXException("Unsupported encoding: " - + encoding + getLocation, e) + throw new SAXException(s"Unsupported encoding: $encoding$getLocation", e) case e: IOException => - throw new SAXException("Document not found: " - + source.toExternalForm + getLocation, e) + throw new SAXException(s"Document not found: ${source.toExternalForm}$getLocation", e) } } @@ -324,9 +318,9 @@ class XIncludeFilter extends XMLFilterImpl { try new URL(bases.peek, url) catch { case e: MalformedURLException => - val ex: UnavailableResourceException = new UnavailableResourceException("Unresolvable URL " + url + getLocation) + val ex: UnavailableResourceException = new UnavailableResourceException(s"Unresolvable URL $url$getLocation") ex setRootCause e - throw new SAXException("Unresolvable URL " + url + getLocation, ex) + throw new SAXException(s"Unresolvable URL $url$getLocation", ex) } try { @@ -349,7 +343,7 @@ class XIncludeFilter extends XMLFilterImpl { if (bases.contains(source)) throw new SAXException( "Circular XInclude Reference", - new CircularIncludeException("Circular XInclude Reference to " + source + getLocation) + new CircularIncludeException(s"Circular XInclude Reference to $source$getLocation") ) bases push source @@ -361,7 +355,7 @@ class XIncludeFilter extends XMLFilterImpl { bases.pop() } catch { case e: IOException => - throw new SAXException("Document not found: " + source.toExternalForm + getLocation, e) + throw new SAXException(s"Document not found: ${source.toExternalForm}$getLocation", e) } } } diff --git a/shared/src/main/scala/scala/xml/include/sax/XIncluder.scala b/shared/src/main/scala/scala/xml/include/sax/XIncluder.scala index fd576e3a9..ec94be793 100644 --- a/shared/src/main/scala/scala/xml/include/sax/XIncluder.scala +++ b/shared/src/main/scala/scala/xml/include/sax/XIncluder.scala @@ -32,8 +32,7 @@ class XIncluder(outs: OutputStream, encoding: String) extends ContentHandler wit override def startDocument(): Unit = { try { - out.write("\r\n") + out.write(s"\r\n") } catch { case e: IOException => throw new SAXException("Write failed", e) @@ -55,17 +54,14 @@ class XIncluder(outs: OutputStream, encoding: String) extends ContentHandler wit override def startElement(namespaceURI: String, localName: String, qualifiedName: String, atts: Attributes): Unit = { try { - out.write("<" + qualifiedName) + out.write(s"<$qualifiedName") var i: Int = 0 while (i < atts.getLength) { - out.write(" ") - out.write(atts.getQName(i)) - out.write("='") val value: String = atts.getValue(i) // @todo Need to use character references if the encoding // can't support the character - out.write(scala.xml.Utility.escape(value)) - out.write("'") + val valueStr: String = scala.xml.Utility.escape(value) + out.write(s" ${atts.getQName(i)}='$valueStr'") i += 1 } out.write(">") @@ -77,7 +73,7 @@ class XIncluder(outs: OutputStream, encoding: String) extends ContentHandler wit override def endElement(namespaceURI: String, localName: String, qualifiedName: String): Unit = { try { - out.write("") + out.write(s"") } catch { case e: IOException => throw new SAXException("Write failed", e) @@ -113,7 +109,7 @@ class XIncluder(outs: OutputStream, encoding: String) extends ContentHandler wit // do I need to escape text in PI???? override def processingInstruction(target: String, data: String): Unit = { try { - out.write("") + out.write(s"") } catch { case e: IOException => throw new SAXException("Write failed", e) @@ -122,7 +118,7 @@ class XIncluder(outs: OutputStream, encoding: String) extends ContentHandler wit override def skippedEntity(name: String): Unit = { try { - out.write("&" + name + ";") + out.write(s"&$name;") } catch { case e: IOException => throw new SAXException("Write failed", e) @@ -138,10 +134,10 @@ class XIncluder(outs: OutputStream, encoding: String) extends ContentHandler wit // if this is the source document, output a DOCTYPE declaration if (entities.isEmpty) { var id: String = "" - if (publicID != null) id = " PUBLIC \"" + publicID + "\" \"" + systemID + '"' - else if (systemID != null) id = " SYSTEM \"" + systemID + '"' + if (publicID != null) id = s""" PUBLIC "$publicID" "$systemID"""" + else if (systemID != null) id = s""" SYSTEM "$systemID"""" try { - out.write("\r\n") + out.write(s"\r\n") } catch { case e: IOException => throw new SAXException("Error while writing DOCTYPE", e) @@ -151,7 +147,7 @@ class XIncluder(outs: OutputStream, encoding: String) extends ContentHandler wit override def endDTD(): Unit = () override def startEntity(name: String): Unit = { - entities = name :: entities + entities = name :: entities } override def endEntity(name: String): Unit = { diff --git a/shared/src/main/scala/scala/xml/parsing/ExternalSources.scala b/shared/src/main/scala/scala/xml/parsing/ExternalSources.scala index 74e49c237..778ef6278 100644 --- a/shared/src/main/scala/scala/xml/parsing/ExternalSources.scala +++ b/shared/src/main/scala/scala/xml/parsing/ExternalSources.scala @@ -34,6 +34,6 @@ trait ExternalSources { case x => x.take(x.lastIndexOf(separator) + 1) } - Source.fromFile(fileStr + systemId) + Source.fromFile(s"$fileStr$systemId") } } diff --git a/shared/src/main/scala/scala/xml/parsing/FactoryAdapter.scala b/shared/src/main/scala/scala/xml/parsing/FactoryAdapter.scala index 362c15160..d3f75dd5c 100644 --- a/shared/src/main/scala/scala/xml/parsing/FactoryAdapter.scala +++ b/shared/src/main/scala/scala/xml/parsing/FactoryAdapter.scala @@ -27,9 +27,7 @@ trait ConsoleErrorHandler extends DefaultHandler2 { protected def printError(errtype: String, ex: SAXParseException): Unit = Console.withOut(Console.err) { - val s: String = "[%s]:%d:%d: %s".format( - errtype, ex.getLineNumber, ex.getColumnNumber, ex.getMessage) - Console.println(s) + Console.println(s"[$errtype]:${ex.getLineNumber}:${ex.getColumnNumber}: ${ex.getMessage}") Console.flush() } } diff --git a/shared/src/main/scala/scala/xml/parsing/MarkupHandler.scala b/shared/src/main/scala/scala/xml/parsing/MarkupHandler.scala index 1628a75a1..ab647cf76 100755 --- a/shared/src/main/scala/scala/xml/parsing/MarkupHandler.scala +++ b/shared/src/main/scala/scala/xml/parsing/MarkupHandler.scala @@ -40,9 +40,9 @@ abstract class MarkupHandler { def replacementText(entityName: String): Source = Source.fromString(ent.get(entityName) match { case Some(ParsedEntityDecl(_, IntDef(value))) => value - case Some(ParameterEntityDecl(_, IntDef(value))) => " %s ".format(value) - case Some(_) => "".format(entityName) - case None => "".format(entityName) + case Some(ParameterEntityDecl(_, IntDef(value))) => s" value " + case Some(_) => s"" + case None => s"" }) def endDTD(n: String): Unit = () diff --git a/shared/src/main/scala/scala/xml/parsing/MarkupParser.scala b/shared/src/main/scala/scala/xml/parsing/MarkupParser.scala index 3bd46c0c0..f76520da7 100755 --- a/shared/src/main/scala/scala/xml/parsing/MarkupParser.scala +++ b/shared/src/main/scala/scala/xml/parsing/MarkupParser.scala @@ -40,7 +40,7 @@ trait MarkupParser extends MarkupParserCommon with TokenTests { override type NamespaceType = NamespaceBinding override def truncatedError(msg: String): Nothing = throw FatalError(msg) - override def errorNoEnd(tag: String): Nothing = throw FatalError("expected closing tag of " + tag) + override def errorNoEnd(tag: String): Nothing = throw FatalError(s"expected closing tag of $tag") override def xHandleError(that: Char, msg: String): Unit = reportSyntaxError(msg) @@ -182,7 +182,7 @@ trait MarkupParser extends MarkupParserCommon with TokenTests { case null => case Text(enc) => if (!isValidIANAEncoding(enc)) - reportSyntaxError("\"" + enc + "\" is not a valid encoding") + reportSyntaxError(s""""$enc" is not a valid encoding""") else { info_enc = Some(enc) n += 1 @@ -202,7 +202,7 @@ trait MarkupParser extends MarkupParserCommon with TokenTests { if (m.length - n != 0) { val s: String = if (isProlog) "SDDecl? " else "" - reportSyntaxError("VersionInfo EncodingDecl? %sor '?>' expected!".format(s)) + reportSyntaxError(s"VersionInfo EncodingDecl? $s or '?>' expected!") } (info_ver, info_enc, info_stdl) @@ -655,7 +655,7 @@ trait MarkupParser extends MarkupParserCommon with TokenTests { putChar(ch) //println("hello '"+ch+"'"+isPubIDChar(ch)) if (!isPubIDChar(ch)) - reportSyntaxError("char '" + ch + "' is not allowed in public id") + reportSyntaxError(s"char '$ch' is not allowed in public id") nextch() } nextch() @@ -752,7 +752,7 @@ trait MarkupParser extends MarkupParserCommon with TokenTests { xToken('>') case _ => - curInput.reportError(pos, "unexpected character '" + ch + "', expected some markupdecl") + curInput.reportError(pos, s"unexpected character '$ch', expected some markupdecl") while (ch != '>' && !eof) nextch() } @@ -776,7 +776,7 @@ trait MarkupParser extends MarkupParserCommon with TokenTests { case _ if isSpace(ch) => xSpace() case _ => - reportSyntaxError("markupdecl: unexpected character '" + ch + "' #" + ch.toInt) + reportSyntaxError(s"markupdecl: unexpected character '$ch' #${ch.toInt}") nextch() } diff --git a/shared/src/main/scala/scala/xml/parsing/MarkupParserCommon.scala b/shared/src/main/scala/scala/xml/parsing/MarkupParserCommon.scala index ff43221d5..8179b8a77 100644 --- a/shared/src/main/scala/scala/xml/parsing/MarkupParserCommon.scala +++ b/shared/src/main/scala/scala/xml/parsing/MarkupParserCommon.scala @@ -88,7 +88,7 @@ private[scala] trait MarkupParserCommon extends TokenTests { case `end` => return buf.toString case ch => buf.append(ch) } - scala.sys.error("Expected '%s'".format(end)) + scala.sys.error(s"Expected '$end'") } /** @@ -116,7 +116,7 @@ private[scala] trait MarkupParserCommon extends TokenTests { if (ch == SU) truncatedError("") else if (!isNameStart(ch)) - return errorAndResult("name expected, but char '%s' cannot start a name".format(ch), "") + return errorAndResult(s"name expected, but char '$ch' cannot start a name", "") val buf: StringBuilder = new StringBuilder @@ -136,7 +136,7 @@ private[scala] trait MarkupParserCommon extends TokenTests { case "apos" => "'" case "quot" => "\"" case "quote" => "\"" - case _ => "&" + s + ";" + case _ => s"&$s;" } /** @@ -206,7 +206,7 @@ private[scala] trait MarkupParserCommon extends TokenTests { def xToken(that: Char): Unit = { if (ch == that) nextch() - else xHandleError(that, "'%s' expected instead of '%s'".format(that, ch)) + else xHandleError(that, s"'$that' expected instead of '$ch'") } def xToken(that: Seq[Char]): Unit = that.foreach(xToken) diff --git a/shared/src/test/scala-2.x/scala/xml/TransformersTest.scala b/shared/src/test/scala-2.x/scala/xml/TransformersTest.scala index c67453e0e..9f7e744fc 100644 --- a/shared/src/test/scala-2.x/scala/xml/TransformersTest.scala +++ b/shared/src/test/scala-2.x/scala/xml/TransformersTest.scala @@ -67,7 +67,7 @@ class TransformersTest { n match { case t: Text if t.text.trim.nonEmpty => i += 1 - Text(t.text + "!") + Text(s"${t.text}!") case _ => n } } diff --git a/shared/src/test/scala/scala/xml/XMLTest.scala b/shared/src/test/scala/scala/xml/XMLTest.scala index 19d28c39b..2b1c553a2 100644 --- a/shared/src/test/scala/scala/xml/XMLTest.scala +++ b/shared/src/test/scala/scala/xml/XMLTest.scala @@ -25,7 +25,9 @@ class XMLTest {
val pelems_1: NodeSeq = for (x <- p \ "bar"; y <- p \ "baz") yield { - Text(x.attributes("value").toString + y.attributes("bazValue").toString + "!") + val value = x.attributes("value") + val bazValue = y.attributes("bazValue") + Text(s"$value$bazValue!") } val pelems_2: NodeSeq = NodeSeq.fromSeq(List(Text("38!"), Text("58!"))) From 4000a4f0e00e8df46908331293279e3305c665e8 Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Sat, 24 Jun 2023 18:35:29 +0000 Subject: [PATCH 675/789] Update sbt-scalajs, scalajs-compiler, ... to 1.13.2 --- project/plugins.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/plugins.sbt b/project/plugins.sbt index e1aefda6a..3a2b47886 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,6 +1,6 @@ addSbtPlugin("org.scala-lang.modules" % "sbt-scala-module" % "3.0.1") addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.3.1") addSbtPlugin("org.portable-scala" % "sbt-scala-native-crossproject" % "1.3.1") -addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.13.1") +addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.13.2") addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.4.14") addSbtPlugin("de.heikoseeberger" % "sbt-header" % "5.10.0") From 1febe86658b40673c6d7710aa2ebcf74722a537d Mon Sep 17 00:00:00 2001 From: Leonid Dubinsky Date: Wed, 21 Jun 2023 20:47:36 -0400 Subject: [PATCH 676/789] Equality cleanup: - replaced all `a.equals(b)` with `a == b`; - replaced all `a.eq(null)` with `a == null`; - replaced all `a.ne(null)` with `a != null`; - replaced all `a.eq(Null) with `a.isNull`; - replaced some `string == ""` with `string.isEmpty`; - removed some spurious braces. --- jvm/src/test/scala/scala/xml/XMLTest.scala | 30 +++++++++---------- .../src/main/scala/scala/xml/Attribute.scala | 6 ++-- shared/src/main/scala/scala/xml/Comment.scala | 7 ++--- .../src/main/scala/scala/xml/Equality.scala | 13 +++----- .../src/main/scala/scala/xml/MetaData.scala | 21 ++++++------- .../scala/scala/xml/NamespaceBinding.scala | 11 ++++--- shared/src/main/scala/scala/xml/Node.scala | 4 +-- shared/src/main/scala/scala/xml/NodeSeq.scala | 2 +- .../scala/scala/xml/PrefixedAttribute.scala | 13 ++++---- .../main/scala/scala/xml/PrettyPrinter.scala | 13 ++++---- .../src/main/scala/scala/xml/ProcInstr.scala | 6 ++-- .../src/main/scala/scala/xml/TopScope.scala | 6 ++-- .../scala/scala/xml/UnprefixedAttribute.scala | 10 ++++--- shared/src/main/scala/scala/xml/Utility.scala | 23 ++++++-------- shared/src/main/scala/scala/xml/XML.scala | 2 +- shared/src/main/scala/scala/xml/Xhtml.scala | 7 ++--- .../src/main/scala/scala/xml/dtd/Decl.scala | 6 ++-- .../xml/include/sax/XIncludeFilter.scala | 26 +++++++--------- .../xml/parsing/ElementContentModel.scala | 2 +- .../scala/xml/parsing/MarkupParser.scala | 4 +-- .../xml/parsing/MarkupParserCommon.scala | 3 +- .../xml/transform/BasicTransformer.scala | 3 +- .../xml/transform/NestingTransformer.scala | 3 +- .../scala/xml/transform/RuleTransformer.scala | 4 +-- .../test/scala/scala/xml/AttributeTest.scala | 2 +- 25 files changed, 98 insertions(+), 129 deletions(-) diff --git a/jvm/src/test/scala/scala/xml/XMLTest.scala b/jvm/src/test/scala/scala/xml/XMLTest.scala index 9d14219b4..a978e4bfa 100644 --- a/jvm/src/test/scala/scala/xml/XMLTest.scala +++ b/jvm/src/test/scala/scala/xml/XMLTest.scala @@ -2,8 +2,8 @@ package scala.xml import org.junit.{Test => UnitTest} import org.junit.Assert.{assertEquals, assertFalse, assertNull, assertThrows, assertTrue} -import java.io.StringWriter -import java.io.ByteArrayOutputStream +import java.io.{ByteArrayInputStream, ByteArrayOutputStream, InputStreamReader, IOException, ObjectInputStream, + ObjectOutputStream, OutputStreamWriter, PrintStream, StringWriter} import java.net.URL import scala.xml.dtd.{DocType, PublicID} import scala.xml.parsing.ConstructingParser @@ -177,26 +177,26 @@ class XMLTestJVM { """, f("a,b,c").toString) object Serialize { - @throws(classOf[java.io.IOException]) + @throws(classOf[IOException]) def write[A](o: A): Array[Byte] = { val ba: ByteArrayOutputStream = new ByteArrayOutputStream(512) - val out: java.io.ObjectOutputStream = new java.io.ObjectOutputStream(ba) + val out: ObjectOutputStream = new ObjectOutputStream(ba) out.writeObject(o) out.close() ba.toByteArray } - @throws(classOf[java.io.IOException]) + @throws(classOf[IOException]) @throws(classOf[ClassNotFoundException]) def read[A](buffer: Array[Byte]): A = { - val in: java.io.ObjectInputStream = - new java.io.ObjectInputStream(new java.io.ByteArrayInputStream(buffer)) + val in: ObjectInputStream = + new ObjectInputStream(new ByteArrayInputStream(buffer)) in.readObject().asInstanceOf[A] } def check[A, B](x: A, y: B): Unit = { // println("x = " + x) // println("y = " + y) - // println("x equals y: " + (x equals y) + ", y equals x: " + (y equals x)) - assertTrue(x.equals(y) && y.equals(x)) + // println("x == y: " + (x == y) + ", y == x: " + (y == x)) + assertTrue(x == y && y == x) // println() } } @@ -296,14 +296,14 @@ class XMLTestJVM { // scala.xml.XML.save("foo.xml", xml) // scala.xml.XML.loadFile("foo.xml").toString - val outputStream: java.io.ByteArrayOutputStream = new java.io.ByteArrayOutputStream - val streamWriter: java.io.OutputStreamWriter = new java.io.OutputStreamWriter(outputStream, "UTF-8") + val outputStream: ByteArrayOutputStream = new ByteArrayOutputStream + val streamWriter: OutputStreamWriter = new OutputStreamWriter(outputStream, "UTF-8") XML.write(streamWriter, xml, XML.encoding, xmlDecl = false, null) streamWriter.flush() - val inputStream: java.io.ByteArrayInputStream = new java.io.ByteArrayInputStream(outputStream.toByteArray) - val streamReader: java.io.InputStreamReader = new java.io.InputStreamReader(inputStream, XML.encoding) + val inputStream: ByteArrayInputStream = new ByteArrayInputStream(outputStream.toByteArray) + val streamReader: InputStreamReader = new InputStreamReader(inputStream, XML.encoding) assertEquals(xml.toString, XML.load(streamReader).toString) } @@ -492,8 +492,6 @@ class XMLTestJVM { @UnitTest def dontLoop(): Unit = { - import java.io.{ Console => _, _ } - val xml: String = " " val sink: PrintStream = new PrintStream(new ByteArrayOutputStream()) Console.withOut(sink) { @@ -1026,7 +1024,7 @@ class XMLTestJVM { def toSource(s: String): scala.io.Source = new scala.io.Source { override val iter: Iterator[Char] = s.iterator - override def reportError(pos: Int, msg: String, out: java.io.PrintStream = Console.err): Unit = () + override def reportError(pos: Int, msg: String, out: PrintStream = Console.err): Unit = () } @UnitTest diff --git a/shared/src/main/scala/scala/xml/Attribute.scala b/shared/src/main/scala/scala/xml/Attribute.scala index cb2b2d979..97457ab77 100644 --- a/shared/src/main/scala/scala/xml/Attribute.scala +++ b/shared/src/main/scala/scala/xml/Attribute.scala @@ -81,15 +81,13 @@ trait Attribute extends MetaData { } /** Returns an iterator on attributes */ - override def iterator: Iterator[MetaData] = { + override def iterator: Iterator[MetaData] = if (value == null) next.iterator else Iterator.single(this) ++ next.iterator - } - override def size: Int = { + override def size: Int = if (value == null) next.size else 1 + next.size - } /** * Appends string representation of only this attribute to stringbuffer. diff --git a/shared/src/main/scala/scala/xml/Comment.scala b/shared/src/main/scala/scala/xml/Comment.scala index aee8dc07c..6c27a0252 100644 --- a/shared/src/main/scala/scala/xml/Comment.scala +++ b/shared/src/main/scala/scala/xml/Comment.scala @@ -29,12 +29,11 @@ case class Comment(commentText: String) extends SpecialNode { final override def doCollectNamespaces: Boolean = false final override def doTransform: Boolean = false - if (commentText.contains("--")) { + if (commentText.contains("--")) throw new IllegalArgumentException(s"""text contains "--"""") - } - if (commentText.nonEmpty && commentText.charAt(commentText.length - 1) == '-') { + + if (commentText.nonEmpty && commentText.charAt(commentText.length - 1) == '-') throw new IllegalArgumentException("The final character of a XML comment may not be '-'. See https://www.w3.org/TR/xml11//#IDA5CES") - } /** * Appends "" to this string buffer. diff --git a/shared/src/main/scala/scala/xml/Equality.scala b/shared/src/main/scala/scala/xml/Equality.scala index d2b6e8ca9..3b48b2824 100644 --- a/shared/src/main/scala/scala/xml/Equality.scala +++ b/shared/src/main/scala/scala/xml/Equality.scala @@ -61,18 +61,13 @@ object Equality { case x: NodeSeq if x.length == 1 => x2 == x(0) case _ => false } - def compareBlithely(x1: AnyRef, x2: AnyRef): Boolean = { - if (x1 == null || x2 == null) - return x1.eq(x2) - - x2 match { + def compareBlithely(x1: AnyRef, x2: AnyRef): Boolean = + if (x1 == null || x2 == null) x1 == null && x2 == null else x2 match { case s: String => compareBlithely(x1, s) case n: Node => compareBlithely(x1, n) case _ => false } - } } -import Equality._ trait Equality extends scala.Equals { protected def basisForHashCode: Seq[Any] @@ -109,10 +104,10 @@ trait Equality extends scala.Equals { private def doComparison(other: Any, blithe: Boolean): Boolean = { val strictlyEqual: Boolean = other match { case x: AnyRef if this.eq(x) => true - case x: Equality => (x canEqual this) && (this strict_== x) + case x: Equality => x.canEqual(this) && this.strict_==(x) case _ => false } - strictlyEqual || (blithe && compareBlithely(this, asRef(other))) + strictlyEqual || (blithe && Equality.compareBlithely(this, Equality.asRef(other))) } } diff --git a/shared/src/main/scala/scala/xml/MetaData.scala b/shared/src/main/scala/scala/xml/MetaData.scala index b55b3187c..979311336 100644 --- a/shared/src/main/scala/scala/xml/MetaData.scala +++ b/shared/src/main/scala/scala/xml/MetaData.scala @@ -29,7 +29,7 @@ object MetaData { */ @tailrec def concatenate(attribs: MetaData, new_tail: MetaData): MetaData = - if (attribs.eq(Null)) new_tail + if (attribs.isNull) new_tail else concatenate(attribs.next, attribs.copy(new_tail)) /** @@ -37,20 +37,19 @@ object MetaData { * namespace URIs via the given scope. */ def normalize(attribs: MetaData, scope: NamespaceBinding): MetaData = { - def iterate(md: MetaData, normalized_attribs: MetaData, set: Set[String]): MetaData = { - if (md.eq(Null)) { + def iterate(md: MetaData, normalized_attribs: MetaData, set: Set[String]): MetaData = + if (md.isNull) { normalized_attribs - } else if (md.value.eq(null)) { + } else if (md.value == null) iterate(md.next, normalized_attribs, set) - } else { + else { val key: String = getUniversalKey(md, scope) - if (set(key)) { + if (set(key)) iterate(md.next, normalized_attribs, set) - } else { + else md.copy(iterate(md.next, normalized_attribs, set + key)) - } } - } + iterate(attribs, Null, Set()) } @@ -85,7 +84,9 @@ abstract class MetaData extends AbstractIterable[MetaData] with Iterable[MetaData] with Equality - with Serializable { + with Serializable +{ + private[xml] def isNull: Boolean = this.eq(Null) /** * Updates this MetaData with the MetaData given as argument. All attributes that occur in updates diff --git a/shared/src/main/scala/scala/xml/NamespaceBinding.scala b/shared/src/main/scala/scala/xml/NamespaceBinding.scala index 7e851edae..8efe27d79 100644 --- a/shared/src/main/scala/scala/xml/NamespaceBinding.scala +++ b/shared/src/main/scala/scala/xml/NamespaceBinding.scala @@ -29,8 +29,8 @@ case class NamespaceBinding(prefix: String, uri: String, parent: NamespaceBindin if (prefix == "") throw new IllegalArgumentException("zero length prefix not allowed") - def getURI(_prefix: String): String = - if (prefix == _prefix) uri else parent.getURI(_prefix) + def getURI(prefix: String): String = + if (this.prefix == prefix) uri else parent.getURI(prefix) /** * Returns some prefix that is mapped to the URI. @@ -39,8 +39,8 @@ case class NamespaceBinding(prefix: String, uri: String, parent: NamespaceBindin * @return the prefix that is mapped to the input URI, or null * if no prefix is mapped to the URI. */ - def getPrefix(_uri: String): String = - if (_uri == uri) prefix else parent.getPrefix(_uri) + def getPrefix(uri: String): String = + if (uri == this.uri) prefix else parent.getPrefix(uri) override def toString: String = Utility.sbToString(buildString(_, TopScope)) @@ -72,9 +72,8 @@ case class NamespaceBinding(prefix: String, uri: String, parent: NamespaceBindin def buildString(stop: NamespaceBinding): String = Utility.sbToString(buildString(_, stop)) - def buildString(sb: StringBuilder, stop: NamespaceBinding): Unit = { + def buildString(sb: StringBuilder, stop: NamespaceBinding): Unit = shadowRedefined(stop).doBuildString(sb, stop) - } private def doBuildString(sb: StringBuilder, stop: NamespaceBinding): Unit = { if (List(null, stop, TopScope).contains(this)) return diff --git a/shared/src/main/scala/scala/xml/Node.scala b/shared/src/main/scala/scala/xml/Node.scala index ff719ec48..f5337eeeb 100755 --- a/shared/src/main/scala/scala/xml/Node.scala +++ b/shared/src/main/scala/scala/xml/Node.scala @@ -82,7 +82,7 @@ abstract class Node extends NodeSeq { * @return the namespace if `scope != null` and prefix was * found, else `null` */ - def getNamespace(pre: String): String = if (scope.eq(null)) null else scope.getURI(pre) + def getNamespace(pre: String): String = if (scope == null) null else scope.getURI(pre) /** * Convenience method, looks up an unprefixed attribute in attributes of this node. @@ -125,7 +125,7 @@ abstract class Node extends NodeSeq { /** * Children which do not stringify to "" (needed for equality) */ - def nonEmptyChildren: Seq[Node] = child.filterNot(_.toString == "") + def nonEmptyChildren: Seq[Node] = child.filterNot(_.toString.isEmpty) /** * Descendant axis (all descendants of this node, not including node itself) diff --git a/shared/src/main/scala/scala/xml/NodeSeq.scala b/shared/src/main/scala/scala/xml/NodeSeq.scala index cbb5b047e..bdf316f92 100644 --- a/shared/src/main/scala/scala/xml/NodeSeq.scala +++ b/shared/src/main/scala/scala/xml/NodeSeq.scala @@ -103,7 +103,7 @@ abstract class NodeSeq extends AbstractSeq[Node] with immutable.Seq[Node] with S val i: Int = that.indexOf('}') if (i == -1) fail val (uri: String, key: String) = (that.substring(2, i), that.substring(i + 1, that.length)) - if (uri == "" || key == "") fail + if (uri.isEmpty || key.isEmpty) fail else y.attribute(uri, key) } else y.attribute(that.drop(1)) diff --git a/shared/src/main/scala/scala/xml/PrefixedAttribute.scala b/shared/src/main/scala/scala/xml/PrefixedAttribute.scala index bba655d59..3a3985fe5 100644 --- a/shared/src/main/scala/scala/xml/PrefixedAttribute.scala +++ b/shared/src/main/scala/scala/xml/PrefixedAttribute.scala @@ -28,13 +28,15 @@ class PrefixedAttribute( override val pre: String, override val key: String, override val value: Seq[Node], - val next1: MetaData) - extends Attribute { - override val next: MetaData = if (value.ne(null)) next1 else next1.remove(key) + val next1: MetaData +) + extends Attribute +{ + override val next: MetaData = if (value != null) next1 else next1.remove(key) /** same as this(pre, key, Text(value), next), or no attribute if value is null */ def this(pre: String, key: String, value: String, next: MetaData) = - this(pre, key, if (value.ne(null)) Text(value) else null: NodeSeq, next) + this(pre, key, if (value != null) Text(value) else null: NodeSeq, next) /** same as this(pre, key, value.get, next), or no attribute if value is None */ def this(pre: String, key: String, value: Option[Seq[Node]], next: MetaData) = @@ -56,12 +58,11 @@ class PrefixedAttribute( /** * gets attribute value of qualified (prefixed) attribute with given key */ - override def apply(namespace: String, scope: NamespaceBinding, key: String): Seq[Node] = { + override def apply(namespace: String, scope: NamespaceBinding, key: String): Seq[Node] = if (key == this.key && scope.getURI(pre) == namespace) value else next(namespace, scope, key) - } } object PrefixedAttribute { diff --git a/shared/src/main/scala/scala/xml/PrettyPrinter.scala b/shared/src/main/scala/scala/xml/PrettyPrinter.scala index dbc3d8111..e1e35c3c9 100755 --- a/shared/src/main/scala/scala/xml/PrettyPrinter.scala +++ b/shared/src/main/scala/scala/xml/PrettyPrinter.scala @@ -150,7 +150,7 @@ class PrettyPrinter(width: Int, step: Int, minimizeEmpty: Boolean) { protected def traverse(node: Node, pscope: NamespaceBinding, ind: Int): Unit = node match { - case Text(s) if s.trim == "" => + case Text(s) if s.trim.isEmpty => case _: Atom[_] | _: Comment | _: EntityRef | _: ProcInstr => makeBox(ind, node.toString.trim) @@ -163,18 +163,17 @@ class PrettyPrinter(width: Int, step: Int, minimizeEmpty: Boolean) { if (doPreserve(node)) sb.toString else TextBuffer.fromString(sb.toString).toText(0).data } - if (childrenAreLeaves(node) && fits(test)) { + if (childrenAreLeaves(node) && fits(test)) makeBox(ind, test) - } else { + else { val ((stg: String, len2: Int), etg: String) = if (node.child.isEmpty && minimizeEmpty) { // force the tag to be self-closing val firstAttribute: Int = test.indexOf(' ') val firstBreak: Int = if (firstAttribute != -1) firstAttribute else test.lastIndexOf('/') ((test, firstBreak), "") - } else { + } else (startTag(node, pscope), endTag(node)) - } if (stg.length < width - cur) { // start tag fits makeBox(ind, stg) @@ -221,9 +220,7 @@ class PrettyPrinter(width: Int, step: Int, minimizeEmpty: Boolean) { * @param n the node to be serialized * @param sb the stringbuffer to append to */ - def format(n: Node, sb: StringBuilder): Unit = { // entry point - format(n, TopScope, sb) - } + def format(n: Node, sb: StringBuilder): Unit = format(n, TopScope, sb) // entry point def format(n: Node, pscope: NamespaceBinding, sb: StringBuilder): Unit = { // entry point var lastwasbreak: Boolean = false diff --git a/shared/src/main/scala/scala/xml/ProcInstr.scala b/shared/src/main/scala/scala/xml/ProcInstr.scala index 4d09b373b..f12bc4a65 100644 --- a/shared/src/main/scala/scala/xml/ProcInstr.scala +++ b/shared/src/main/scala/scala/xml/ProcInstr.scala @@ -39,8 +39,6 @@ case class ProcInstr(target: String, proctext: String) extends SpecialNode { * appends "<?" target (" "+text)?+"?>" * to this stringbuffer. */ - override def buildString(sb: StringBuilder): StringBuilder = { - val textStr: String = if (proctext == "") "" else s" $proctext" - sb.append(s"") - } + override def buildString(sb: StringBuilder): StringBuilder = + sb.append(s"") } diff --git a/shared/src/main/scala/scala/xml/TopScope.scala b/shared/src/main/scala/scala/xml/TopScope.scala index 2dc77139e..0b82e4b63 100644 --- a/shared/src/main/scala/scala/xml/TopScope.scala +++ b/shared/src/main/scala/scala/xml/TopScope.scala @@ -20,13 +20,11 @@ package xml */ object TopScope extends NamespaceBinding(null, null, null) { - import XML.{xml, namespace} - override def getURI(prefix1: String): String = - if (prefix1 == xml) namespace else null + if (prefix1 == XML.xml) XML.namespace else null override def getPrefix(uri1: String): String = - if (uri1 == namespace) xml else null + if (uri1 == XML.namespace) XML.xml else null override def toString: String = "" diff --git a/shared/src/main/scala/scala/xml/UnprefixedAttribute.scala b/shared/src/main/scala/scala/xml/UnprefixedAttribute.scala index 86cf538e7..0f0446802 100644 --- a/shared/src/main/scala/scala/xml/UnprefixedAttribute.scala +++ b/shared/src/main/scala/scala/xml/UnprefixedAttribute.scala @@ -24,14 +24,16 @@ import scala.collection.Seq class UnprefixedAttribute( override val key: String, override val value: Seq[Node], - next1: MetaData) - extends Attribute { + next1: MetaData +) + extends Attribute +{ final override val pre: scala.Null = null - override val next: MetaData = if (value.ne(null)) next1 else next1.remove(key) + override val next: MetaData = if (value != null) next1 else next1.remove(key) /** same as this(key, Text(value), next), or no attribute if value is null */ def this(key: String, value: String, next: MetaData) = - this(key, if (value.ne(null)) Text(value) else null: NodeSeq, next) + this(key, if (value != null) Text(value) else null: NodeSeq, next) /** same as this(key, value.get, next), or no attribute if value is None */ def this(key: String, value: Option[Seq[Node]], next: MetaData) = diff --git a/shared/src/main/scala/scala/xml/Utility.scala b/shared/src/main/scala/scala/xml/Utility.scala index ab3592f2b..ff8a2fb4b 100755 --- a/shared/src/main/scala/scala/xml/Utility.scala +++ b/shared/src/main/scala/scala/xml/Utility.scala @@ -55,12 +55,11 @@ object Utility extends AnyRef with parsing.TokenTests { Elem(pre, lab, md, scp, children.isEmpty, children: _*) } - private def combineAdjacentTextNodes(children: Seq[Node]): Seq[Node] = { + private def combineAdjacentTextNodes(children: Seq[Node]): Seq[Node] = children.foldRight(Seq.empty[Node]) { case (Text(left), Text(right) +: nodes) => Text(left + right) +: nodes case (n, nodes) => n +: nodes } - } /** * trim a child of an element. `Attribute` values and `Atom` nodes that @@ -77,7 +76,7 @@ object Utility extends AnyRef with parsing.TokenTests { } /** returns a sorted attribute list */ - def sort(md: MetaData): MetaData = if (md.eq(Null) || md.next.eq(Null)) md else { + def sort(md: MetaData): MetaData = if (md.isNull || md.next.isNull) md else { val key: String = md.key val smaller: MetaData = sort(md.filter { m => m.key < key }) val greater: MetaData = sort(md.filter { m => m.key > key }) @@ -120,7 +119,7 @@ object Utility extends AnyRef with parsing.TokenTests { /** * Appends escaped string to `s`. */ - final def escape(text: String, s: StringBuilder): StringBuilder = { + final def escape(text: String, s: StringBuilder): StringBuilder = // Implemented per XML spec: // http://www.w3.org/International/questions/qa-controls text.iterator.foldLeft(s) { (s, c) => @@ -130,7 +129,6 @@ object Utility extends AnyRef with parsing.TokenTests { case _ => s // noop } } - } /** * Appends unescaped string to `s`, `amp` becomes `&`, @@ -151,7 +149,7 @@ object Utility extends AnyRef with parsing.TokenTests { /** * Adds all namespaces in node to set. */ - def collectNamespaces(n: Node, set: mutable.Set[String]): Unit = { + def collectNamespaces(n: Node, set: mutable.Set[String]): Unit = if (n.doCollectNamespaces) { set += n.namespace for (a <- n.attributes) a match { @@ -162,7 +160,6 @@ object Utility extends AnyRef with parsing.TokenTests { for (i <- n.child) collectNamespaces(i, set) } - } // def toXML( // x: Node, @@ -251,7 +248,7 @@ object Utility extends AnyRef with parsing.TokenTests { case e: Elem => sb.append('<') e.nameToString(sb) - if (e.attributes.ne(null)) e.attributes.buildString(sb) + if (e.attributes != null) e.attributes.buildString(sb) e.scope.buildString(sb, pscopes.head) if (e.child.isEmpty && (minimizeTags == MinimizeMode.Always || @@ -325,14 +322,12 @@ object Utility extends AnyRef with parsing.TokenTests { sb.append('"') } - def getName(s: String, index: Int): String = { - if (index >= s.length) null - else { + def getName(s: String, index: Int): String = + if (index >= s.length) null else { val xs: String = s.drop(index) if (xs.nonEmpty && isNameStart(xs.head)) xs.takeWhile(isNameChar) else "" } - } /** * Returns `'''null'''` if the value is a correct attribute value, @@ -346,7 +341,7 @@ object Utility extends AnyRef with parsing.TokenTests { return "< not allowed in attribute value" case '&' => val n: String = getName(value, i + 1) - if (n.eq(null)) + if (n == null) return s"malformed entity reference in attribute value [$value]" i = i + n.length + 1 if (i >= value.length || value.charAt(i) != ';') @@ -374,7 +369,7 @@ object Utility extends AnyRef with parsing.TokenTests { val theChar: String = parseCharRef ({ () => c }, { () => c = it.next() }, { s => throw new RuntimeException(s) }, { s => throw new RuntimeException(s) }) sb.append(theChar) } else { - if (rfb.eq(null)) rfb = new StringBuilder() + if (rfb == null) rfb = new StringBuilder() rfb.append(c) c = it.next() while (c != ';') { diff --git a/shared/src/main/scala/scala/xml/XML.scala b/shared/src/main/scala/scala/xml/XML.scala index 9cf06d13c..3dfe36b27 100755 --- a/shared/src/main/scala/scala/xml/XML.scala +++ b/shared/src/main/scala/scala/xml/XML.scala @@ -126,7 +126,7 @@ object XML extends XMLLoader[Elem] { ): Unit = { /* TODO: optimize by giving writer parameter to toXML*/ if (xmlDecl) w.write(s"\n") - if (doctype.ne(null)) w.write(s"$doctype\n") + if (doctype != null) w.write(s"$doctype\n") w.write(Utility.serialize(node, minimizeTags = minimizeTags).toString) } } diff --git a/shared/src/main/scala/scala/xml/Xhtml.scala b/shared/src/main/scala/scala/xml/Xhtml.scala index b30175eea..a7ce99d06 100644 --- a/shared/src/main/scala/scala/xml/Xhtml.scala +++ b/shared/src/main/scala/scala/xml/Xhtml.scala @@ -70,7 +70,7 @@ object Xhtml { case _ => sb.append('<') x.nameToString(sb) - if (x.attributes.ne(null)) x.attributes.buildString(sb) + if (x.attributes != null) x.attributes.buildString(sb) x.scope.buildString(sb, pscope) if (shortForm) sb.append(" />") @@ -95,10 +95,7 @@ object Xhtml { decodeEntities: Boolean = false, preserveWhitespace: Boolean = false, minimizeTags: Boolean = true - ): Unit = { - if (children.isEmpty) - return - + ): Unit = if (children.nonEmpty) { val doSpaces: Boolean = children.forall(isAtomAndNotText) // interleave spaces for (c <- children.take(children.length - 1)) { toXhtml(c, pscope, sb, stripComments, decodeEntities, preserveWhitespace, minimizeTags) diff --git a/shared/src/main/scala/scala/xml/dtd/Decl.scala b/shared/src/main/scala/scala/xml/dtd/Decl.scala index 570669dc2..c2cf53e18 100644 --- a/shared/src/main/scala/scala/xml/dtd/Decl.scala +++ b/shared/src/main/scala/scala/xml/dtd/Decl.scala @@ -37,8 +37,7 @@ sealed abstract class MarkupDecl extends Decl { /** * an element declaration */ -case class ElemDecl(name: String, contentModel: ContentModel) - extends MarkupDecl { +case class ElemDecl(name: String, contentModel: ContentModel) extends MarkupDecl { override def buildString(sb: StringBuilder): StringBuilder = { sb.append(s"") } diff --git a/shared/src/main/scala/scala/xml/include/sax/XIncludeFilter.scala b/shared/src/main/scala/scala/xml/include/sax/XIncludeFilter.scala index 9c70136bf..b82414d61 100644 --- a/shared/src/main/scala/scala/xml/include/sax/XIncludeFilter.scala +++ b/shared/src/main/scala/scala/xml/include/sax/XIncludeFilter.scala @@ -134,7 +134,7 @@ class XIncludeFilter extends XMLFilterImpl { } bases push currentBase - if (uri.equals(XINCLUDE_NAMESPACE) && localName.equals("include")) { + if (uri == XINCLUDE_NAMESPACE && localName == "include") { // include external document val href: String = atts.getValue("href") // Verify that there is an href attribute @@ -145,16 +145,13 @@ class XIncludeFilter extends XMLFilterImpl { var parse: String = atts.getValue("parse") if (parse == null) parse = "xml" - if (parse.equals("text")) { - val encoding: String = atts.getValue("encoding") - includeTextDocument(href, encoding) - } else if (parse.equals("xml")) { + if (parse == "text") + includeTextDocument(href, atts.getValue("encoding")) + else if (parse == "xml") includeXMLDocument(href) - } // Need to check this also in DOM and JDOM???? - else { - throw new SAXException( - s"Illegal value for parse attribute: $parse") - } + // Need to check this also in DOM and JDOM???? + else + throw new SAXException(s"Illegal value for parse attribute: $parse") level += 1 } else { if (atRoot) { @@ -171,8 +168,7 @@ class XIncludeFilter extends XMLFilterImpl { } override def endElement(uri: String, localName: String, qName: String): Unit = { - if (uri.equals(XINCLUDE_NAMESPACE) - && localName.equals("include")) { + if (uri == XINCLUDE_NAMESPACE && localName == "include") { level -= 1 } else if (level == 0) { bases.pop() @@ -253,7 +249,7 @@ class XIncludeFilter extends XMLFilterImpl { */ private def includeTextDocument(url: String, encoding1: String): Unit = { var encoding: String = encoding1 - if (encoding == null || encoding.trim.equals("")) encoding = "UTF-8" + if (encoding == null || encoding.trim.isEmpty) encoding = "UTF-8" var source: URL = null try { val base: URL = bases.peek @@ -278,8 +274,8 @@ class XIncludeFilter extends XMLFilterImpl { // Java may be picking this up from file URL if (contentType != null) { contentType = contentType.toLowerCase - if (contentType.equals("text/xml") - || contentType.equals("application/xml") + if (contentType == "text/xml" + || contentType == "application/xml" || (contentType.startsWith("text/") && contentType.endsWith("+xml")) || (contentType.startsWith("application/") && contentType.endsWith("+xml"))) { encoding = EncodingHeuristics.readEncodingFromStream(in) diff --git a/shared/src/main/scala/scala/xml/parsing/ElementContentModel.scala b/shared/src/main/scala/scala/xml/parsing/ElementContentModel.scala index 832297c5a..cb7316d6e 100644 --- a/shared/src/main/scala/scala/xml/parsing/ElementContentModel.scala +++ b/shared/src/main/scala/scala/xml/parsing/ElementContentModel.scala @@ -105,7 +105,7 @@ private[parsing] object ElementContentModel { val string: String = removeParentheses(parenthesized) if (occurrence == Occurrence.Once && string == PCData.value) PCData else if (occurrence == Occurrence.RepeatOptional) { val choice: List[String] = Elements.Choice.split(string) - if (choice.length > 1 && choice.head == PCData.value) Mixed(choice.tail.map(Elements.Element)) + if (choice.length > 1 && choice.head == PCData.value) Mixed(choice.tail.map(Elements.Element.apply)) else Children.parse(string, occurrence) } else Children.parse(string, occurrence) } diff --git a/shared/src/main/scala/scala/xml/parsing/MarkupParser.scala b/shared/src/main/scala/scala/xml/parsing/MarkupParser.scala index f76520da7..2ca4773cb 100755 --- a/shared/src/main/scala/scala/xml/parsing/MarkupParser.scala +++ b/shared/src/main/scala/scala/xml/parsing/MarkupParser.scala @@ -523,7 +523,7 @@ trait MarkupParser extends MarkupParserCommon with TokenTests { */ def parseDTD(): Unit = { // dirty but fast var extID: ExternalID = null - if (this.dtd.ne(null)) + if (dtd != null) reportSyntaxError("unexpected character (DOCTYPE already defined") xToken("DOCTYPE") xSpace() @@ -562,7 +562,7 @@ trait MarkupParser extends MarkupParserCommon with TokenTests { /*override val */ decls = handle.decls.reverse } //this.dtd.initializeEntities(); - if (doc.ne(null)) + if (doc != null) doc.dtd = this.dtd handle.endDTD(n) diff --git a/shared/src/main/scala/scala/xml/parsing/MarkupParserCommon.scala b/shared/src/main/scala/scala/xml/parsing/MarkupParserCommon.scala index 8179b8a77..be88269d2 100644 --- a/shared/src/main/scala/scala/xml/parsing/MarkupParserCommon.scala +++ b/shared/src/main/scala/scala/xml/parsing/MarkupParserCommon.scala @@ -120,8 +120,7 @@ private[scala] trait MarkupParserCommon extends TokenTests { val buf: StringBuilder = new StringBuilder - while ({ buf.append(ch_returning_nextch) - ; isNameChar(ch)}) () + while ({ buf.append(ch_returning_nextch); isNameChar(ch)}) () if (buf.last == ':') { reportSyntaxError("name cannot end in ':'") diff --git a/shared/src/main/scala/scala/xml/transform/BasicTransformer.scala b/shared/src/main/scala/scala/xml/transform/BasicTransformer.scala index 999fe4b75..7ad543b46 100644 --- a/shared/src/main/scala/scala/xml/transform/BasicTransformer.scala +++ b/shared/src/main/scala/scala/xml/transform/BasicTransformer.scala @@ -42,7 +42,7 @@ abstract class BasicTransformer extends (Node => Node) { else ns } - def transform(n: Node): Seq[Node] = { + def transform(n: Node): Seq[Node] = if (n.doTransform) n match { case Group(xs) => Group(transform(xs)) // un-group the hack Group tag case _ => @@ -53,7 +53,6 @@ abstract class BasicTransformer extends (Node => Node) { else Elem(n.prefix, n.label, n.attributes, n.scope, nch.isEmpty, nch: _*) } else n - } override def apply(n: Node): Node = { val seq: Seq[Node] = transform(n) diff --git a/shared/src/main/scala/scala/xml/transform/NestingTransformer.scala b/shared/src/main/scala/scala/xml/transform/NestingTransformer.scala index f0b7d69b4..52ee1997c 100644 --- a/shared/src/main/scala/scala/xml/transform/NestingTransformer.scala +++ b/shared/src/main/scala/scala/xml/transform/NestingTransformer.scala @@ -17,7 +17,6 @@ package transform import scala.collection.Seq class NestingTransformer(rule: RewriteRule) extends BasicTransformer { - override def transform(n: Node): Seq[Node] = { + override def transform(n: Node): Seq[Node] = rule.transform(super.transform(n)) - } } diff --git a/shared/src/main/scala/scala/xml/transform/RuleTransformer.scala b/shared/src/main/scala/scala/xml/transform/RuleTransformer.scala index 657b1b73c..60288fb06 100644 --- a/shared/src/main/scala/scala/xml/transform/RuleTransformer.scala +++ b/shared/src/main/scala/scala/xml/transform/RuleTransformer.scala @@ -18,8 +18,8 @@ import scala.collection.Seq class RuleTransformer(rules: RewriteRule*) extends BasicTransformer { private val transformers: Seq[NestingTransformer] = rules.map(new NestingTransformer(_)) - override def transform(n: Node): Seq[Node] = { + + override def transform(n: Node): Seq[Node] = if (transformers.isEmpty) n else transformers.tail.foldLeft(transformers.head.transform(n)) { (res, transformer) => transformer.transform(res) } - } } diff --git a/shared/src/test/scala/scala/xml/AttributeTest.scala b/shared/src/test/scala/scala/xml/AttributeTest.scala index 908042660..5f1a61343 100644 --- a/shared/src/test/scala/scala/xml/AttributeTest.scala +++ b/shared/src/test/scala/scala/xml/AttributeTest.scala @@ -21,7 +21,7 @@ class AttributeTest { var appended: MetaData = x.append(x).append(x).append(x) var len: Int = 0 - while (appended.ne(Null)) { + while (!appended.isNull) { appended = appended.next len = len + 1 } From c365c251a5319f36001e9df0d1582337a744ecff Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Fri, 30 Jun 2023 01:04:39 +0000 Subject: [PATCH 677/789] Update sbt to 1.9.1 --- project/build.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/build.properties b/project/build.properties index 40b3b8e7b..3c0b78a7c 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version=1.9.0 +sbt.version=1.9.1 From c24a7cdf29022df8570fc79582f0807c0446ec33 Mon Sep 17 00:00:00 2001 From: Scala Steward <43047562+scala-steward@users.noreply.github.com> Date: Tue, 11 Jul 2023 22:29:59 +0200 Subject: [PATCH 678/789] Update sbt-scala-native-crossproject, ... to 1.3.2 (#682) --- project/plugins.sbt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/project/plugins.sbt b/project/plugins.sbt index 3a2b47886..cc0b6e27a 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,6 +1,6 @@ addSbtPlugin("org.scala-lang.modules" % "sbt-scala-module" % "3.0.1") -addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.3.1") -addSbtPlugin("org.portable-scala" % "sbt-scala-native-crossproject" % "1.3.1") +addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.3.2") +addSbtPlugin("org.portable-scala" % "sbt-scala-native-crossproject" % "1.3.2") addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.13.2") addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.4.14") addSbtPlugin("de.heikoseeberger" % "sbt-header" % "5.10.0") From 535b7dad9a8a25d96d3a8c47c5ef07adfede8bc1 Mon Sep 17 00:00:00 2001 From: Seth Tisue Date: Tue, 11 Jul 2023 13:30:28 -0700 Subject: [PATCH 679/789] sbt 1.9.2 (was .1) --- project/build.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/build.properties b/project/build.properties index 3c0b78a7c..875b706a8 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version=1.9.1 +sbt.version=1.9.2 From e3b66db0a0b47533cc2a51cd8f7c157c69517d13 Mon Sep 17 00:00:00 2001 From: Seth Tisue Date: Tue, 11 Jul 2023 13:30:36 -0700 Subject: [PATCH 680/789] sbt-scala-module 3.1.0 (was 3.0.1) --- project/plugins.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/plugins.sbt b/project/plugins.sbt index cc0b6e27a..6f6beee39 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,4 +1,4 @@ -addSbtPlugin("org.scala-lang.modules" % "sbt-scala-module" % "3.0.1") +addSbtPlugin("org.scala-lang.modules" % "sbt-scala-module" % "3.1.0") addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.3.2") addSbtPlugin("org.portable-scala" % "sbt-scala-native-crossproject" % "1.3.2") addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.13.2") From 64844e70b50c6f90487e5c4c182033020447803f Mon Sep 17 00:00:00 2001 From: kenji yoshida <6b656e6a69@gmail.com> Date: Mon, 17 Jul 2023 21:32:40 +0900 Subject: [PATCH 681/789] add dependabot.yml --- .github/dependabot.yml | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 .github/dependabot.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 000000000..5ace4600a --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,6 @@ +version: 2 +updates: + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "weekly" From a9987da0b5aa2195aa5db4f48d10b64037fb05df Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 20 Jul 2023 01:45:26 +0000 Subject: [PATCH 682/789] Bump actions/setup-java from 2 to 3 Bumps [actions/setup-java](https://github.com/actions/setup-java) from 2 to 3. - [Release notes](https://github.com/actions/setup-java/releases) - [Commits](https://github.com/actions/setup-java/compare/v2...v3) --- updated-dependencies: - dependency-name: actions/setup-java dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index d69ab7208..91a2a000a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -9,7 +9,7 @@ jobs: - uses: actions/checkout@v2 with: fetch-depth: 0 - - uses: actions/setup-java@v2 + - uses: actions/setup-java@v3 with: distribution: temurin java-version: 8 From b48e270cc7e0b5fdebfaefa884316ad58b3096b6 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 20 Jul 2023 01:45:29 +0000 Subject: [PATCH 683/789] Bump actions/checkout from 2 to 3 Bumps [actions/checkout](https://github.com/actions/checkout) from 2 to 3. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/checkout/compare/v2...v3) --- updated-dependencies: - dependency-name: actions/checkout dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/ci.yml | 2 +- .github/workflows/release.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 123806c2a..663a4af3f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,7 +13,7 @@ jobs: scala: [2.12.x, 2.13.x, 3.x] runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 with: fetch-depth: 0 - uses: actions/setup-java@v3 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index d69ab7208..3cadd75c7 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -6,7 +6,7 @@ jobs: publish: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 with: fetch-depth: 0 - uses: actions/setup-java@v2 From 50c26cc7ec77fb9c003321bbc17b24e5244ec0f5 Mon Sep 17 00:00:00 2001 From: Scala Steward <43047562+scala-steward@users.noreply.github.com> Date: Thu, 27 Jul 2023 17:02:02 +0200 Subject: [PATCH 684/789] Update sbt to 1.9.3 (#690) --- project/build.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/build.properties b/project/build.properties index 875b706a8..52413ab79 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version=1.9.2 +sbt.version=1.9.3 From f7972a4c1f9c4d335492fb44175b6033b2cec4a5 Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Fri, 28 Jul 2023 22:35:59 +0000 Subject: [PATCH 685/789] Update commons-lang3 to 3.13.0 --- build.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index a7b82237a..b39f246bf 100644 --- a/build.sbt +++ b/build.sbt @@ -120,7 +120,7 @@ lazy val xml = crossProject(JSPlatform, JVMPlatform, NativePlatform) libraryDependencies += "junit" % "junit" % "4.13.2" % Test, libraryDependencies += "com.github.sbt" % "junit-interface" % "0.13.3" % Test, - libraryDependencies += "org.apache.commons" % "commons-lang3" % "3.12.0" % Test, + libraryDependencies += "org.apache.commons" % "commons-lang3" % "3.13.0" % Test, libraryDependencies += "xerces" % "xercesImpl" % "2.12.2" % Test, libraryDependencies ++= (CrossVersion.partialVersion(scalaVersion.value) match { case Some((3, _)) => From 11a098b171f03f6880c7cf7a90050ad07489eb68 Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Sat, 26 Aug 2023 05:21:24 +0000 Subject: [PATCH 686/789] Update sbt to 1.9.4 --- project/build.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/build.properties b/project/build.properties index 52413ab79..304098715 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version=1.9.3 +sbt.version=1.9.4 From a33cbfc12d7f7ff22885813522531c249609e22a Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Thu, 7 Sep 2023 06:26:45 +0000 Subject: [PATCH 687/789] Update junit-runtime, nscplugin, ... to 0.4.15 --- project/plugins.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/plugins.sbt b/project/plugins.sbt index 6f6beee39..7f0577ff2 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -2,5 +2,5 @@ addSbtPlugin("org.scala-lang.modules" % "sbt-scala-module" % "3.1.0") addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.3.2") addSbtPlugin("org.portable-scala" % "sbt-scala-native-crossproject" % "1.3.2") addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.13.2") -addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.4.14") +addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.4.15") addSbtPlugin("de.heikoseeberger" % "sbt-header" % "5.10.0") From 372276c622e4dc29ddda175abb0ce2285830abae Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Sun, 10 Sep 2023 22:19:17 +0000 Subject: [PATCH 688/789] Update scala3-library, ... to 3.3.1 --- .circleci/config.yml | 10 +++++----- build.sbt | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 02ee2b509..e9c5216ef 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -102,7 +102,7 @@ workflows: - scala_job: name: 3.x java_version: jdk8 - scala_version: 3.3.0 + scala_version: 3.3.1 - scala_job: name: jdk11_2.12.x java_version: jdk11 @@ -114,7 +114,7 @@ workflows: - scala_job: name: jdk11_3.x java_version: jdk11 - scala_version: 3.3.0 + scala_version: 3.3.1 - scala_job: name: jdk17_2.12.x java_version: jdk17 @@ -126,7 +126,7 @@ workflows: - scala_job: name: jdk17_3.x java_version: jdk17 - scala_version: 3.3.0 + scala_version: 3.3.1 - scalajs_job: name: sjs1.0_2.12.x scala_version: 2.12.18 @@ -135,7 +135,7 @@ workflows: scala_version: 2.13.11 - scalajs_job: name: sjs1.0_3.x - scala_version: 3.3.0 + scala_version: 3.3.1 - scalanative_job: name: native0.4_2.12.x scala_version: 2.12.18 @@ -144,4 +144,4 @@ workflows: scala_version: 2.13.11 - scalanative_job: name: native0.4_3.x - scala_version: 3.3.0 + scala_version: 3.3.1 diff --git a/build.sbt b/build.sbt index b39f246bf..93aee3cc8 100644 --- a/build.sbt +++ b/build.sbt @@ -36,7 +36,7 @@ lazy val xml = crossProject(JSPlatform, JVMPlatform, NativePlatform) .settings( name := "scala-xml", scalaModuleAutomaticModuleName := Some("scala.xml"), - crossScalaVersions := Seq("2.13.11", "2.12.18", "3.3.0"), + crossScalaVersions := Seq("2.13.11", "2.12.18", "3.3.1"), scalaVersion := "2.12.18", scalacOptions ++= (CrossVersion.partialVersion(scalaVersion.value) match { From 80482dd46c4601ccb240caf04bd111813303915f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 11 Sep 2023 04:33:54 +0000 Subject: [PATCH 689/789] Bump actions/checkout from 3 to 4 Bumps [actions/checkout](https://github.com/actions/checkout) from 3 to 4. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/checkout/compare/v3...v4) --- updated-dependencies: - dependency-name: actions/checkout dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/ci.yml | 2 +- .github/workflows/release.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 663a4af3f..c93a92b5e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,7 +13,7 @@ jobs: scala: [2.12.x, 2.13.x, 3.x] runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 0 - uses: actions/setup-java@v3 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 5a9fad6f1..2184746d6 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -6,7 +6,7 @@ jobs: publish: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 0 - uses: actions/setup-java@v3 From a9815e3b94c9af4b418dadf662c68aca211b3159 Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Wed, 13 Sep 2023 02:52:14 +0000 Subject: [PATCH 690/789] Update scala-compiler, scala-library to 2.13.12 --- .circleci/config.yml | 10 +++++----- build.sbt | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 02ee2b509..e473c27d0 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -98,7 +98,7 @@ workflows: - scala_job: name: 2.13.x java_version: jdk8 - scala_version: 2.13.11 + scala_version: 2.13.12 - scala_job: name: 3.x java_version: jdk8 @@ -110,7 +110,7 @@ workflows: - scala_job: name: jdk11_2.13.x java_version: jdk11 - scala_version: 2.13.11 + scala_version: 2.13.12 - scala_job: name: jdk11_3.x java_version: jdk11 @@ -122,7 +122,7 @@ workflows: - scala_job: name: jdk17_2.13.x java_version: jdk17 - scala_version: 2.13.11 + scala_version: 2.13.12 - scala_job: name: jdk17_3.x java_version: jdk17 @@ -132,7 +132,7 @@ workflows: scala_version: 2.12.18 - scalajs_job: name: sjs1.0_2.13.x - scala_version: 2.13.11 + scala_version: 2.13.12 - scalajs_job: name: sjs1.0_3.x scala_version: 3.3.0 @@ -141,7 +141,7 @@ workflows: scala_version: 2.12.18 - scalanative_job: name: native0.4_2.13.x - scala_version: 2.13.11 + scala_version: 2.13.12 - scalanative_job: name: native0.4_3.x scala_version: 3.3.0 diff --git a/build.sbt b/build.sbt index b39f246bf..43512cdad 100644 --- a/build.sbt +++ b/build.sbt @@ -36,7 +36,7 @@ lazy val xml = crossProject(JSPlatform, JVMPlatform, NativePlatform) .settings( name := "scala-xml", scalaModuleAutomaticModuleName := Some("scala.xml"), - crossScalaVersions := Seq("2.13.11", "2.12.18", "3.3.0"), + crossScalaVersions := Seq("2.13.12", "2.12.18", "3.3.0"), scalaVersion := "2.12.18", scalacOptions ++= (CrossVersion.partialVersion(scalaVersion.value) match { From d108fdc43e2f0828e8f8a84ad865aedb48fb2e3b Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Thu, 14 Sep 2023 02:54:25 +0000 Subject: [PATCH 691/789] Revert commit(s) a9815e3 --- .circleci/config.yml | 10 +++++----- build.sbt | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index e473c27d0..02ee2b509 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -98,7 +98,7 @@ workflows: - scala_job: name: 2.13.x java_version: jdk8 - scala_version: 2.13.12 + scala_version: 2.13.11 - scala_job: name: 3.x java_version: jdk8 @@ -110,7 +110,7 @@ workflows: - scala_job: name: jdk11_2.13.x java_version: jdk11 - scala_version: 2.13.12 + scala_version: 2.13.11 - scala_job: name: jdk11_3.x java_version: jdk11 @@ -122,7 +122,7 @@ workflows: - scala_job: name: jdk17_2.13.x java_version: jdk17 - scala_version: 2.13.12 + scala_version: 2.13.11 - scala_job: name: jdk17_3.x java_version: jdk17 @@ -132,7 +132,7 @@ workflows: scala_version: 2.12.18 - scalajs_job: name: sjs1.0_2.13.x - scala_version: 2.13.12 + scala_version: 2.13.11 - scalajs_job: name: sjs1.0_3.x scala_version: 3.3.0 @@ -141,7 +141,7 @@ workflows: scala_version: 2.12.18 - scalanative_job: name: native0.4_2.13.x - scala_version: 2.13.12 + scala_version: 2.13.11 - scalanative_job: name: native0.4_3.x scala_version: 3.3.0 diff --git a/build.sbt b/build.sbt index 43512cdad..b39f246bf 100644 --- a/build.sbt +++ b/build.sbt @@ -36,7 +36,7 @@ lazy val xml = crossProject(JSPlatform, JVMPlatform, NativePlatform) .settings( name := "scala-xml", scalaModuleAutomaticModuleName := Some("scala.xml"), - crossScalaVersions := Seq("2.13.12", "2.12.18", "3.3.0"), + crossScalaVersions := Seq("2.13.11", "2.12.18", "3.3.0"), scalaVersion := "2.12.18", scalacOptions ++= (CrossVersion.partialVersion(scalaVersion.value) match { From 1f221d2ac7dcb03fbe67a27d16864d6853adf2f7 Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Thu, 14 Sep 2023 02:54:26 +0000 Subject: [PATCH 692/789] Update scala-compiler, scala-library to 2.13.12 --- .circleci/config.yml | 10 +++++----- build.sbt | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index e9c5216ef..d9865c8b6 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -98,7 +98,7 @@ workflows: - scala_job: name: 2.13.x java_version: jdk8 - scala_version: 2.13.11 + scala_version: 2.13.12 - scala_job: name: 3.x java_version: jdk8 @@ -110,7 +110,7 @@ workflows: - scala_job: name: jdk11_2.13.x java_version: jdk11 - scala_version: 2.13.11 + scala_version: 2.13.12 - scala_job: name: jdk11_3.x java_version: jdk11 @@ -122,7 +122,7 @@ workflows: - scala_job: name: jdk17_2.13.x java_version: jdk17 - scala_version: 2.13.11 + scala_version: 2.13.12 - scala_job: name: jdk17_3.x java_version: jdk17 @@ -132,7 +132,7 @@ workflows: scala_version: 2.12.18 - scalajs_job: name: sjs1.0_2.13.x - scala_version: 2.13.11 + scala_version: 2.13.12 - scalajs_job: name: sjs1.0_3.x scala_version: 3.3.1 @@ -141,7 +141,7 @@ workflows: scala_version: 2.12.18 - scalanative_job: name: native0.4_2.13.x - scala_version: 2.13.11 + scala_version: 2.13.12 - scalanative_job: name: native0.4_3.x scala_version: 3.3.1 diff --git a/build.sbt b/build.sbt index 93aee3cc8..bc47f535d 100644 --- a/build.sbt +++ b/build.sbt @@ -36,7 +36,7 @@ lazy val xml = crossProject(JSPlatform, JVMPlatform, NativePlatform) .settings( name := "scala-xml", scalaModuleAutomaticModuleName := Some("scala.xml"), - crossScalaVersions := Seq("2.13.11", "2.12.18", "3.3.1"), + crossScalaVersions := Seq("2.13.12", "2.12.18", "3.3.1"), scalaVersion := "2.12.18", scalacOptions ++= (CrossVersion.partialVersion(scalaVersion.value) match { From 29c85c12e8010ab98c94e49272b46f77b49ba0ea Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Mon, 18 Sep 2023 22:01:03 +0000 Subject: [PATCH 693/789] Update sbt to 1.9.6 --- project/build.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/build.properties b/project/build.properties index 304098715..27430827b 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version=1.9.4 +sbt.version=1.9.6 From 038cbb609b89869e4ee4b181bd1b785beba8b237 Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Tue, 26 Sep 2023 18:54:37 +0000 Subject: [PATCH 694/789] Update sbt-scalajs, scalajs-compiler, ... to 1.14.0 --- project/plugins.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/plugins.sbt b/project/plugins.sbt index 7f0577ff2..2313f8621 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,6 +1,6 @@ addSbtPlugin("org.scala-lang.modules" % "sbt-scala-module" % "3.1.0") addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.3.2") addSbtPlugin("org.portable-scala" % "sbt-scala-native-crossproject" % "1.3.2") -addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.13.2") +addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.14.0") addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.4.15") addSbtPlugin("de.heikoseeberger" % "sbt-header" % "5.10.0") From 45176f456fd0b9b7020673f0c4ca094a2bd6a5c4 Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Tue, 17 Oct 2023 02:48:32 +0000 Subject: [PATCH 695/789] Update junit-runtime, nscplugin, ... to 0.4.16 --- project/plugins.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/plugins.sbt b/project/plugins.sbt index 2313f8621..23a6b788d 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -2,5 +2,5 @@ addSbtPlugin("org.scala-lang.modules" % "sbt-scala-module" % "3.1.0") addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.3.2") addSbtPlugin("org.portable-scala" % "sbt-scala-native-crossproject" % "1.3.2") addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.14.0") -addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.4.15") +addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.4.16") addSbtPlugin("de.heikoseeberger" % "sbt-header" % "5.10.0") From 336cf4cffbc215b5aaa747fdff442987899960aa Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Wed, 25 Oct 2023 05:01:49 +0000 Subject: [PATCH 696/789] Update sbt to 1.9.7 --- project/build.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/build.properties b/project/build.properties index 27430827b..e8a1e246e 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version=1.9.6 +sbt.version=1.9.7 From b92130e2482ed0cf3b5cbc2f5fab19cf8007e7dc Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Thu, 23 Nov 2023 21:25:26 +0000 Subject: [PATCH 697/789] Update commons-lang3 to 3.14.0 --- build.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index bc47f535d..823eec0b3 100644 --- a/build.sbt +++ b/build.sbt @@ -120,7 +120,7 @@ lazy val xml = crossProject(JSPlatform, JVMPlatform, NativePlatform) libraryDependencies += "junit" % "junit" % "4.13.2" % Test, libraryDependencies += "com.github.sbt" % "junit-interface" % "0.13.3" % Test, - libraryDependencies += "org.apache.commons" % "commons-lang3" % "3.13.0" % Test, + libraryDependencies += "org.apache.commons" % "commons-lang3" % "3.14.0" % Test, libraryDependencies += "xerces" % "xercesImpl" % "2.12.2" % Test, libraryDependencies ++= (CrossVersion.partialVersion(scalaVersion.value) match { case Some((3, _)) => From 2e0d1bbb427663a19f7fcc81bd0589d645845814 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 4 Dec 2023 04:43:47 +0000 Subject: [PATCH 698/789] Bump actions/setup-java from 3 to 4 Bumps [actions/setup-java](https://github.com/actions/setup-java) from 3 to 4. - [Release notes](https://github.com/actions/setup-java/releases) - [Commits](https://github.com/actions/setup-java/compare/v3...v4) --- updated-dependencies: - dependency-name: actions/setup-java dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/ci.yml | 2 +- .github/workflows/release.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c93a92b5e..dbaf48689 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,7 +16,7 @@ jobs: - uses: actions/checkout@v4 with: fetch-depth: 0 - - uses: actions/setup-java@v3 + - uses: actions/setup-java@v4 with: distribution: temurin java-version: ${{matrix.java}} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 2184746d6..57aa9dd95 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -9,7 +9,7 @@ jobs: - uses: actions/checkout@v4 with: fetch-depth: 0 - - uses: actions/setup-java@v3 + - uses: actions/setup-java@v4 with: distribution: temurin java-version: 8 From a5eecfee7b29e02a27c7f38b41c28bd666f8306a Mon Sep 17 00:00:00 2001 From: xuwei-k <6b656e6a69@gmail.com> Date: Sun, 31 Dec 2023 08:40:39 +0900 Subject: [PATCH 699/789] use new wildcard syntax --- jvm/src/test/scala/scala/xml/XMLTest.scala | 2 +- shared/src/main/scala/scala/xml/Atom.scala | 4 ++-- shared/src/main/scala/scala/xml/Equality.scala | 2 +- shared/src/main/scala/scala/xml/Node.scala | 2 +- shared/src/main/scala/scala/xml/NodeBuffer.scala | 6 +++--- shared/src/main/scala/scala/xml/PrettyPrinter.scala | 4 ++-- shared/src/test/scala/scala/xml/PatternMatchingTest.scala | 2 +- shared/src/test/scala/scala/xml/XMLTest.scala | 2 +- 8 files changed, 12 insertions(+), 12 deletions(-) diff --git a/jvm/src/test/scala/scala/xml/XMLTest.scala b/jvm/src/test/scala/scala/xml/XMLTest.scala index a978e4bfa..5bad0fb38 100644 --- a/jvm/src/test/scala/scala/xml/XMLTest.scala +++ b/jvm/src/test/scala/scala/xml/XMLTest.scala @@ -393,7 +393,7 @@ class XMLTestJVM { @UnitTest def t5115(): Unit = { - def assertHonorsIterableContract(i: Iterable[_]): Unit = assertEquals(i.size.toLong, i.iterator.size.toLong) + def assertHonorsIterableContract(i: Iterable[?]): Unit = assertEquals(i.size.toLong, i.iterator.size.toLong) assertHonorsIterableContract(.attributes) assertHonorsIterableContract(.attributes) diff --git a/shared/src/main/scala/scala/xml/Atom.scala b/shared/src/main/scala/scala/xml/Atom.scala index d2e1c23dc..b6aa2fb5a 100644 --- a/shared/src/main/scala/scala/xml/Atom.scala +++ b/shared/src/main/scala/scala/xml/Atom.scala @@ -29,12 +29,12 @@ class Atom[+A](val data: A) extends SpecialNode with Serializable { override protected def basisForHashCode: Seq[Any] = Seq(data) override def strict_==(other: Equality): Boolean = other match { - case x: Atom[_] => data == x.data + case x: Atom[?] => data == x.data case _ => false } override def canEqual(other: Any): Boolean = other match { - case _: Atom[_] => true + case _: Atom[?] => true case _ => false } diff --git a/shared/src/main/scala/scala/xml/Equality.scala b/shared/src/main/scala/scala/xml/Equality.scala index 3b48b2824..d7d612d4c 100644 --- a/shared/src/main/scala/scala/xml/Equality.scala +++ b/shared/src/main/scala/scala/xml/Equality.scala @@ -53,7 +53,7 @@ object Equality { * Note - these functions assume strict equality has already failed. */ def compareBlithely(x1: AnyRef, x2: String): Boolean = x1 match { - case x: Atom[_] => x.data == x2 + case x: Atom[?] => x.data == x2 case x: NodeSeq => x.text == x2 case _ => false } diff --git a/shared/src/main/scala/scala/xml/Node.scala b/shared/src/main/scala/scala/xml/Node.scala index f5337eeeb..ca1d6379c 100755 --- a/shared/src/main/scala/scala/xml/Node.scala +++ b/shared/src/main/scala/scala/xml/Node.scala @@ -56,7 +56,7 @@ abstract class Node extends NodeSeq { /** * used internally. Atom/Molecule = -1 PI = -2 Comment = -3 EntityRef = -5 */ - def isAtom: Boolean = this.isInstanceOf[Atom[_]] + def isAtom: Boolean = this.isInstanceOf[Atom[?]] /** The logic formerly found in typeTag$, as best I could infer it. */ def doCollectNamespaces: Boolean = true // if (tag >= 0) DO collect namespaces diff --git a/shared/src/main/scala/scala/xml/NodeBuffer.scala b/shared/src/main/scala/scala/xml/NodeBuffer.scala index c6364226d..af086ec23 100644 --- a/shared/src/main/scala/scala/xml/NodeBuffer.scala +++ b/shared/src/main/scala/scala/xml/NodeBuffer.scala @@ -39,10 +39,10 @@ class NodeBuffer extends scala.collection.mutable.ArrayBuffer[Node] with ScalaVe def &+(o: Any): NodeBuffer = { o match { case null | _: Unit | Text("") => // ignore - case it: Iterator[_] => it.foreach(&+) + case it: Iterator[?] => it.foreach(&+) case n: Node => super.+=(n) - case ns: Iterable[_] => this &+ ns.iterator - case ns: Array[_] => this &+ ns.iterator + case ns: Iterable[?] => this &+ ns.iterator + case ns: Array[?] => this &+ ns.iterator case d => super.+=(new Atom(d)) } this diff --git a/shared/src/main/scala/scala/xml/PrettyPrinter.scala b/shared/src/main/scala/scala/xml/PrettyPrinter.scala index e1e35c3c9..f7fe76194 100755 --- a/shared/src/main/scala/scala/xml/PrettyPrinter.scala +++ b/shared/src/main/scala/scala/xml/PrettyPrinter.scala @@ -136,7 +136,7 @@ class PrettyPrinter(width: Int, step: Int, minimizeEmpty: Boolean) { protected def childrenAreLeaves(n: Node): Boolean = { def isLeaf(l: Node): Boolean = l match { - case _: Atom[_] | _: Comment | _: EntityRef | _: ProcInstr => true + case _: Atom[?] | _: Comment | _: EntityRef | _: ProcInstr => true case _ => false } n.child.forall(isLeaf) @@ -152,7 +152,7 @@ class PrettyPrinter(width: Int, step: Int, minimizeEmpty: Boolean) { case Text(s) if s.trim.isEmpty => - case _: Atom[_] | _: Comment | _: EntityRef | _: ProcInstr => + case _: Atom[?] | _: Comment | _: EntityRef | _: ProcInstr => makeBox(ind, node.toString.trim) case Group(xs) => traverse(xs.iterator, pscope, ind) diff --git a/shared/src/test/scala/scala/xml/PatternMatchingTest.scala b/shared/src/test/scala/scala/xml/PatternMatchingTest.scala index 829180e62..96890e81d 100644 --- a/shared/src/test/scala/scala/xml/PatternMatchingTest.scala +++ b/shared/src/test/scala/scala/xml/PatternMatchingTest.scala @@ -57,7 +57,7 @@ class PatternMatchingTest { object SafeNodeSeq { def unapplySeq(any: Any): Option[Seq[Node]] = any match { - case s: Seq[_] => Some(s.flatMap { + case s: Seq[?] => Some(s.flatMap { case n: Node => n case _ => NodeSeq.Empty }) diff --git a/shared/src/test/scala/scala/xml/XMLTest.scala b/shared/src/test/scala/scala/xml/XMLTest.scala index 2b1c553a2..989ca02e5 100644 --- a/shared/src/test/scala/scala/xml/XMLTest.scala +++ b/shared/src/test/scala/scala/xml/XMLTest.scala @@ -408,7 +408,7 @@ Ours is the portal of hope, come as you are." @UnitTest def t5115(): Unit = { - def assertHonorsIterableContract(i: Iterable[_]): Unit = assertEquals(i.size.toLong, i.iterator.size.toLong) + def assertHonorsIterableContract(i: Iterable[?]): Unit = assertEquals(i.size.toLong, i.iterator.size.toLong) assertHonorsIterableContract(.attributes) assertHonorsIterableContract(.attributes) From d20e93b2314cbf1fd5b6e9bd0d9221673f229652 Mon Sep 17 00:00:00 2001 From: Philippus Baalman Date: Thu, 4 Jan 2024 10:10:44 +0100 Subject: [PATCH 700/789] Extend copyright into 2024 --- NOTICE | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/NOTICE b/NOTICE index 8e6166dc5..107364531 100644 --- a/NOTICE +++ b/NOTICE @@ -1,6 +1,6 @@ scala-xml -Copyright (c) 2002-2023 EPFL -Copyright (c) 2011-2023 Lightbend, Inc. +Copyright (c) 2002-2024 EPFL +Copyright (c) 2011-2024 Lightbend, Inc. scala-xml includes software developed at LAMP/EPFL (https://lamp.epfl.ch/) and From 8abef260d59b3ae434b4c3431687f99761ba4258 Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Sat, 13 Jan 2024 09:41:42 +0000 Subject: [PATCH 701/789] Update sbt-scalajs, scalajs-compiler, ... to 1.15.0 --- project/plugins.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/plugins.sbt b/project/plugins.sbt index 23a6b788d..611ba1c08 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,6 +1,6 @@ addSbtPlugin("org.scala-lang.modules" % "sbt-scala-module" % "3.1.0") addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.3.2") addSbtPlugin("org.portable-scala" % "sbt-scala-native-crossproject" % "1.3.2") -addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.14.0") +addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.15.0") addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.4.16") addSbtPlugin("de.heikoseeberger" % "sbt-header" % "5.10.0") From f65e81c0a4c3270f726f5be6e57866e597c5ece6 Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Sat, 13 Jan 2024 09:41:44 +0000 Subject: [PATCH 702/789] Update sbt to 1.9.8 --- project/build.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/build.properties b/project/build.properties index e8a1e246e..abbbce5da 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version=1.9.7 +sbt.version=1.9.8 From 82ce116d8794637296440c7cf429dfdea9ef7bd5 Mon Sep 17 00:00:00 2001 From: kenji yoshida <6b656e6a69@gmail.com> Date: Mon, 15 Jan 2024 08:28:01 +0900 Subject: [PATCH 703/789] Update config.yml --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index d9865c8b6..c5eb16917 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -29,7 +29,7 @@ commands: keys: - sbt-deps-v1-{{ checksum "build.sbt" }} - sbt-deps-v1- - - run: sbt ++<< parameters.scala_version >> << parameters.sbt_tasks >> + - run: sbt -Dsbt.io.jdktimestamps=true ++<< parameters.scala_version >> << parameters.sbt_tasks >> - save_cache: key: sbt-deps-v1-{{ checksum "build.sbt" }} paths: From 617f6ae56b8214bf017673f3dcd7fafb124850b4 Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Sat, 20 Jan 2024 19:10:35 +0000 Subject: [PATCH 704/789] Update junit-runtime, nscplugin, ... to 0.4.17 --- project/plugins.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/plugins.sbt b/project/plugins.sbt index 611ba1c08..b4113bc8e 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -2,5 +2,5 @@ addSbtPlugin("org.scala-lang.modules" % "sbt-scala-module" % "3.1.0") addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.3.2") addSbtPlugin("org.portable-scala" % "sbt-scala-native-crossproject" % "1.3.2") addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.15.0") -addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.4.16") +addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.4.17") addSbtPlugin("de.heikoseeberger" % "sbt-header" % "5.10.0") From 83529ddab00ba9fb8d74d73d5c2e9a1cfef8e38f Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Sat, 24 Feb 2024 00:05:51 +0000 Subject: [PATCH 705/789] Update sbt to 1.9.9 --- project/build.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/build.properties b/project/build.properties index abbbce5da..04267b14a 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version=1.9.8 +sbt.version=1.9.9 From ff7650bc9736345313c62a25e0c4a2faf4019a88 Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Wed, 28 Feb 2024 04:52:21 +0000 Subject: [PATCH 706/789] Update scala-compiler, scala-library to 2.12.19 --- .circleci/config.yml | 10 +++++----- build.sbt | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index c5eb16917..a9e8a60b7 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -94,7 +94,7 @@ workflows: - scala_job: name: 2.12.x java_version: jdk8 - scala_version: 2.12.18 + scala_version: 2.12.19 - scala_job: name: 2.13.x java_version: jdk8 @@ -106,7 +106,7 @@ workflows: - scala_job: name: jdk11_2.12.x java_version: jdk11 - scala_version: 2.12.18 + scala_version: 2.12.19 - scala_job: name: jdk11_2.13.x java_version: jdk11 @@ -118,7 +118,7 @@ workflows: - scala_job: name: jdk17_2.12.x java_version: jdk17 - scala_version: 2.12.18 + scala_version: 2.12.19 - scala_job: name: jdk17_2.13.x java_version: jdk17 @@ -129,7 +129,7 @@ workflows: scala_version: 3.3.1 - scalajs_job: name: sjs1.0_2.12.x - scala_version: 2.12.18 + scala_version: 2.12.19 - scalajs_job: name: sjs1.0_2.13.x scala_version: 2.13.12 @@ -138,7 +138,7 @@ workflows: scala_version: 3.3.1 - scalanative_job: name: native0.4_2.12.x - scala_version: 2.12.18 + scala_version: 2.12.19 - scalanative_job: name: native0.4_2.13.x scala_version: 2.13.12 diff --git a/build.sbt b/build.sbt index 823eec0b3..05b12ff01 100644 --- a/build.sbt +++ b/build.sbt @@ -36,8 +36,8 @@ lazy val xml = crossProject(JSPlatform, JVMPlatform, NativePlatform) .settings( name := "scala-xml", scalaModuleAutomaticModuleName := Some("scala.xml"), - crossScalaVersions := Seq("2.13.12", "2.12.18", "3.3.1"), - scalaVersion := "2.12.18", + crossScalaVersions := Seq("2.13.12", "2.12.19", "3.3.1"), + scalaVersion := "2.12.19", scalacOptions ++= (CrossVersion.partialVersion(scalaVersion.value) match { case Some((3, _)) => From 501d5100db485400dc90c030dac51b4f35f31c08 Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Wed, 28 Feb 2024 04:52:24 +0000 Subject: [PATCH 707/789] Update scala-compiler, scala-library to 2.13.13 --- .circleci/config.yml | 10 +++++----- build.sbt | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index c5eb16917..56589bd5b 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -98,7 +98,7 @@ workflows: - scala_job: name: 2.13.x java_version: jdk8 - scala_version: 2.13.12 + scala_version: 2.13.13 - scala_job: name: 3.x java_version: jdk8 @@ -110,7 +110,7 @@ workflows: - scala_job: name: jdk11_2.13.x java_version: jdk11 - scala_version: 2.13.12 + scala_version: 2.13.13 - scala_job: name: jdk11_3.x java_version: jdk11 @@ -122,7 +122,7 @@ workflows: - scala_job: name: jdk17_2.13.x java_version: jdk17 - scala_version: 2.13.12 + scala_version: 2.13.13 - scala_job: name: jdk17_3.x java_version: jdk17 @@ -132,7 +132,7 @@ workflows: scala_version: 2.12.18 - scalajs_job: name: sjs1.0_2.13.x - scala_version: 2.13.12 + scala_version: 2.13.13 - scalajs_job: name: sjs1.0_3.x scala_version: 3.3.1 @@ -141,7 +141,7 @@ workflows: scala_version: 2.12.18 - scalanative_job: name: native0.4_2.13.x - scala_version: 2.13.12 + scala_version: 2.13.13 - scalanative_job: name: native0.4_3.x scala_version: 3.3.1 diff --git a/build.sbt b/build.sbt index 823eec0b3..cedb90896 100644 --- a/build.sbt +++ b/build.sbt @@ -36,7 +36,7 @@ lazy val xml = crossProject(JSPlatform, JVMPlatform, NativePlatform) .settings( name := "scala-xml", scalaModuleAutomaticModuleName := Some("scala.xml"), - crossScalaVersions := Seq("2.13.12", "2.12.18", "3.3.1"), + crossScalaVersions := Seq("2.13.13", "2.12.18", "3.3.1"), scalaVersion := "2.12.18", scalacOptions ++= (CrossVersion.partialVersion(scalaVersion.value) match { From f8a9fcbb19be301fa70a772f92f136627df85690 Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Sun, 3 Mar 2024 00:05:10 +0000 Subject: [PATCH 708/789] Update scala3-library, ... to 3.3.3 --- .circleci/config.yml | 10 +++++----- build.sbt | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index c7f3b5ba1..90c5ca84b 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -102,7 +102,7 @@ workflows: - scala_job: name: 3.x java_version: jdk8 - scala_version: 3.3.1 + scala_version: 3.3.3 - scala_job: name: jdk11_2.12.x java_version: jdk11 @@ -114,7 +114,7 @@ workflows: - scala_job: name: jdk11_3.x java_version: jdk11 - scala_version: 3.3.1 + scala_version: 3.3.3 - scala_job: name: jdk17_2.12.x java_version: jdk17 @@ -126,7 +126,7 @@ workflows: - scala_job: name: jdk17_3.x java_version: jdk17 - scala_version: 3.3.1 + scala_version: 3.3.3 - scalajs_job: name: sjs1.0_2.12.x scala_version: 2.12.19 @@ -135,7 +135,7 @@ workflows: scala_version: 2.13.13 - scalajs_job: name: sjs1.0_3.x - scala_version: 3.3.1 + scala_version: 3.3.3 - scalanative_job: name: native0.4_2.12.x scala_version: 2.12.19 @@ -144,4 +144,4 @@ workflows: scala_version: 2.13.13 - scalanative_job: name: native0.4_3.x - scala_version: 3.3.1 + scala_version: 3.3.3 diff --git a/build.sbt b/build.sbt index 3ab64bdae..7e1f1ecbc 100644 --- a/build.sbt +++ b/build.sbt @@ -36,7 +36,7 @@ lazy val xml = crossProject(JSPlatform, JVMPlatform, NativePlatform) .settings( name := "scala-xml", scalaModuleAutomaticModuleName := Some("scala.xml"), - crossScalaVersions := Seq("2.13.13", "2.12.19", "3.3.1"), + crossScalaVersions := Seq("2.13.13", "2.12.19", "3.3.3"), scalaVersion := "2.12.19", scalacOptions ++= (CrossVersion.partialVersion(scalaVersion.value) match { From c969584caa5631d5f6959d344bd7bc4a182e5692 Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Wed, 20 Mar 2024 19:40:02 +0000 Subject: [PATCH 709/789] Update sbt-scalajs, scalajs-compiler, ... to 1.16.0 --- project/plugins.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/plugins.sbt b/project/plugins.sbt index b4113bc8e..90f07a1c1 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,6 +1,6 @@ addSbtPlugin("org.scala-lang.modules" % "sbt-scala-module" % "3.1.0") addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.3.2") addSbtPlugin("org.portable-scala" % "sbt-scala-native-crossproject" % "1.3.2") -addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.15.0") +addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.16.0") addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.4.17") addSbtPlugin("de.heikoseeberger" % "sbt-header" % "5.10.0") From ac1aa401221f338875c36308b91d2b938f71383e Mon Sep 17 00:00:00 2001 From: Scala Steward <43047562+scala-steward@users.noreply.github.com> Date: Mon, 15 Apr 2024 19:14:01 +0200 Subject: [PATCH 710/789] Update nscplugin, sbt-scala-native to 0.5.0 (#716) --- project/plugins.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/plugins.sbt b/project/plugins.sbt index 90f07a1c1..e1f1fea4d 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -2,5 +2,5 @@ addSbtPlugin("org.scala-lang.modules" % "sbt-scala-module" % "3.1.0") addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.3.2") addSbtPlugin("org.portable-scala" % "sbt-scala-native-crossproject" % "1.3.2") addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.16.0") -addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.4.17") +addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.5.0") addSbtPlugin("de.heikoseeberger" % "sbt-header" % "5.10.0") From f8f811435de239c3b0f18286029f961708b6681e Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Wed, 17 Apr 2024 18:26:28 +0000 Subject: [PATCH 711/789] Update auxlib, clib, javalib, junit-runtime, ... to 0.5.1 --- project/plugins.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/plugins.sbt b/project/plugins.sbt index e1f1fea4d..41a10f0be 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -2,5 +2,5 @@ addSbtPlugin("org.scala-lang.modules" % "sbt-scala-module" % "3.1.0") addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.3.2") addSbtPlugin("org.portable-scala" % "sbt-scala-native-crossproject" % "1.3.2") addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.16.0") -addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.5.0") +addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.5.1") addSbtPlugin("de.heikoseeberger" % "sbt-header" % "5.10.0") From 13e302e82f77fb09ada01a44589f024eb09297b2 Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Wed, 8 May 2024 06:02:15 +0000 Subject: [PATCH 712/789] Update sbt to 1.10.0 --- project/build.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/build.properties b/project/build.properties index 04267b14a..081fdbbc7 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version=1.9.9 +sbt.version=1.10.0 From 1886ce8a8a4808813b67027cb66dc102b93ab24f Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Thu, 6 Jun 2024 17:13:33 +0000 Subject: [PATCH 713/789] Update auxlib, clib, javalib, junit-runtime, ... to 0.5.3 --- project/plugins.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/plugins.sbt b/project/plugins.sbt index 41a10f0be..e68701af4 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -2,5 +2,5 @@ addSbtPlugin("org.scala-lang.modules" % "sbt-scala-module" % "3.1.0") addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.3.2") addSbtPlugin("org.portable-scala" % "sbt-scala-native-crossproject" % "1.3.2") addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.16.0") -addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.5.1") +addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.5.3") addSbtPlugin("de.heikoseeberger" % "sbt-header" % "5.10.0") From bc455d4d1e5285718ebc543aebf789f48dc42e5a Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Tue, 25 Jun 2024 02:48:54 +0000 Subject: [PATCH 714/789] Update auxlib, clib, javalib, junit-runtime, ... to 0.5.4 --- project/plugins.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/plugins.sbt b/project/plugins.sbt index e68701af4..7b1429881 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -2,5 +2,5 @@ addSbtPlugin("org.scala-lang.modules" % "sbt-scala-module" % "3.1.0") addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.3.2") addSbtPlugin("org.portable-scala" % "sbt-scala-native-crossproject" % "1.3.2") addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.16.0") -addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.5.3") +addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.5.4") addSbtPlugin("de.heikoseeberger" % "sbt-header" % "5.10.0") From 8eff2f30d91be654904ec47f2ce0c20cb915ec68 Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Wed, 10 Jul 2024 20:42:42 +0000 Subject: [PATCH 715/789] Update sbt to 1.10.1 --- project/build.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/build.properties b/project/build.properties index 081fdbbc7..ee4c672cd 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version=1.10.0 +sbt.version=1.10.1 From 7aa00fc4563a419262dcea050f142d68b98292b6 Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Tue, 30 Jul 2024 02:30:53 +0000 Subject: [PATCH 716/789] Update commons-lang3 to 3.15.0 --- build.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index 7e1f1ecbc..4f3efc159 100644 --- a/build.sbt +++ b/build.sbt @@ -120,7 +120,7 @@ lazy val xml = crossProject(JSPlatform, JVMPlatform, NativePlatform) libraryDependencies += "junit" % "junit" % "4.13.2" % Test, libraryDependencies += "com.github.sbt" % "junit-interface" % "0.13.3" % Test, - libraryDependencies += "org.apache.commons" % "commons-lang3" % "3.14.0" % Test, + libraryDependencies += "org.apache.commons" % "commons-lang3" % "3.15.0" % Test, libraryDependencies += "xerces" % "xercesImpl" % "2.12.2" % Test, libraryDependencies ++= (CrossVersion.partialVersion(scalaVersion.value) match { case Some((3, _)) => From be2b5b6f0c75542c155d075540c2cbf897acc2b5 Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Mon, 6 May 2024 01:21:36 +0000 Subject: [PATCH 717/789] Update scala-compiler, scala-library to 2.13.14 --- .circleci/config.yml | 10 +++++----- build.sbt | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 90c5ca84b..4241535d8 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -98,7 +98,7 @@ workflows: - scala_job: name: 2.13.x java_version: jdk8 - scala_version: 2.13.13 + scala_version: 2.13.14 - scala_job: name: 3.x java_version: jdk8 @@ -110,7 +110,7 @@ workflows: - scala_job: name: jdk11_2.13.x java_version: jdk11 - scala_version: 2.13.13 + scala_version: 2.13.14 - scala_job: name: jdk11_3.x java_version: jdk11 @@ -122,7 +122,7 @@ workflows: - scala_job: name: jdk17_2.13.x java_version: jdk17 - scala_version: 2.13.13 + scala_version: 2.13.14 - scala_job: name: jdk17_3.x java_version: jdk17 @@ -132,7 +132,7 @@ workflows: scala_version: 2.12.19 - scalajs_job: name: sjs1.0_2.13.x - scala_version: 2.13.13 + scala_version: 2.13.14 - scalajs_job: name: sjs1.0_3.x scala_version: 3.3.3 @@ -141,7 +141,7 @@ workflows: scala_version: 2.12.19 - scalanative_job: name: native0.4_2.13.x - scala_version: 2.13.13 + scala_version: 2.13.14 - scalanative_job: name: native0.4_3.x scala_version: 3.3.3 diff --git a/build.sbt b/build.sbt index 4f3efc159..2b09164a3 100644 --- a/build.sbt +++ b/build.sbt @@ -36,7 +36,7 @@ lazy val xml = crossProject(JSPlatform, JVMPlatform, NativePlatform) .settings( name := "scala-xml", scalaModuleAutomaticModuleName := Some("scala.xml"), - crossScalaVersions := Seq("2.13.13", "2.12.19", "3.3.3"), + crossScalaVersions := Seq("2.13.14", "2.12.19", "3.3.3"), scalaVersion := "2.12.19", scalacOptions ++= (CrossVersion.partialVersion(scalaVersion.value) match { From e64465c26b43a68695aedfe52142a0bed7a5d59d Mon Sep 17 00:00:00 2001 From: Seth Tisue Date: Thu, 8 Aug 2024 18:28:41 -0700 Subject: [PATCH 718/789] don't run version checks on Scala.js --- build.sbt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/build.sbt b/build.sbt index 2b09164a3..a6246fc3a 100644 --- a/build.sbt +++ b/build.sbt @@ -130,6 +130,8 @@ lazy val xml = crossProject(JSPlatform, JVMPlatform, NativePlatform) }), ) .jsSettings( + versionPolicyCheck / skip := true, + versionCheck / skip := true, // Scala.js cannot run forked tests Test / fork := false ) From 65a6b40536b56148f1601832d32fa6250bf96299 Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Tue, 13 Aug 2024 03:43:43 +0000 Subject: [PATCH 719/789] Update commons-lang3 to 3.16.0 --- build.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index a6246fc3a..d682a9406 100644 --- a/build.sbt +++ b/build.sbt @@ -120,7 +120,7 @@ lazy val xml = crossProject(JSPlatform, JVMPlatform, NativePlatform) libraryDependencies += "junit" % "junit" % "4.13.2" % Test, libraryDependencies += "com.github.sbt" % "junit-interface" % "0.13.3" % Test, - libraryDependencies += "org.apache.commons" % "commons-lang3" % "3.15.0" % Test, + libraryDependencies += "org.apache.commons" % "commons-lang3" % "3.16.0" % Test, libraryDependencies += "xerces" % "xercesImpl" % "2.12.2" % Test, libraryDependencies ++= (CrossVersion.partialVersion(scalaVersion.value) match { case Some((3, _)) => From 434c6c459adb19cd526a8835ffe49e2e67196f37 Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Mon, 19 Aug 2024 19:53:57 +0000 Subject: [PATCH 720/789] Update auxlib, clib, javalib, junit-runtime, ... to 0.5.5 --- project/plugins.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/plugins.sbt b/project/plugins.sbt index 7b1429881..3b75c8d62 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -2,5 +2,5 @@ addSbtPlugin("org.scala-lang.modules" % "sbt-scala-module" % "3.1.0") addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.3.2") addSbtPlugin("org.portable-scala" % "sbt-scala-native-crossproject" % "1.3.2") addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.16.0") -addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.5.4") +addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.5.5") addSbtPlugin("de.heikoseeberger" % "sbt-header" % "5.10.0") From 314e37d6c525f6f03b74aaead74b600b6461e160 Mon Sep 17 00:00:00 2001 From: Ryo Fukumuro Date: Sat, 31 Aug 2024 15:41:55 +0900 Subject: [PATCH 721/789] Correct code point for "darr" entity --- shared/src/main/scala/scala/xml/parsing/XhtmlEntities.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shared/src/main/scala/scala/xml/parsing/XhtmlEntities.scala b/shared/src/main/scala/scala/xml/parsing/XhtmlEntities.scala index ff593d3e2..e87eea1b1 100644 --- a/shared/src/main/scala/scala/xml/parsing/XhtmlEntities.scala +++ b/shared/src/main/scala/scala/xml/parsing/XhtmlEntities.scala @@ -36,7 +36,7 @@ object XhtmlEntities { ("rlm", 8207), ("ndash", 8211), ("mdash", 8212), ("lsquo", 8216), ("rsquo", 8217), ("sbquo", 8218), ("ldquo", 8220), ("rdquo", 8221), ("bdquo", 8222), ("dagger", 8224), ("Dagger", 8225), ("permil", 8240), ("lsaquo", 8249), ("rsaquo", 8250), ("fnof", 402), ("bull", 8226), ("hellip", 8230), ("prime", 8242), ("Prime", 8243), ("oline", 8254), ("frasl", 8260), ("weierp", 8472), ("image", 8465), ("real", 8476), ("alefsym", 8501), ("larr", 8592), ("uarr", 8593), - ("rarr", 8594), ("darr", 8495), ("harr", 8596), ("crarr", 8629), ("lArr", 8656), ("uArr", 8657), ("rArr", 8658), ("dArr", 8659), ("hArr", 8660), + ("rarr", 8594), ("darr", 8595), ("harr", 8596), ("crarr", 8629), ("lArr", 8656), ("uArr", 8657), ("rArr", 8658), ("dArr", 8659), ("hArr", 8660), ("forall", 8704), ("part", 8706), ("exist", 8707), ("empty", 8709), ("nabla", 8711), ("isin", 8712), ("notin", 8713), ("ni", 8715), ("prod", 8719), ("sum", 8721), ("minus", 8722), ("lowast", 8727), ("radic", 8730), ("prop", 8733), ("infin", 8734), ("ang", 8736), ("and", 8743), ("or", 8744), ("cap", 8745), ("cup", 8746), ("int", 8747), ("there4", 8756), ("sim", 8764), ("cong", 8773), ("asymp", 8776), ("ne", 8800), ("equiv", 8801), ("le", 8804), From c074ec370a2104272f6512abfe698fda0f99f0c2 Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Sat, 31 Aug 2024 18:26:27 +0000 Subject: [PATCH 722/789] Update commons-lang3 to 3.17.0 --- build.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index d682a9406..ca407e34d 100644 --- a/build.sbt +++ b/build.sbt @@ -120,7 +120,7 @@ lazy val xml = crossProject(JSPlatform, JVMPlatform, NativePlatform) libraryDependencies += "junit" % "junit" % "4.13.2" % Test, libraryDependencies += "com.github.sbt" % "junit-interface" % "0.13.3" % Test, - libraryDependencies += "org.apache.commons" % "commons-lang3" % "3.16.0" % Test, + libraryDependencies += "org.apache.commons" % "commons-lang3" % "3.17.0" % Test, libraryDependencies += "xerces" % "xercesImpl" % "2.12.2" % Test, libraryDependencies ++= (CrossVersion.partialVersion(scalaVersion.value) match { case Some((3, _)) => From 7749636396792fd307572f6afd94747bbed95fe0 Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Fri, 6 Sep 2024 18:09:12 +0000 Subject: [PATCH 723/789] Update scala-compiler, scala-library to 2.12.20 --- .circleci/config.yml | 10 +++++----- build.sbt | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 4241535d8..010528ec1 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -94,7 +94,7 @@ workflows: - scala_job: name: 2.12.x java_version: jdk8 - scala_version: 2.12.19 + scala_version: 2.12.20 - scala_job: name: 2.13.x java_version: jdk8 @@ -106,7 +106,7 @@ workflows: - scala_job: name: jdk11_2.12.x java_version: jdk11 - scala_version: 2.12.19 + scala_version: 2.12.20 - scala_job: name: jdk11_2.13.x java_version: jdk11 @@ -118,7 +118,7 @@ workflows: - scala_job: name: jdk17_2.12.x java_version: jdk17 - scala_version: 2.12.19 + scala_version: 2.12.20 - scala_job: name: jdk17_2.13.x java_version: jdk17 @@ -129,7 +129,7 @@ workflows: scala_version: 3.3.3 - scalajs_job: name: sjs1.0_2.12.x - scala_version: 2.12.19 + scala_version: 2.12.20 - scalajs_job: name: sjs1.0_2.13.x scala_version: 2.13.14 @@ -138,7 +138,7 @@ workflows: scala_version: 3.3.3 - scalanative_job: name: native0.4_2.12.x - scala_version: 2.12.19 + scala_version: 2.12.20 - scalanative_job: name: native0.4_2.13.x scala_version: 2.13.14 diff --git a/build.sbt b/build.sbt index d682a9406..1494ad55a 100644 --- a/build.sbt +++ b/build.sbt @@ -36,8 +36,8 @@ lazy val xml = crossProject(JSPlatform, JVMPlatform, NativePlatform) .settings( name := "scala-xml", scalaModuleAutomaticModuleName := Some("scala.xml"), - crossScalaVersions := Seq("2.13.14", "2.12.19", "3.3.3"), - scalaVersion := "2.12.19", + crossScalaVersions := Seq("2.13.14", "2.12.20", "3.3.3"), + scalaVersion := "2.12.20", scalacOptions ++= (CrossVersion.partialVersion(scalaVersion.value) match { case Some((3, _)) => From 96b524e3d5c3320e72ccf3217f587d010a104072 Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Mon, 16 Sep 2024 18:57:11 +0000 Subject: [PATCH 724/789] Update sbt to 1.10.2 --- project/build.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/build.properties b/project/build.properties index ee4c672cd..0b699c305 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version=1.10.1 +sbt.version=1.10.2 From 2c91d414d02ff0185b39d5ceef745184332898cc Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Thu, 26 Sep 2024 18:43:41 +0000 Subject: [PATCH 725/789] Update scala-compiler, scala-library to 2.13.15 --- .circleci/config.yml | 10 +++++----- build.sbt | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 010528ec1..d022da865 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -98,7 +98,7 @@ workflows: - scala_job: name: 2.13.x java_version: jdk8 - scala_version: 2.13.14 + scala_version: 2.13.15 - scala_job: name: 3.x java_version: jdk8 @@ -110,7 +110,7 @@ workflows: - scala_job: name: jdk11_2.13.x java_version: jdk11 - scala_version: 2.13.14 + scala_version: 2.13.15 - scala_job: name: jdk11_3.x java_version: jdk11 @@ -122,7 +122,7 @@ workflows: - scala_job: name: jdk17_2.13.x java_version: jdk17 - scala_version: 2.13.14 + scala_version: 2.13.15 - scala_job: name: jdk17_3.x java_version: jdk17 @@ -132,7 +132,7 @@ workflows: scala_version: 2.12.20 - scalajs_job: name: sjs1.0_2.13.x - scala_version: 2.13.14 + scala_version: 2.13.15 - scalajs_job: name: sjs1.0_3.x scala_version: 3.3.3 @@ -141,7 +141,7 @@ workflows: scala_version: 2.12.20 - scalanative_job: name: native0.4_2.13.x - scala_version: 2.13.14 + scala_version: 2.13.15 - scalanative_job: name: native0.4_3.x scala_version: 3.3.3 diff --git a/build.sbt b/build.sbt index aae7ae7db..e7a7aa0e4 100644 --- a/build.sbt +++ b/build.sbt @@ -36,7 +36,7 @@ lazy val xml = crossProject(JSPlatform, JVMPlatform, NativePlatform) .settings( name := "scala-xml", scalaModuleAutomaticModuleName := Some("scala.xml"), - crossScalaVersions := Seq("2.13.14", "2.12.20", "3.3.3"), + crossScalaVersions := Seq("2.13.15", "2.12.20", "3.3.3"), scalaVersion := "2.12.20", scalacOptions ++= (CrossVersion.partialVersion(scalaVersion.value) match { From b47611c06c62da316829f26f11b6004ab1921983 Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Sat, 28 Sep 2024 23:46:17 +0000 Subject: [PATCH 726/789] Update sbt-scalajs, scalajs-compiler, ... to 1.17.0 --- project/plugins.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/plugins.sbt b/project/plugins.sbt index 3b75c8d62..9bd4947de 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,6 +1,6 @@ addSbtPlugin("org.scala-lang.modules" % "sbt-scala-module" % "3.1.0") addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.3.2") addSbtPlugin("org.portable-scala" % "sbt-scala-native-crossproject" % "1.3.2") -addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.16.0") +addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.17.0") addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.5.5") addSbtPlugin("de.heikoseeberger" % "sbt-header" % "5.10.0") From b7d3807f8ca848cfd4f7c63ec766b635cd8516a9 Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Sat, 28 Sep 2024 23:46:19 +0000 Subject: [PATCH 727/789] Update scala3-library, ... to 3.3.4 --- .circleci/config.yml | 10 +++++----- build.sbt | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 010528ec1..3460bb1f9 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -102,7 +102,7 @@ workflows: - scala_job: name: 3.x java_version: jdk8 - scala_version: 3.3.3 + scala_version: 3.3.4 - scala_job: name: jdk11_2.12.x java_version: jdk11 @@ -114,7 +114,7 @@ workflows: - scala_job: name: jdk11_3.x java_version: jdk11 - scala_version: 3.3.3 + scala_version: 3.3.4 - scala_job: name: jdk17_2.12.x java_version: jdk17 @@ -126,7 +126,7 @@ workflows: - scala_job: name: jdk17_3.x java_version: jdk17 - scala_version: 3.3.3 + scala_version: 3.3.4 - scalajs_job: name: sjs1.0_2.12.x scala_version: 2.12.20 @@ -135,7 +135,7 @@ workflows: scala_version: 2.13.14 - scalajs_job: name: sjs1.0_3.x - scala_version: 3.3.3 + scala_version: 3.3.4 - scalanative_job: name: native0.4_2.12.x scala_version: 2.12.20 @@ -144,4 +144,4 @@ workflows: scala_version: 2.13.14 - scalanative_job: name: native0.4_3.x - scala_version: 3.3.3 + scala_version: 3.3.4 diff --git a/build.sbt b/build.sbt index aae7ae7db..dd84f5dcc 100644 --- a/build.sbt +++ b/build.sbt @@ -36,7 +36,7 @@ lazy val xml = crossProject(JSPlatform, JVMPlatform, NativePlatform) .settings( name := "scala-xml", scalaModuleAutomaticModuleName := Some("scala.xml"), - crossScalaVersions := Seq("2.13.14", "2.12.20", "3.3.3"), + crossScalaVersions := Seq("2.13.14", "2.12.20", "3.3.4"), scalaVersion := "2.12.20", scalacOptions ++= (CrossVersion.partialVersion(scalaVersion.value) match { From 5e4076a68ab273281468c492514c8aec230b1522 Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Sun, 20 Oct 2024 21:59:49 +0000 Subject: [PATCH 728/789] Update sbt-scala-module to 3.2.0 --- project/plugins.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/plugins.sbt b/project/plugins.sbt index 9bd4947de..90d38927e 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,4 +1,4 @@ -addSbtPlugin("org.scala-lang.modules" % "sbt-scala-module" % "3.1.0") +addSbtPlugin("org.scala-lang.modules" % "sbt-scala-module" % "3.2.0") addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.3.2") addSbtPlugin("org.portable-scala" % "sbt-scala-native-crossproject" % "1.3.2") addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.17.0") From 7ea8a7e3bd877819bc7c13c272aa978c097f0abe Mon Sep 17 00:00:00 2001 From: philippus Date: Mon, 21 Oct 2024 19:28:29 +0200 Subject: [PATCH 729/789] Enable SbtOsgi plugin --- build.sbt | 1 + 1 file changed, 1 insertion(+) diff --git a/build.sbt b/build.sbt index 333a40146..fb67181d7 100644 --- a/build.sbt +++ b/build.sbt @@ -129,6 +129,7 @@ lazy val xml = crossProject(JSPlatform, JVMPlatform, NativePlatform) Seq("org.scala-lang" % "scala-compiler" % scalaVersion.value % Test) }), ) + .jvmEnablePlugins(SbtOsgi) .jsSettings( versionPolicyCheck / skip := true, versionCheck / skip := true, From 4b25e813950e3ad9f54e363e54e4c0d2671e4194 Mon Sep 17 00:00:00 2001 From: philippus Date: Mon, 21 Oct 2024 19:47:16 +0200 Subject: [PATCH 730/789] Add java 21 to build matrix --- .circleci/config.yml | 16 ++++++++++++++++ .github/workflows/ci.yml | 2 +- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 6e107e001..1dabee7b4 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -13,6 +13,10 @@ executors: docker: - image: circleci/openjdk:17-buster resource_class: small + scala_jdk21_executor: + docker: + - image: cimg/openjdk:21.0-node + resource_class: small commands: sbt_cmd: @@ -127,6 +131,18 @@ workflows: name: jdk17_3.x java_version: jdk17 scala_version: 3.3.4 + - scala_job: + name: jdk21_2.12.x + java_version: jdk21 + scala_version: 2.12.20 + - scala_job: + name: jdk21_2.13.x + java_version: jdk21 + scala_version: 2.13.15 + - scala_job: + name: jdk21_3.x + java_version: jdk21 + scala_version: 3.3.4 - scalajs_job: name: sjs1.0_2.12.x scala_version: 2.12.20 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index dbaf48689..a6000d24f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,7 +9,7 @@ jobs: strategy: fail-fast: false matrix: - java: [8, 11, 17] + java: [8, 11, 17, 21] scala: [2.12.x, 2.13.x, 3.x] runs-on: ubuntu-latest steps: From d3295962da4b3868018d70b76ca9e7b2f338638a Mon Sep 17 00:00:00 2001 From: philippus Date: Mon, 21 Oct 2024 20:08:56 +0200 Subject: [PATCH 731/789] Switch to new CircleCI OpenJDK images --- .circleci/config.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 6e107e001..feb79f638 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -3,15 +3,15 @@ version: 2.1 executors: scala_jdk8_executor: docker: - - image: circleci/openjdk:8-jdk-node + - image: cimg/openjdk:8.0-node resource_class: small scala_jdk11_executor: docker: - - image: circleci/openjdk:11-jdk + - image: cimg/openjdk:11.0-node resource_class: small scala_jdk17_executor: docker: - - image: circleci/openjdk:17-buster + - image: cimg/openjdk:17.0-node resource_class: small commands: From 35da8ba7c41b6d0d778d4ca26e67aac4d804a17d Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Sun, 20 Oct 2024 21:59:51 +0000 Subject: [PATCH 732/789] Update sbt to 1.10.3 --- project/build.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/build.properties b/project/build.properties index 0b699c305..bc7390601 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version=1.10.2 +sbt.version=1.10.3 From 2fad61dab99074a740023422f3d52a984ea0f045 Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Mon, 28 Oct 2024 19:38:56 +0000 Subject: [PATCH 733/789] Update sbt, scripted-plugin to 1.10.4 --- project/build.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/build.properties b/project/build.properties index bc7390601..09feeeed5 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version=1.10.3 +sbt.version=1.10.4 From b59212c70913614f2c0e1ad58cf92ee22c697378 Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Wed, 6 Nov 2024 02:00:57 +0000 Subject: [PATCH 734/789] Update sbt, scripted-plugin to 1.10.5 --- project/build.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/build.properties b/project/build.properties index 09feeeed5..db1723b08 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version=1.10.4 +sbt.version=1.10.5 From 0dc29cfcce748d817386e1155aee89f18651d973 Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Fri, 15 Nov 2024 20:58:06 +0000 Subject: [PATCH 735/789] Update auxlib, clib, javalib, junit-runtime, ... to 0.5.6 --- project/plugins.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/plugins.sbt b/project/plugins.sbt index 90d38927e..e5581ce54 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -2,5 +2,5 @@ addSbtPlugin("org.scala-lang.modules" % "sbt-scala-module" % "3.2.0") addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.3.2") addSbtPlugin("org.portable-scala" % "sbt-scala-native-crossproject" % "1.3.2") addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.17.0") -addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.5.5") +addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.5.6") addSbtPlugin("de.heikoseeberger" % "sbt-header" % "5.10.0") From 6072f83df4a13ca60272682431a7d26853886a21 Mon Sep 17 00:00:00 2001 From: Som Snytt Date: Mon, 25 Nov 2024 04:32:45 -0800 Subject: [PATCH 736/789] NodeBuffer append is this.type --- shared/src/main/scala/scala/xml/NodeBuffer.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shared/src/main/scala/scala/xml/NodeBuffer.scala b/shared/src/main/scala/scala/xml/NodeBuffer.scala index af086ec23..7a26caa67 100644 --- a/shared/src/main/scala/scala/xml/NodeBuffer.scala +++ b/shared/src/main/scala/scala/xml/NodeBuffer.scala @@ -36,7 +36,7 @@ class NodeBuffer extends scala.collection.mutable.ArrayBuffer[Node] with ScalaVe * @param o converts to an xml node and adds to this node buffer * @return this nodebuffer */ - def &+(o: Any): NodeBuffer = { + def &+(o: Any): this.type = { o match { case null | _: Unit | Text("") => // ignore case it: Iterator[?] => it.foreach(&+) From e023c7afa55a16ec55d6590c3f14ef539f37a191 Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Mon, 2 Dec 2024 01:32:11 +0000 Subject: [PATCH 737/789] Update sbt, scripted-plugin to 1.10.6 --- project/build.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/build.properties b/project/build.properties index db1723b08..e88a0d817 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version=1.10.5 +sbt.version=1.10.6 From 9f17a09ecee782d7a1bb885c094e84124276247c Mon Sep 17 00:00:00 2001 From: Seth Tisue Date: Mon, 16 Dec 2024 10:05:32 -0800 Subject: [PATCH 738/789] check Scala CLA in PR validation --- .github/workflows/cla.yml | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 .github/workflows/cla.yml diff --git a/.github/workflows/cla.yml b/.github/workflows/cla.yml new file mode 100644 index 000000000..3549dedc2 --- /dev/null +++ b/.github/workflows/cla.yml @@ -0,0 +1,11 @@ +name: "Check Scala CLA" +on: + pull_request: +jobs: + cla-check: + runs-on: ubuntu-latest + steps: + - name: Verify CLA + uses: scala/cla-checker@v1 + with: + author: ${{ github.event.pull_request.user.login }} From 2e3a4deed4e2a9189b8ee92e3d4bf6ba7a7db98e Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Sat, 21 Dec 2024 21:25:37 +0000 Subject: [PATCH 739/789] Update sbt-scala-module to 3.2.2 --- project/plugins.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/plugins.sbt b/project/plugins.sbt index e5581ce54..8d78e02fd 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,4 +1,4 @@ -addSbtPlugin("org.scala-lang.modules" % "sbt-scala-module" % "3.2.0") +addSbtPlugin("org.scala-lang.modules" % "sbt-scala-module" % "3.2.2") addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.3.2") addSbtPlugin("org.portable-scala" % "sbt-scala-native-crossproject" % "1.3.2") addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.17.0") From 01dfe479940f4fa179cc8ccc5405fbc6430d3b8c Mon Sep 17 00:00:00 2001 From: xuwei-k <6b656e6a69@gmail.com> Date: Sun, 22 Dec 2024 07:54:20 +0900 Subject: [PATCH 740/789] add sbt/setup-sbt action --- .github/workflows/ci.yml | 1 + .github/workflows/release.yml | 1 + 2 files changed, 2 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index dbaf48689..30643e182 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -21,5 +21,6 @@ jobs: distribution: temurin java-version: ${{matrix.java}} cache: sbt + - uses: sbt/setup-sbt@v1 - name: Test run: sbt ++${{matrix.scala}} test headerCheck versionPolicyCheck package diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 57aa9dd95..1e5360b8a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -13,6 +13,7 @@ jobs: with: distribution: temurin java-version: 8 + - uses: sbt/setup-sbt@v1 - run: sbt versionCheck ci-release env: PGP_PASSPHRASE: ${{secrets.PGP_PASSPHRASE}} From 086be015c6a68176c9ef0d117c1706da09033302 Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Wed, 25 Dec 2024 22:26:57 +0000 Subject: [PATCH 741/789] Update sbt, scripted-plugin to 1.10.7 --- project/build.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/build.properties b/project/build.properties index e88a0d817..73df629ac 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version=1.10.6 +sbt.version=1.10.7 From 2eea7c4d5fec3f4de4397a32a9c3a1fe49542771 Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Sun, 12 Jan 2025 21:01:16 +0000 Subject: [PATCH 742/789] Update sbt-scalajs, scalajs-compiler, ... to 1.18.1 --- project/plugins.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/plugins.sbt b/project/plugins.sbt index e5581ce54..3cac6b7df 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,6 +1,6 @@ addSbtPlugin("org.scala-lang.modules" % "sbt-scala-module" % "3.2.0") addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.3.2") addSbtPlugin("org.portable-scala" % "sbt-scala-native-crossproject" % "1.3.2") -addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.17.0") +addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.18.1") addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.5.6") addSbtPlugin("de.heikoseeberger" % "sbt-header" % "5.10.0") From 0b40c99248f0ae540dbff7d8e4944d1cca114693 Mon Sep 17 00:00:00 2001 From: Seth Tisue Date: Thu, 16 Jan 2025 11:37:02 -0800 Subject: [PATCH 743/789] fix CI --- .github/workflows/ci.yml | 1 + .github/workflows/release.yml | 1 + 2 files changed, 2 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a6000d24f..b0594e67c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -21,5 +21,6 @@ jobs: distribution: temurin java-version: ${{matrix.java}} cache: sbt + - uses: sbt/setup-sbt@v1 - name: Test run: sbt ++${{matrix.scala}} test headerCheck versionPolicyCheck package diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 57aa9dd95..1e5360b8a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -13,6 +13,7 @@ jobs: with: distribution: temurin java-version: 8 + - uses: sbt/setup-sbt@v1 - run: sbt versionCheck ci-release env: PGP_PASSPHRASE: ${{secrets.PGP_PASSPHRASE}} From 5d6a048577259c5a27371b95a8971962c25676ca Mon Sep 17 00:00:00 2001 From: Seth Tisue Date: Thu, 16 Jan 2025 13:46:58 -0800 Subject: [PATCH 744/789] copyright 2025 --- NOTICE | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/NOTICE b/NOTICE index 107364531..147f12c8c 100644 --- a/NOTICE +++ b/NOTICE @@ -1,10 +1,10 @@ scala-xml -Copyright (c) 2002-2024 EPFL -Copyright (c) 2011-2024 Lightbend, Inc. +Copyright (c) 2002-2025 EPFL +Copyright (c) 2011-2025 Lightbend, Inc. dba Akka scala-xml includes software developed at LAMP/EPFL (https://lamp.epfl.ch/) and -Lightbend, Inc. (https://www.lightbend.com/). +Akka (https://akka.io/). Licensed under the Apache License, Version 2.0 (the "License"). Unless required by applicable law or agreed to in writing, software From c2d85b2b76c405b213b82f83bbe466a2368605b9 Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Sun, 19 Jan 2025 08:55:56 +0000 Subject: [PATCH 745/789] Update scala-compiler, scala-library to 2.13.16 --- .circleci/config.yml | 12 ++++++------ build.sbt | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 4488a917a..47902042b 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -102,7 +102,7 @@ workflows: - scala_job: name: 2.13.x java_version: jdk8 - scala_version: 2.13.15 + scala_version: 2.13.16 - scala_job: name: 3.x java_version: jdk8 @@ -114,7 +114,7 @@ workflows: - scala_job: name: jdk11_2.13.x java_version: jdk11 - scala_version: 2.13.15 + scala_version: 2.13.16 - scala_job: name: jdk11_3.x java_version: jdk11 @@ -126,7 +126,7 @@ workflows: - scala_job: name: jdk17_2.13.x java_version: jdk17 - scala_version: 2.13.15 + scala_version: 2.13.16 - scala_job: name: jdk17_3.x java_version: jdk17 @@ -138,7 +138,7 @@ workflows: - scala_job: name: jdk21_2.13.x java_version: jdk21 - scala_version: 2.13.15 + scala_version: 2.13.16 - scala_job: name: jdk21_3.x java_version: jdk21 @@ -148,7 +148,7 @@ workflows: scala_version: 2.12.20 - scalajs_job: name: sjs1.0_2.13.x - scala_version: 2.13.15 + scala_version: 2.13.16 - scalajs_job: name: sjs1.0_3.x scala_version: 3.3.4 @@ -157,7 +157,7 @@ workflows: scala_version: 2.12.20 - scalanative_job: name: native0.4_2.13.x - scala_version: 2.13.15 + scala_version: 2.13.16 - scalanative_job: name: native0.4_3.x scala_version: 3.3.4 diff --git a/build.sbt b/build.sbt index fb67181d7..0a5687997 100644 --- a/build.sbt +++ b/build.sbt @@ -36,7 +36,7 @@ lazy val xml = crossProject(JSPlatform, JVMPlatform, NativePlatform) .settings( name := "scala-xml", scalaModuleAutomaticModuleName := Some("scala.xml"), - crossScalaVersions := Seq("2.13.15", "2.12.20", "3.3.4"), + crossScalaVersions := Seq("2.13.16", "2.12.20", "3.3.4"), scalaVersion := "2.12.20", scalacOptions ++= (CrossVersion.partialVersion(scalaVersion.value) match { From 2d0b872e687ca33327f6220730c6b56c9d1cb78b Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Sat, 25 Jan 2025 04:42:28 +0000 Subject: [PATCH 746/789] Update sbt-scalajs, scalajs-compiler, ... to 1.18.2 --- project/plugins.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/plugins.sbt b/project/plugins.sbt index 99870c20f..c86c66c4a 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,6 +1,6 @@ addSbtPlugin("org.scala-lang.modules" % "sbt-scala-module" % "3.2.2") addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.3.2") addSbtPlugin("org.portable-scala" % "sbt-scala-native-crossproject" % "1.3.2") -addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.18.1") +addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.18.2") addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.5.6") addSbtPlugin("de.heikoseeberger" % "sbt-header" % "5.10.0") From 39f9319381dee3e5a02e68def57c17acc910f4a2 Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Tue, 4 Feb 2025 06:52:16 +0000 Subject: [PATCH 747/789] Update scala3-library, ... to 3.3.5 --- .circleci/config.yml | 12 ++++++------ build.sbt | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 47902042b..d55ce653b 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -106,7 +106,7 @@ workflows: - scala_job: name: 3.x java_version: jdk8 - scala_version: 3.3.4 + scala_version: 3.3.5 - scala_job: name: jdk11_2.12.x java_version: jdk11 @@ -118,7 +118,7 @@ workflows: - scala_job: name: jdk11_3.x java_version: jdk11 - scala_version: 3.3.4 + scala_version: 3.3.5 - scala_job: name: jdk17_2.12.x java_version: jdk17 @@ -130,7 +130,7 @@ workflows: - scala_job: name: jdk17_3.x java_version: jdk17 - scala_version: 3.3.4 + scala_version: 3.3.5 - scala_job: name: jdk21_2.12.x java_version: jdk21 @@ -142,7 +142,7 @@ workflows: - scala_job: name: jdk21_3.x java_version: jdk21 - scala_version: 3.3.4 + scala_version: 3.3.5 - scalajs_job: name: sjs1.0_2.12.x scala_version: 2.12.20 @@ -151,7 +151,7 @@ workflows: scala_version: 2.13.16 - scalajs_job: name: sjs1.0_3.x - scala_version: 3.3.4 + scala_version: 3.3.5 - scalanative_job: name: native0.4_2.12.x scala_version: 2.12.20 @@ -160,4 +160,4 @@ workflows: scala_version: 2.13.16 - scalanative_job: name: native0.4_3.x - scala_version: 3.3.4 + scala_version: 3.3.5 diff --git a/build.sbt b/build.sbt index 0a5687997..d561c4f58 100644 --- a/build.sbt +++ b/build.sbt @@ -36,7 +36,7 @@ lazy val xml = crossProject(JSPlatform, JVMPlatform, NativePlatform) .settings( name := "scala-xml", scalaModuleAutomaticModuleName := Some("scala.xml"), - crossScalaVersions := Seq("2.13.16", "2.12.20", "3.3.4"), + crossScalaVersions := Seq("2.13.16", "2.12.20", "3.3.5"), scalaVersion := "2.12.20", scalacOptions ++= (CrossVersion.partialVersion(scalaVersion.value) match { From 24c6a33aae73ac3832b6079c44b7694b7e51a1fb Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Thu, 27 Feb 2025 17:41:14 +0000 Subject: [PATCH 748/789] Update auxlib, clib, javalib, junit-runtime, ... to 0.5.7 --- project/plugins.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/plugins.sbt b/project/plugins.sbt index c86c66c4a..952324ca5 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -2,5 +2,5 @@ addSbtPlugin("org.scala-lang.modules" % "sbt-scala-module" % "3.2.2") addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.3.2") addSbtPlugin("org.portable-scala" % "sbt-scala-native-crossproject" % "1.3.2") addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.18.2") -addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.5.6") +addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.5.7") addSbtPlugin("de.heikoseeberger" % "sbt-header" % "5.10.0") From 4833730414a2e564b2864fcef5ed87e18d907af5 Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Mon, 3 Mar 2025 20:49:34 +0000 Subject: [PATCH 749/789] Update sbt, scripted-plugin to 1.10.9 --- project/build.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/build.properties b/project/build.properties index 73df629ac..96d8db79a 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version=1.10.7 +sbt.version=1.10.9 From 6a043c0a3c253ac8b3cc76e28a6b2f6f2658b2f1 Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Wed, 5 Mar 2025 22:48:13 +0000 Subject: [PATCH 750/789] Update sbt, scripted-plugin to 1.10.10 --- project/build.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/build.properties b/project/build.properties index 96d8db79a..e97b27220 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version=1.10.9 +sbt.version=1.10.10 From d0d1b91b9f3898df3207e1483c65baca3887cbb9 Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Tue, 18 Mar 2025 00:14:50 +0000 Subject: [PATCH 751/789] Update sbt, scripted-plugin to 1.10.11 --- project/build.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/build.properties b/project/build.properties index e97b27220..cc68b53f1 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version=1.10.10 +sbt.version=1.10.11 From b9b60e556c00edb41d079d01205722bd56b392a3 Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Tue, 22 Apr 2025 18:32:31 +0000 Subject: [PATCH 752/789] Update sbt-scalajs, scalajs-compiler, ... to 1.19.0 --- project/plugins.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/plugins.sbt b/project/plugins.sbt index 952324ca5..bfec069c2 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,6 +1,6 @@ addSbtPlugin("org.scala-lang.modules" % "sbt-scala-module" % "3.2.2") addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.3.2") addSbtPlugin("org.portable-scala" % "sbt-scala-native-crossproject" % "1.3.2") -addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.18.2") +addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.19.0") addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.5.7") addSbtPlugin("de.heikoseeberger" % "sbt-header" % "5.10.0") From 7f127feeb4816b49e9050bc68c6ee4ad3a893a18 Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Fri, 9 May 2025 14:04:25 +0000 Subject: [PATCH 753/789] Update scala3-library, ... to 3.3.6 --- .circleci/config.yml | 12 ++++++------ build.sbt | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index d55ce653b..63b364a21 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -106,7 +106,7 @@ workflows: - scala_job: name: 3.x java_version: jdk8 - scala_version: 3.3.5 + scala_version: 3.3.6 - scala_job: name: jdk11_2.12.x java_version: jdk11 @@ -118,7 +118,7 @@ workflows: - scala_job: name: jdk11_3.x java_version: jdk11 - scala_version: 3.3.5 + scala_version: 3.3.6 - scala_job: name: jdk17_2.12.x java_version: jdk17 @@ -130,7 +130,7 @@ workflows: - scala_job: name: jdk17_3.x java_version: jdk17 - scala_version: 3.3.5 + scala_version: 3.3.6 - scala_job: name: jdk21_2.12.x java_version: jdk21 @@ -142,7 +142,7 @@ workflows: - scala_job: name: jdk21_3.x java_version: jdk21 - scala_version: 3.3.5 + scala_version: 3.3.6 - scalajs_job: name: sjs1.0_2.12.x scala_version: 2.12.20 @@ -151,7 +151,7 @@ workflows: scala_version: 2.13.16 - scalajs_job: name: sjs1.0_3.x - scala_version: 3.3.5 + scala_version: 3.3.6 - scalanative_job: name: native0.4_2.12.x scala_version: 2.12.20 @@ -160,4 +160,4 @@ workflows: scala_version: 2.13.16 - scalanative_job: name: native0.4_3.x - scala_version: 3.3.5 + scala_version: 3.3.6 diff --git a/build.sbt b/build.sbt index d561c4f58..9ba749833 100644 --- a/build.sbt +++ b/build.sbt @@ -36,7 +36,7 @@ lazy val xml = crossProject(JSPlatform, JVMPlatform, NativePlatform) .settings( name := "scala-xml", scalaModuleAutomaticModuleName := Some("scala.xml"), - crossScalaVersions := Seq("2.13.16", "2.12.20", "3.3.5"), + crossScalaVersions := Seq("2.13.16", "2.12.20", "3.3.6"), scalaVersion := "2.12.20", scalacOptions ++= (CrossVersion.partialVersion(scalaVersion.value) match { From eeb49a3633abf925b37b2498cb7dbb090eb40ac6 Mon Sep 17 00:00:00 2001 From: Lukas Rytz Date: Mon, 19 May 2025 13:16:33 +0200 Subject: [PATCH 754/789] Change Node.child return type to immutable.Seq on 2.13+ Change the type of `Node.child` and `Node.nonEmptyChildren` from `collection.Seq` to `immutable.Seq` in 2.13+. A parent is added to `Node` which defines the old signatures for `child` / `nonEmptyChildren`. This (and the resulting bridge methods) ensures binary compatbility. --- build.sbt | 9 +++++- .../scala/xml/ScalaVersionSpecific.scala | 4 +++ .../scala/xml/ScalaVersionSpecific.scala | 9 ++++++ .../xml/ScalaVersionSpecificReturnTypes.scala | 28 +++++++++---------- shared/src/main/scala/scala/xml/Node.scala | 6 ++-- 5 files changed, 38 insertions(+), 18 deletions(-) diff --git a/build.sbt b/build.sbt index 9ba749833..a2b78dbf5 100644 --- a/build.sbt +++ b/build.sbt @@ -1,4 +1,5 @@ -import sbtcrossproject.CrossPlugin.autoImport.{crossProject, CrossType} +import com.typesafe.tools.mima.core._ +import sbtcrossproject.CrossPlugin.autoImport.{CrossType, crossProject} publish / skip := true // root project @@ -68,6 +69,12 @@ lazy val xml = crossProject(JSPlatform, JVMPlatform, NativePlatform) //import com.typesafe.tools.mima.core.{} //import com.typesafe.tools.mima.core.ProblemFilters Seq( // exclusions for all Scala versions + // new method in `Node` with return type `immutable.Seq` + ProblemFilters.exclude[ReversedMissingMethodProblem]("scala.xml.Node.child"), + // these used to be declared methods, but are now bridges without generic signature + ProblemFilters.exclude[IncompatibleSignatureProblem]("scala.xml.Node.nonEmptyChildren"), + ProblemFilters.exclude[IncompatibleSignatureProblem]("scala.xml.Group.child"), + ProblemFilters.exclude[IncompatibleSignatureProblem]("scala.xml.SpecialNode.child"), ) ++ (CrossVersion.partialVersion(scalaVersion.value) match { case Some((3, _)) => Seq( // Scala 3-specific exclusions ) diff --git a/shared/src/main/scala-2.12/scala/xml/ScalaVersionSpecific.scala b/shared/src/main/scala-2.12/scala/xml/ScalaVersionSpecific.scala index b74e3183c..d865ad843 100644 --- a/shared/src/main/scala-2.12/scala/xml/ScalaVersionSpecific.scala +++ b/shared/src/main/scala-2.12/scala/xml/ScalaVersionSpecific.scala @@ -23,6 +23,8 @@ private[xml] object ScalaVersionSpecific { override def apply(): mutable.Builder[Node, NodeSeq] = NodeSeq.newBuilder } type SeqNodeUnapplySeq = scala.collection.Seq[Node] + + type ChildReturnType = scala.collection.Seq[Node] } private[xml] trait ScalaVersionSpecificNodeSeq extends SeqLike[Node, NodeSeq] { self: NodeSeq => @@ -33,3 +35,5 @@ private[xml] trait ScalaVersionSpecificNodeSeq extends SeqLike[Node, NodeSeq] { private[xml] trait ScalaVersionSpecificNodeBuffer { self: NodeBuffer => override def stringPrefix: String = "NodeBuffer" } + +private[xml] trait ScalaVersionSpecificNode {self: Node => } diff --git a/shared/src/main/scala-2.13+/scala/xml/ScalaVersionSpecific.scala b/shared/src/main/scala-2.13+/scala/xml/ScalaVersionSpecific.scala index e08d9ad9f..8441dcfa6 100644 --- a/shared/src/main/scala-2.13+/scala/xml/ScalaVersionSpecific.scala +++ b/shared/src/main/scala-2.13+/scala/xml/ScalaVersionSpecific.scala @@ -25,6 +25,8 @@ private[xml] object ScalaVersionSpecific { def fromSpecific(from: Coll)(it: IterableOnce[Node]): NodeSeq = (NodeSeq.newBuilder ++= from).result() } type SeqNodeUnapplySeq = scala.collection.immutable.Seq[Node] + + type ChildReturnType = scala.collection.immutable.Seq[Node] } private[xml] trait ScalaVersionSpecificNodeSeq @@ -53,3 +55,10 @@ private[xml] trait ScalaVersionSpecificNodeSeq private[xml] trait ScalaVersionSpecificNodeBuffer { self: NodeBuffer => override def className: String = "NodeBuffer" } + +private[xml] trait ScalaVersionSpecificNode { self: Node => + // These methods are overridden in Node with return type `immutable.Seq`. The declarations here result + // in a bridge method in `Node` with result type `collection.Seq` which is needed for binary compatibility. + def child: scala.collection.Seq[Node] + def nonEmptyChildren: scala.collection.Seq[Node] +} diff --git a/shared/src/main/scala-3/scala/xml/ScalaVersionSpecificReturnTypes.scala b/shared/src/main/scala-3/scala/xml/ScalaVersionSpecificReturnTypes.scala index 8e7fcdfc0..83bc29f87 100644 --- a/shared/src/main/scala-3/scala/xml/ScalaVersionSpecificReturnTypes.scala +++ b/shared/src/main/scala-3/scala/xml/ScalaVersionSpecificReturnTypes.scala @@ -19,18 +19,18 @@ package scala.xml What should have been specified explicitly is given in the comments; next time we break binary compatibility the types should be changed in the code and this class removed. */ -private[xml] object ScalaVersionSpecificReturnTypes { // should be - type ExternalIDAttribute = MetaData // Null.type - type NoExternalIDId = String // scala.Null - type NodeNoAttributes = MetaData // Null.type - type NullFilter = MetaData // Null.type - type NullGetNamespace = String // scala.Null - type NullNext = MetaData // scala.Null - type NullKey = String // scala.Null - type NullValue = scala.collection.Seq[Node] // scala.Null - type NullApply1 = scala.collection.Seq[Node] // scala.Null - type NullApply3 = scala.collection.Seq[Node] // scala.Null - type NullRemove = MetaData // Null.type - type SpecialNodeChild = scala.collection.Seq[Node] // Nil.type - type GroupChild = scala.collection.Seq[Node] // Nothing +private[xml] object ScalaVersionSpecificReturnTypes { // should be + type ExternalIDAttribute = MetaData // Null.type + type NoExternalIDId = String // scala.Null + type NodeNoAttributes = MetaData // Null.type + type NullFilter = MetaData // Null.type + type NullGetNamespace = String // scala.Null + type NullNext = MetaData // scala.Null + type NullKey = String // scala.Null + type NullValue = scala.collection.Seq[Node] // scala.Null + type NullApply1 = scala.collection.Seq[Node] // scala.Null + type NullApply3 = scala.collection.Seq[Node] // scala.Null + type NullRemove = MetaData // Null.type + type SpecialNodeChild = scala.collection.immutable.Seq[Node] // Nil.type + type GroupChild = scala.collection.immutable.Seq[Node] // Nothing } diff --git a/shared/src/main/scala/scala/xml/Node.scala b/shared/src/main/scala/scala/xml/Node.scala index ca1d6379c..8f6de627b 100755 --- a/shared/src/main/scala/scala/xml/Node.scala +++ b/shared/src/main/scala/scala/xml/Node.scala @@ -45,7 +45,7 @@ object Node { * * @author Burak Emir and others */ -abstract class Node extends NodeSeq { +abstract class Node extends NodeSeq with ScalaVersionSpecificNode { /** prefix of this node */ def prefix: String = null @@ -120,12 +120,12 @@ abstract class Node extends NodeSeq { * * @return all children of this node */ - def child: Seq[Node] + def child: ScalaVersionSpecific.ChildReturnType /** * Children which do not stringify to "" (needed for equality) */ - def nonEmptyChildren: Seq[Node] = child.filterNot(_.toString.isEmpty) + def nonEmptyChildren: ScalaVersionSpecific.ChildReturnType = child.filterNot(_.toString.isEmpty) /** * Descendant axis (all descendants of this node, not including node itself) From b1675758ae5c951847a1aa220565223c10812e53 Mon Sep 17 00:00:00 2001 From: Lukas Rytz Date: Tue, 20 May 2025 11:41:52 +0200 Subject: [PATCH 755/789] single SeqOfNode alias in ScalaVersionSpecific --- .../main/scala-2.12/scala/xml/ScalaVersionSpecific.scala | 4 +--- .../main/scala-2.13+/scala/xml/ScalaVersionSpecific.scala | 4 +--- shared/src/main/scala/scala/xml/Elem.scala | 2 +- shared/src/main/scala/scala/xml/Node.scala | 6 +++--- shared/src/main/scala/scala/xml/QNode.scala | 2 +- 5 files changed, 7 insertions(+), 11 deletions(-) diff --git a/shared/src/main/scala-2.12/scala/xml/ScalaVersionSpecific.scala b/shared/src/main/scala-2.12/scala/xml/ScalaVersionSpecific.scala index d865ad843..b472ea39e 100644 --- a/shared/src/main/scala-2.12/scala/xml/ScalaVersionSpecific.scala +++ b/shared/src/main/scala-2.12/scala/xml/ScalaVersionSpecific.scala @@ -22,9 +22,7 @@ private[xml] object ScalaVersionSpecific { override def apply(from: Coll): mutable.Builder[Node, NodeSeq] = NodeSeq.newBuilder override def apply(): mutable.Builder[Node, NodeSeq] = NodeSeq.newBuilder } - type SeqNodeUnapplySeq = scala.collection.Seq[Node] - - type ChildReturnType = scala.collection.Seq[Node] + type SeqOfNode = scala.collection.Seq[Node] } private[xml] trait ScalaVersionSpecificNodeSeq extends SeqLike[Node, NodeSeq] { self: NodeSeq => diff --git a/shared/src/main/scala-2.13+/scala/xml/ScalaVersionSpecific.scala b/shared/src/main/scala-2.13+/scala/xml/ScalaVersionSpecific.scala index 8441dcfa6..0853f72b8 100644 --- a/shared/src/main/scala-2.13+/scala/xml/ScalaVersionSpecific.scala +++ b/shared/src/main/scala-2.13+/scala/xml/ScalaVersionSpecific.scala @@ -24,9 +24,7 @@ private[xml] object ScalaVersionSpecific { def newBuilder(from: Coll): Builder[Node, NodeSeq] = NodeSeq.newBuilder def fromSpecific(from: Coll)(it: IterableOnce[Node]): NodeSeq = (NodeSeq.newBuilder ++= from).result() } - type SeqNodeUnapplySeq = scala.collection.immutable.Seq[Node] - - type ChildReturnType = scala.collection.immutable.Seq[Node] + type SeqOfNode = scala.collection.immutable.Seq[Node] } private[xml] trait ScalaVersionSpecificNodeSeq diff --git a/shared/src/main/scala/scala/xml/Elem.scala b/shared/src/main/scala/scala/xml/Elem.scala index bd420e53e..9dcc1835e 100755 --- a/shared/src/main/scala/scala/xml/Elem.scala +++ b/shared/src/main/scala/scala/xml/Elem.scala @@ -27,7 +27,7 @@ object Elem { def apply(prefix: String, label: String, attributes: MetaData, scope: NamespaceBinding, minimizeEmpty: Boolean, child: Node*): Elem = new Elem(prefix, label, attributes, scope, minimizeEmpty, child: _*) - def unapplySeq(n: Node): Option[(String, String, MetaData, NamespaceBinding, ScalaVersionSpecific.SeqNodeUnapplySeq)] = + def unapplySeq(n: Node): Option[(String, String, MetaData, NamespaceBinding, ScalaVersionSpecific.SeqOfNode)] = n match { case _: SpecialNode | _: Group => None case _ => Some((n.prefix, n.label, n.attributes, n.scope, n.child.toSeq)) diff --git a/shared/src/main/scala/scala/xml/Node.scala b/shared/src/main/scala/scala/xml/Node.scala index 8f6de627b..76a6d7398 100755 --- a/shared/src/main/scala/scala/xml/Node.scala +++ b/shared/src/main/scala/scala/xml/Node.scala @@ -28,7 +28,7 @@ object Node { /** the empty namespace */ val EmptyNamespace: String = "" - def unapplySeq(n: Node): Some[(String, MetaData, ScalaVersionSpecific.SeqNodeUnapplySeq)] = + def unapplySeq(n: Node): Some[(String, MetaData, ScalaVersionSpecific.SeqOfNode)] = Some((n.label, n.attributes, n.child.toSeq)) } @@ -120,12 +120,12 @@ abstract class Node extends NodeSeq with ScalaVersionSpecificNode { * * @return all children of this node */ - def child: ScalaVersionSpecific.ChildReturnType + def child: ScalaVersionSpecific.SeqOfNode /** * Children which do not stringify to "" (needed for equality) */ - def nonEmptyChildren: ScalaVersionSpecific.ChildReturnType = child.filterNot(_.toString.isEmpty) + def nonEmptyChildren: ScalaVersionSpecific.SeqOfNode = child.filterNot(_.toString.isEmpty) /** * Descendant axis (all descendants of this node, not including node itself) diff --git a/shared/src/main/scala/scala/xml/QNode.scala b/shared/src/main/scala/scala/xml/QNode.scala index c5128eb45..212554acb 100644 --- a/shared/src/main/scala/scala/xml/QNode.scala +++ b/shared/src/main/scala/scala/xml/QNode.scala @@ -20,6 +20,6 @@ package xml * @author Burak Emir */ object QNode { - def unapplySeq(n: Node): Some[(String, String, MetaData, ScalaVersionSpecific.SeqNodeUnapplySeq)] = + def unapplySeq(n: Node): Some[(String, String, MetaData, ScalaVersionSpecific.SeqOfNode)] = Some((n.scope.getURI(n.prefix), n.label, n.attributes, n.child.toSeq)) } From 3861cbd0bf60de4f7ebff465cec9b9c83c7c8451 Mon Sep 17 00:00:00 2001 From: Lukas Rytz Date: Tue, 20 May 2025 16:54:16 +0200 Subject: [PATCH 756/789] remove / clarify usages of seqToNodeSeq --- .../scala/scala/xml/SerializationTest.scala | 2 +- shared/src/main/scala/scala/xml/Elem.scala | 2 +- .../src/main/scala/scala/xml/MetaData.scala | 2 +- shared/src/main/scala/scala/xml/Utility.scala | 11 +++++----- .../scala/scala/xml/factory/XMLLoader.scala | 20 +++++++++---------- .../xml/parsing/NoBindingFactoryAdapter.scala | 2 +- .../xml/transform/BasicTransformer.scala | 6 +++--- .../test/scala/scala/xml/AttributeTest.scala | 4 ++-- .../test/scala/scala/xml/NodeSeqTest.scala | 9 ++++----- .../test/scala/scala/xml/ShouldCompile.scala | 2 +- shared/src/test/scala/scala/xml/XMLTest.scala | 2 +- 11 files changed, 31 insertions(+), 31 deletions(-) diff --git a/jvm/src/test/scala/scala/xml/SerializationTest.scala b/jvm/src/test/scala/scala/xml/SerializationTest.scala index e8c5c8800..f795daae4 100644 --- a/jvm/src/test/scala/scala/xml/SerializationTest.scala +++ b/jvm/src/test/scala/scala/xml/SerializationTest.scala @@ -25,7 +25,7 @@ class SerializationTest { def implicitConversion(): Unit = { val parent: Elem = val children: Seq[Node] = parent.child - val asNodeSeq: NodeSeq = children + val asNodeSeq: NodeSeq = children // implicit seqToNodeSeq assertEquals(asNodeSeq, JavaByteSerialization.roundTrip(asNodeSeq)) } } diff --git a/shared/src/main/scala/scala/xml/Elem.scala b/shared/src/main/scala/scala/xml/Elem.scala index 9dcc1835e..90e417528 100755 --- a/shared/src/main/scala/scala/xml/Elem.scala +++ b/shared/src/main/scala/scala/xml/Elem.scala @@ -104,7 +104,7 @@ class Elem( scope: NamespaceBinding = this.scope, minimizeEmpty: Boolean = this.minimizeEmpty, child: Seq[Node] = this.child - ): Elem = Elem(prefix, label, attributes, scope, minimizeEmpty, child: _*) + ): Elem = Elem(prefix, label, attributes, scope, minimizeEmpty, child.toSeq: _*) /** * Returns concatenation of `text(n)` for each child `n`. diff --git a/shared/src/main/scala/scala/xml/MetaData.scala b/shared/src/main/scala/scala/xml/MetaData.scala index 979311336..f51c9567e 100644 --- a/shared/src/main/scala/scala/xml/MetaData.scala +++ b/shared/src/main/scala/scala/xml/MetaData.scala @@ -183,7 +183,7 @@ abstract class MetaData * Returns a Map containing the attributes stored as key/value pairs. */ def asAttrMap: Map[String, String] = - iterator.map(x => (x.prefixedKey, x.value.text)).toMap + iterator.map(x => (x.prefixedKey, NodeSeq.fromSeq(x.value).text)).toMap /** returns Null or the next MetaData item */ def next: MetaData diff --git a/shared/src/main/scala/scala/xml/Utility.scala b/shared/src/main/scala/scala/xml/Utility.scala index ff8a2fb4b..08b3ae598 100755 --- a/shared/src/main/scala/scala/xml/Utility.scala +++ b/shared/src/main/scala/scala/xml/Utility.scala @@ -17,6 +17,7 @@ import scala.annotation.tailrec import scala.collection.mutable import scala.language.implicitConversions import scala.collection.Seq +import scala.collection.immutable.{Seq => ISeq} /** * The `Utility` object provides utility functions for processing instances @@ -51,12 +52,12 @@ object Utility extends AnyRef with parsing.TokenTests { */ def trim(x: Node): Node = x match { case Elem(pre, lab, md, scp, child@_*) => - val children: Seq[Node] = combineAdjacentTextNodes(child).flatMap(trimProper) + val children = combineAdjacentTextNodes(child).flatMap(trimProper) Elem(pre, lab, md, scp, children.isEmpty, children: _*) } - private def combineAdjacentTextNodes(children: Seq[Node]): Seq[Node] = - children.foldRight(Seq.empty[Node]) { + private def combineAdjacentTextNodes(children: ScalaVersionSpecific.SeqOfNode): ScalaVersionSpecific.SeqOfNode = + children.foldRight(ISeq.empty[Node]) { case (Text(left), Text(right) +: nodes) => Text(left + right) +: nodes case (n, nodes) => n +: nodes } @@ -67,7 +68,7 @@ object Utility extends AnyRef with parsing.TokenTests { */ def trimProper(x: Node): Seq[Node] = x match { case Elem(pre, lab, md, scp, child@_*) => - val children: Seq[Node] = combineAdjacentTextNodes(child).flatMap(trimProper) + val children = combineAdjacentTextNodes(child).flatMap(trimProper) Elem(pre, lab, md, scp, children.isEmpty, children: _*) case Text(s) => new TextBuffer().append(s).toText @@ -89,7 +90,7 @@ object Utility extends AnyRef with parsing.TokenTests { */ def sort(n: Node): Node = n match { case Elem(pre, lab, md, scp, child@_*) => - val children: Seq[Node] = child.map(sort) + val children = child.map(sort) Elem(pre, lab, sort(md), scp, children.isEmpty, children: _*) case _ => n } diff --git a/shared/src/main/scala/scala/xml/factory/XMLLoader.scala b/shared/src/main/scala/scala/xml/factory/XMLLoader.scala index afe54330a..251027c18 100644 --- a/shared/src/main/scala/scala/xml/factory/XMLLoader.scala +++ b/shared/src/main/scala/scala/xml/factory/XMLLoader.scala @@ -58,7 +58,7 @@ trait XMLLoader[T <: Node] { // TODO remove def loadXML(inputSource: InputSource, parser: SAXParser): T = getDocElem(adapter.loadDocument(inputSource, parser.getXMLReader)) - def loadXMLNodes(inputSource: InputSource, parser: SAXParser): Seq[Node] = adapter.loadDocument(inputSource, parser.getXMLReader).children + def loadXMLNodes(inputSource: InputSource, parser: SAXParser): Seq[Node] = adapter.loadDocument(inputSource, parser.getXMLReader).children.toSeq def adapter: parsing.FactoryAdapter = new parsing.NoBindingFactoryAdapter() /** Loads XML Document. */ @@ -85,13 +85,13 @@ trait XMLLoader[T <: Node] { def loadString(string: String): T = getDocElem(loadStringDocument(string)) /** Load XML nodes, including comments and processing instructions that precede and follow the root element. */ - def loadNodes(inputSource: InputSource): Seq[Node] = loadDocument(inputSource).children - def loadFileNodes(fileName: String): Seq[Node] = loadFileDocument(fileName).children - def loadFileNodes(file: File): Seq[Node] = loadFileDocument(file).children - def loadNodes(url: URL): Seq[Node] = loadDocument(url).children - def loadNodes(sysId: String): Seq[Node] = loadDocument(sysId).children - def loadFileNodes(fileDescriptor: FileDescriptor): Seq[Node] = loadFileDocument(fileDescriptor).children - def loadNodes(inputStream: InputStream): Seq[Node] = loadDocument(inputStream).children - def loadNodes(reader: Reader): Seq[Node] = loadDocument(reader).children - def loadStringNodes(string: String): Seq[Node] = loadStringDocument(string).children + def loadNodes(inputSource: InputSource): Seq[Node] = loadDocument(inputSource).children.toSeq + def loadFileNodes(fileName: String): Seq[Node] = loadFileDocument(fileName).children.toSeq + def loadFileNodes(file: File): Seq[Node] = loadFileDocument(file).children.toSeq + def loadNodes(url: URL): Seq[Node] = loadDocument(url).children.toSeq + def loadNodes(sysId: String): Seq[Node] = loadDocument(sysId).children.toSeq + def loadFileNodes(fileDescriptor: FileDescriptor): Seq[Node] = loadFileDocument(fileDescriptor).children.toSeq + def loadNodes(inputStream: InputStream): Seq[Node] = loadDocument(inputStream).children.toSeq + def loadNodes(reader: Reader): Seq[Node] = loadDocument(reader).children.toSeq + def loadStringNodes(string: String): Seq[Node] = loadStringDocument(string).children.toSeq } diff --git a/shared/src/main/scala/scala/xml/parsing/NoBindingFactoryAdapter.scala b/shared/src/main/scala/scala/xml/parsing/NoBindingFactoryAdapter.scala index bd57b40c7..fcc522a6b 100644 --- a/shared/src/main/scala/scala/xml/parsing/NoBindingFactoryAdapter.scala +++ b/shared/src/main/scala/scala/xml/parsing/NoBindingFactoryAdapter.scala @@ -27,7 +27,7 @@ class NoBindingFactoryAdapter extends FactoryAdapter with NodeFactory[Elem] { /** From NodeFactory. Constructs an instance of scala.xml.Elem -- TODO: deprecate as in Elem */ override protected def create(pre: String, label: String, attrs: MetaData, scope: NamespaceBinding, children: Seq[Node]): Elem = - Elem(pre, label, attrs, scope, children.isEmpty, children: _*) + Elem(pre, label, attrs, scope, children.isEmpty, children.toSeq: _*) /** From FactoryAdapter. Creates a node. never creates the same node twice, using hash-consing. TODO: deprecate as in Elem, or forward to create?? */ diff --git a/shared/src/main/scala/scala/xml/transform/BasicTransformer.scala b/shared/src/main/scala/scala/xml/transform/BasicTransformer.scala index 7ad543b46..144849162 100644 --- a/shared/src/main/scala/scala/xml/transform/BasicTransformer.scala +++ b/shared/src/main/scala/scala/xml/transform/BasicTransformer.scala @@ -46,11 +46,11 @@ abstract class BasicTransformer extends (Node => Node) { if (n.doTransform) n match { case Group(xs) => Group(transform(xs)) // un-group the hack Group tag case _ => - val ch: Seq[Node] = n.child - val nch: Seq[Node] = transform(ch) + val ch = n.child + val nch = transform(ch) if (ch.eq(nch)) n - else Elem(n.prefix, n.label, n.attributes, n.scope, nch.isEmpty, nch: _*) + else Elem(n.prefix, n.label, n.attributes, n.scope, nch.isEmpty, nch.toSeq: _*) } else n diff --git a/shared/src/test/scala/scala/xml/AttributeTest.scala b/shared/src/test/scala/scala/xml/AttributeTest.scala index 5f1a61343..90ea3b0a6 100644 --- a/shared/src/test/scala/scala/xml/AttributeTest.scala +++ b/shared/src/test/scala/scala/xml/AttributeTest.scala @@ -167,7 +167,7 @@ class AttributeTest { @Test(expected=classOf[IllegalArgumentException]) def invalidAttributeFailForMany(): Unit = { - .child \ "@" + .child \ "@" // implicit seqToNodeSeq } @Test(expected=classOf[IllegalArgumentException]) @@ -177,6 +177,6 @@ class AttributeTest { @Test(expected=classOf[IllegalArgumentException]) def invalidEmptyAttributeFailForMany(): Unit = { - .child \@ "" + .child \@ "" // implicit seqToNodeSeq } } diff --git a/shared/src/test/scala/scala/xml/NodeSeqTest.scala b/shared/src/test/scala/scala/xml/NodeSeqTest.scala index 558a77a78..a5808e797 100644 --- a/shared/src/test/scala/scala/xml/NodeSeqTest.scala +++ b/shared/src/test/scala/scala/xml/NodeSeqTest.scala @@ -1,6 +1,5 @@ package scala.xml -import scala.xml.NodeSeq.seqToNodeSeq import org.junit.Test import org.junit.Assert.assertEquals import org.junit.Assert.fail @@ -30,7 +29,7 @@ class NodeSeqTest { case res: Seq[Node] => assertEquals(2, res.size.toLong) case _: NodeSeq => fail("Should be Seq[Node] was NodeSeq") // Unreachable code? } - val res: NodeSeq = a :+ b + val res: NodeSeq = a :+ b // implicit seqToNodeSeq val exp: NodeSeq = NodeSeq.fromSeq(Seq(Hello, Hi)) assertEquals(exp, res) } @@ -59,7 +58,7 @@ class NodeSeqTest { case res: Seq[Node] => assertEquals(3, res.size.toLong) case _: NodeSeq => fail("Should be Seq[Node] was NodeSeq") // Unreachable code? } - val res: NodeSeq = a ++: b ++: c + val res: NodeSeq = a ++: b ++: c // implicit seqToNodeSeq val exp: NodeSeq = NodeSeq.fromSeq(Seq(Hello, Hi, Hey)) assertEquals(exp, res) } @@ -67,7 +66,7 @@ class NodeSeqTest { @Test def testMap(): Unit = { val a: NodeSeq = Hello - val exp: NodeSeq = Seq(Hi) + val exp: NodeSeq = Seq(Hi) // implicit seqToNodeSeq assertEquals(exp, a.map(_ => Hi)) assertEquals(exp, for { _ <- a } yield { Hi }) } @@ -75,7 +74,7 @@ class NodeSeqTest { @Test def testFlatMap(): Unit = { val a: NodeSeq = Hello - val exp: NodeSeq = Seq(Hi) + val exp: NodeSeq = Seq(Hi) // implicit seqToNodeSeq assertEquals(exp, a.flatMap(_ => Seq(Hi))) assertEquals(exp, for { b <- a; _ <- b } yield { Hi }) assertEquals(exp, for { b <- a; c <- b; _ <- c } yield { Hi }) diff --git a/shared/src/test/scala/scala/xml/ShouldCompile.scala b/shared/src/test/scala/scala/xml/ShouldCompile.scala index df8a237da..63dd91fce 100644 --- a/shared/src/test/scala/scala/xml/ShouldCompile.scala +++ b/shared/src/test/scala/scala/xml/ShouldCompile.scala @@ -70,7 +70,7 @@ class Floozy { object guardedMatch { // SI-3705 // guard caused verifyerror in oldpatmat -- TODO: move this to compiler test suite - def updateNodes(ns: Seq[Node]): Seq[Node] = + def updateNodes(ns: ScalaVersionSpecific.SeqOfNode): ScalaVersionSpecific.SeqOfNode = for (subnode <- ns) yield subnode match { case { _ } if true => abc case Elem(prefix, label, attribs, scope, children @ _*) => diff --git a/shared/src/test/scala/scala/xml/XMLTest.scala b/shared/src/test/scala/scala/xml/XMLTest.scala index 989ca02e5..746d58d68 100644 --- a/shared/src/test/scala/scala/xml/XMLTest.scala +++ b/shared/src/test/scala/scala/xml/XMLTest.scala @@ -521,7 +521,7 @@ Ours is the portal of hope, come as you are." @UnitTest def i1976(): Unit = { val node: Elem = { "whatever " } - assertEquals("whatever ", node.child.text) + assertEquals("whatever ", node.child.text) // implicit seqToNodeSeq } @UnitTest From 4d58e59260ec9a82035d4a83d6edf5c7c85e0c0f Mon Sep 17 00:00:00 2001 From: Lukas Rytz Date: Tue, 20 May 2025 17:00:58 +0200 Subject: [PATCH 757/789] Don't pass NodeBuffer as Seq[Node] --- shared/src/main/scala/scala/xml/Document.scala | 2 +- shared/src/main/scala/scala/xml/Utility.scala | 3 ++- shared/src/main/scala/scala/xml/parsing/MarkupParser.scala | 7 +++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/shared/src/main/scala/scala/xml/Document.scala b/shared/src/main/scala/scala/xml/Document.scala index e242794f8..b1cd23f26 100644 --- a/shared/src/main/scala/scala/xml/Document.scala +++ b/shared/src/main/scala/scala/xml/Document.scala @@ -36,7 +36,7 @@ class Document extends NodeSeq with Serializable { * excluded. If there is a document type declaration, the list also * contains a document type declaration information item. */ - var children: Seq[Node] = _ + var children: Seq[Node] = _ // effectively an `immutable.Seq`, not changed due to binary compatibility /** The element information item corresponding to the document element. */ var docElem: Node = _ diff --git a/shared/src/main/scala/scala/xml/Utility.scala b/shared/src/main/scala/scala/xml/Utility.scala index 08b3ae598..3a3d36549 100755 --- a/shared/src/main/scala/scala/xml/Utility.scala +++ b/shared/src/main/scala/scala/xml/Utility.scala @@ -354,6 +354,7 @@ object Utility extends AnyRef with parsing.TokenTests { null } + // unused, untested def parseAttributeValue(value: String): Seq[Node] = { val sb: StringBuilder = new StringBuilder var rfb: StringBuilder = null @@ -398,7 +399,7 @@ object Utility extends AnyRef with parsing.TokenTests { else nb += x } - nb + nb.toVector } /** diff --git a/shared/src/main/scala/scala/xml/parsing/MarkupParser.scala b/shared/src/main/scala/scala/xml/parsing/MarkupParser.scala index 2ca4773cb..618133a2b 100755 --- a/shared/src/main/scala/scala/xml/parsing/MarkupParser.scala +++ b/shared/src/main/scala/scala/xml/parsing/MarkupParser.scala @@ -242,7 +242,7 @@ trait MarkupParser extends MarkupParserCommon with TokenTests { } nextch() // is prolog ? - var children: NodeSeq = null + var children: Seq[Node] = null if ('?' == ch) { nextch() info_prolog = prolog() @@ -255,7 +255,7 @@ trait MarkupParser extends MarkupParserCommon with TokenTests { val ts: NodeBuffer = new NodeBuffer() content1(TopScope, ts) // DTD handled as side effect ts &+ content(TopScope) - children = NodeSeq.fromSeq(ts) + children = ts.toVector } //println("[MarkupParser::document] children now: "+children.toList) var elemCount: Int = 0 @@ -451,8 +451,7 @@ trait MarkupParser extends MarkupParserCommon with TokenTests { def content(pscope: NamespaceBinding): NodeSeq = { val ts: NodeBuffer = new NodeBuffer var exit: Boolean = eof - // todo: optimize seq repr. - def done: NodeSeq = NodeSeq.fromSeq(ts.toList) + def done: NodeSeq = NodeSeq.fromSeq(ts.toVector) while (!exit) { tmppos = pos From 4c20a1799a867bcc8e65deb33baad2688e34db22 Mon Sep 17 00:00:00 2001 From: Lukas Rytz Date: Wed, 21 May 2025 10:19:58 +0200 Subject: [PATCH 758/789] Use immtuable.Seq for attributes --- build.sbt | 30 +++++++++++++++++++ .../scala/xml/ScalaVersionSpecific.scala | 4 ++- .../scala/xml/ScalaVersionSpecific.scala | 8 +++++ .../xml/ScalaVersionSpecificReturnTypes.scala | 1 - .../xml/ScalaVersionSpecificReturnTypes.scala | 5 ++-- .../src/main/scala/scala/xml/Attribute.scala | 8 ++--- shared/src/main/scala/scala/xml/Elem.scala | 2 +- .../src/main/scala/scala/xml/MetaData.scala | 15 +++++----- shared/src/main/scala/scala/xml/Node.scala | 6 ++-- shared/src/main/scala/scala/xml/Null.scala | 2 +- .../scala/scala/xml/PrefixedAttribute.scala | 8 +++-- shared/src/main/scala/scala/xml/QNode.scala | 2 +- .../scala/scala/xml/UnprefixedAttribute.scala | 8 +++-- 13 files changed, 71 insertions(+), 28 deletions(-) diff --git a/build.sbt b/build.sbt index a2b78dbf5..20167efd3 100644 --- a/build.sbt +++ b/build.sbt @@ -71,10 +71,40 @@ lazy val xml = crossProject(JSPlatform, JVMPlatform, NativePlatform) Seq( // exclusions for all Scala versions // new method in `Node` with return type `immutable.Seq` ProblemFilters.exclude[ReversedMissingMethodProblem]("scala.xml.Node.child"), + // these used to be declared methods, but are now bridges without generic signature ProblemFilters.exclude[IncompatibleSignatureProblem]("scala.xml.Node.nonEmptyChildren"), ProblemFilters.exclude[IncompatibleSignatureProblem]("scala.xml.Group.child"), ProblemFilters.exclude[IncompatibleSignatureProblem]("scala.xml.SpecialNode.child"), + + // new methods with return type immutable.Seq + ProblemFilters.exclude[ReversedMissingMethodProblem]("scala.xml.Attribute.apply"), + ProblemFilters.exclude[ReversedMissingMethodProblem]("scala.xml.Attribute.value"), + ProblemFilters.exclude[ReversedMissingMethodProblem]("scala.xml.MetaData.apply"), + ProblemFilters.exclude[ReversedMissingMethodProblem]("scala.xml.MetaData.value"), + + // Synthetic static accessors (for Java interop) have a changed return type + ProblemFilters.exclude[IncompatibleResultTypeProblem]("scala.xml.Null.apply"), + ProblemFilters.exclude[IncompatibleResultTypeProblem]("scala.xml.Null.value"), + + // used to be a declared method, now a bridge without generic signature + ProblemFilters.exclude[IncompatibleSignatureProblem]("scala.xml.MetaData.apply"), + ProblemFilters.exclude[IncompatibleSignatureProblem]("scala.xml.Null.apply"), + ProblemFilters.exclude[IncompatibleSignatureProblem]("scala.xml.Null.value"), + ProblemFilters.exclude[IncompatibleSignatureProblem]("scala.xml.PrefixedAttribute.apply"), + ProblemFilters.exclude[IncompatibleSignatureProblem]("scala.xml.PrefixedAttribute.value"), + ProblemFilters.exclude[IncompatibleSignatureProblem]("scala.xml.UnprefixedAttribute.apply"), + ProblemFilters.exclude[IncompatibleSignatureProblem]("scala.xml.UnprefixedAttribute.value"), + + // Option[c.Seq] => Option[i.Seq] results in a changed generic signature + ProblemFilters.exclude[IncompatibleSignatureProblem]("scala.xml.MetaData.get"), + ProblemFilters.exclude[IncompatibleSignatureProblem]("scala.xml.Null.get"), + ProblemFilters.exclude[IncompatibleSignatureProblem]("scala.xml.Node.attribute"), + + // trait Attribute now extends trait ScalaVersionSpecificMetaData to ensure the previous signatures + // with return type `collection.Seq` remain valid. + // (trait Attribute extends MetaData, but that parent is not present in bytecode because it's a class.) + ProblemFilters.exclude[InheritedNewAbstractMethodProblem]("scala.xml.Attribute.apply"), ) ++ (CrossVersion.partialVersion(scalaVersion.value) match { case Some((3, _)) => Seq( // Scala 3-specific exclusions ) diff --git a/shared/src/main/scala-2.12/scala/xml/ScalaVersionSpecific.scala b/shared/src/main/scala-2.12/scala/xml/ScalaVersionSpecific.scala index b472ea39e..f90feadd2 100644 --- a/shared/src/main/scala-2.12/scala/xml/ScalaVersionSpecific.scala +++ b/shared/src/main/scala-2.12/scala/xml/ScalaVersionSpecific.scala @@ -34,4 +34,6 @@ private[xml] trait ScalaVersionSpecificNodeBuffer { self: NodeBuffer => override def stringPrefix: String = "NodeBuffer" } -private[xml] trait ScalaVersionSpecificNode {self: Node => } +private[xml] trait ScalaVersionSpecificNode { self: Node => } + +private[xml] trait ScalaVersionSpecificMetaData { self: MetaData => } diff --git a/shared/src/main/scala-2.13+/scala/xml/ScalaVersionSpecific.scala b/shared/src/main/scala-2.13+/scala/xml/ScalaVersionSpecific.scala index 0853f72b8..5a4d4e72a 100644 --- a/shared/src/main/scala-2.13+/scala/xml/ScalaVersionSpecific.scala +++ b/shared/src/main/scala-2.13+/scala/xml/ScalaVersionSpecific.scala @@ -60,3 +60,11 @@ private[xml] trait ScalaVersionSpecificNode { self: Node => def child: scala.collection.Seq[Node] def nonEmptyChildren: scala.collection.Seq[Node] } + +private[xml] trait ScalaVersionSpecificMetaData { self: MetaData => + def apply(key: String): scala.collection.Seq[Node] + def apply(namespace_uri: String, owner: Node, key: String): scala.collection.Seq[Node] + def apply(namespace_uri: String, scp: NamespaceBinding, k: String): scala.collection.Seq[Node] + + def value: scala.collection.Seq[Node] +} diff --git a/shared/src/main/scala-2/scala/xml/ScalaVersionSpecificReturnTypes.scala b/shared/src/main/scala-2/scala/xml/ScalaVersionSpecificReturnTypes.scala index 22820dea9..6d40d40fb 100644 --- a/shared/src/main/scala-2/scala/xml/ScalaVersionSpecificReturnTypes.scala +++ b/shared/src/main/scala-2/scala/xml/ScalaVersionSpecificReturnTypes.scala @@ -28,7 +28,6 @@ private[xml] object ScalaVersionSpecificReturnTypes { // should be type NullNext = scala.Null type NullKey = scala.Null type NullValue = scala.Null - type NullApply1 = scala.collection.Seq[Node] // scala.Null type NullApply3 = scala.Null type NullRemove = Null.type type SpecialNodeChild = Nil.type diff --git a/shared/src/main/scala-3/scala/xml/ScalaVersionSpecificReturnTypes.scala b/shared/src/main/scala-3/scala/xml/ScalaVersionSpecificReturnTypes.scala index 83bc29f87..e6dce41cc 100644 --- a/shared/src/main/scala-3/scala/xml/ScalaVersionSpecificReturnTypes.scala +++ b/shared/src/main/scala-3/scala/xml/ScalaVersionSpecificReturnTypes.scala @@ -27,9 +27,8 @@ private[xml] object ScalaVersionSpecificReturnTypes { // should be type NullGetNamespace = String // scala.Null type NullNext = MetaData // scala.Null type NullKey = String // scala.Null - type NullValue = scala.collection.Seq[Node] // scala.Null - type NullApply1 = scala.collection.Seq[Node] // scala.Null - type NullApply3 = scala.collection.Seq[Node] // scala.Null + type NullValue = scala.collection.immutable.Seq[Node] // scala.Null + type NullApply3 = scala.collection.immutable.Seq[Node] // scala.Null type NullRemove = MetaData // Null.type type SpecialNodeChild = scala.collection.immutable.Seq[Node] // Nil.type type GroupChild = scala.collection.immutable.Seq[Node] // Nothing diff --git a/shared/src/main/scala/scala/xml/Attribute.scala b/shared/src/main/scala/scala/xml/Attribute.scala index 97457ab77..1c7c35750 100644 --- a/shared/src/main/scala/scala/xml/Attribute.scala +++ b/shared/src/main/scala/scala/xml/Attribute.scala @@ -53,14 +53,14 @@ object Attribute { * * @author Burak Emir */ -trait Attribute extends MetaData { +trait Attribute extends MetaData with ScalaVersionSpecificMetaData { def pre: String // will be null if unprefixed override val key: String - override val value: Seq[Node] + override val value: ScalaVersionSpecific.SeqOfNode override val next: MetaData - override def apply(key: String): Seq[Node] - override def apply(namespace: String, scope: NamespaceBinding, key: String): Seq[Node] + override def apply(key: String): ScalaVersionSpecific.SeqOfNode + override def apply(namespace: String, scope: NamespaceBinding, key: String): ScalaVersionSpecific.SeqOfNode override def copy(next: MetaData): Attribute override def remove(key: String): MetaData = diff --git a/shared/src/main/scala/scala/xml/Elem.scala b/shared/src/main/scala/scala/xml/Elem.scala index 90e417528..6b77f1642 100755 --- a/shared/src/main/scala/scala/xml/Elem.scala +++ b/shared/src/main/scala/scala/xml/Elem.scala @@ -30,7 +30,7 @@ object Elem { def unapplySeq(n: Node): Option[(String, String, MetaData, NamespaceBinding, ScalaVersionSpecific.SeqOfNode)] = n match { case _: SpecialNode | _: Group => None - case _ => Some((n.prefix, n.label, n.attributes, n.scope, n.child.toSeq)) + case _ => Some((n.prefix, n.label, n.attributes, n.scope, n.child)) } } diff --git a/shared/src/main/scala/scala/xml/MetaData.scala b/shared/src/main/scala/scala/xml/MetaData.scala index f51c9567e..6bdd080f0 100644 --- a/shared/src/main/scala/scala/xml/MetaData.scala +++ b/shared/src/main/scala/scala/xml/MetaData.scala @@ -85,6 +85,7 @@ abstract class MetaData with Iterable[MetaData] with Equality with Serializable + with ScalaVersionSpecificMetaData { private[xml] def isNull: Boolean = this.eq(Null) @@ -106,7 +107,7 @@ abstract class MetaData * @param key * @return value as Seq[Node] if key is found, null otherwise */ - def apply(key: String): Seq[Node] + def apply(key: String): ScalaVersionSpecific.SeqOfNode /** * convenience method, same as `apply(namespace, owner.scope, key)`. @@ -115,7 +116,7 @@ abstract class MetaData * @param owner the element owning this attribute list * @param key the attribute key */ - final def apply(namespace_uri: String, owner: Node, key: String): Seq[Node] = + final def apply(namespace_uri: String, owner: Node, key: String): ScalaVersionSpecific.SeqOfNode = apply(namespace_uri, owner.scope, key) /** @@ -126,7 +127,7 @@ abstract class MetaData * @param k to be looked for * @return value as Seq[Node] if key is found, null otherwise */ - def apply(namespace_uri: String, scp: NamespaceBinding, k: String): Seq[Node] + def apply(namespace_uri: String, scp: NamespaceBinding, k: String): ScalaVersionSpecific.SeqOfNode /** * returns a copy of this MetaData item with next field set to argument. @@ -168,7 +169,7 @@ abstract class MetaData def key: String /** returns value of this MetaData item */ - def value: Seq[Node] + def value: ScalaVersionSpecific.SeqOfNode /** * Returns a String containing "prefix:key" if the first key is @@ -194,10 +195,10 @@ abstract class MetaData * @param key * @return value in Some(Seq[Node]) if key is found, None otherwise */ - final def get(key: String): Option[Seq[Node]] = Option(apply(key)) + final def get(key: String): Option[ScalaVersionSpecific.SeqOfNode] = Option(apply(key)) /** same as get(uri, owner.scope, key) */ - final def get(uri: String, owner: Node, key: String): Option[Seq[Node]] = + final def get(uri: String, owner: Node, key: String): Option[ScalaVersionSpecific.SeqOfNode] = get(uri, owner.scope, key) /** @@ -208,7 +209,7 @@ abstract class MetaData * @param key to be looked fore * @return value as `Some[Seq[Node]]` if key is found, None otherwise */ - final def get(uri: String, scope: NamespaceBinding, key: String): Option[Seq[Node]] = + final def get(uri: String, scope: NamespaceBinding, key: String): Option[ScalaVersionSpecific.SeqOfNode] = Option(apply(uri, scope, key)) protected def toString1: String = sbToString(toString1) diff --git a/shared/src/main/scala/scala/xml/Node.scala b/shared/src/main/scala/scala/xml/Node.scala index 76a6d7398..d44dbd4e1 100755 --- a/shared/src/main/scala/scala/xml/Node.scala +++ b/shared/src/main/scala/scala/xml/Node.scala @@ -29,7 +29,7 @@ object Node { val EmptyNamespace: String = "" def unapplySeq(n: Node): Some[(String, MetaData, ScalaVersionSpecific.SeqOfNode)] = - Some((n.label, n.attributes, n.child.toSeq)) + Some((n.label, n.attributes, n.child)) } /** @@ -92,7 +92,7 @@ abstract class Node extends NodeSeq with ScalaVersionSpecificNode { * @return value of `UnprefixedAttribute` with given key * in attributes, if it exists, otherwise `null`. */ - final def attribute(key: String): Option[Seq[Node]] = attributes.get(key) + final def attribute(key: String): Option[ScalaVersionSpecific.SeqOfNode] = attributes.get(key) /** * Convenience method, looks up a prefixed attribute in attributes of this node. @@ -103,7 +103,7 @@ abstract class Node extends NodeSeq with ScalaVersionSpecificNode { * @return value of `PrefixedAttribute` with given namespace * and given key, otherwise `'''null'''`. */ - final def attribute(uri: String, key: String): Option[Seq[Node]] = + final def attribute(uri: String, key: String): Option[ScalaVersionSpecific.SeqOfNode] = attributes.get(uri, this, key) /** diff --git a/shared/src/main/scala/scala/xml/Null.scala b/shared/src/main/scala/scala/xml/Null.scala index 5613a462f..c8e35640c 100644 --- a/shared/src/main/scala/scala/xml/Null.scala +++ b/shared/src/main/scala/scala/xml/Null.scala @@ -49,7 +49,7 @@ case object Null extends MetaData { override protected def basisForHashCode: Seq[Any] = Nil override def apply(namespace: String, scope: NamespaceBinding, key: String): ScalaVersionSpecificReturnTypes.NullApply3 = null - override def apply(key: String): ScalaVersionSpecificReturnTypes.NullApply1 = + override def apply(key: String): ScalaVersionSpecific.SeqOfNode = if (Utility.isNameStart(key.head)) null else throw new IllegalArgumentException(s"not a valid attribute name '$key', so can never match !") diff --git a/shared/src/main/scala/scala/xml/PrefixedAttribute.scala b/shared/src/main/scala/scala/xml/PrefixedAttribute.scala index 3a3985fe5..fcd60c490 100644 --- a/shared/src/main/scala/scala/xml/PrefixedAttribute.scala +++ b/shared/src/main/scala/scala/xml/PrefixedAttribute.scala @@ -27,11 +27,13 @@ import scala.collection.Seq class PrefixedAttribute( override val pre: String, override val key: String, - override val value: Seq[Node], + _value: Seq[Node], val next1: MetaData ) extends Attribute { + override val value: ScalaVersionSpecific.SeqOfNode = if (_value == null) null else _value.toSeq + override val next: MetaData = if (value != null) next1 else next1.remove(key) /** same as this(pre, key, Text(value), next), or no attribute if value is null */ @@ -53,12 +55,12 @@ class PrefixedAttribute( owner.getNamespace(pre) /** forwards the call to next (because caller looks for unprefixed attribute */ - override def apply(key: String): Seq[Node] = next(key) + override def apply(key: String): ScalaVersionSpecific.SeqOfNode = next(key) /** * gets attribute value of qualified (prefixed) attribute with given key */ - override def apply(namespace: String, scope: NamespaceBinding, key: String): Seq[Node] = + override def apply(namespace: String, scope: NamespaceBinding, key: String): ScalaVersionSpecific.SeqOfNode = if (key == this.key && scope.getURI(pre) == namespace) value else diff --git a/shared/src/main/scala/scala/xml/QNode.scala b/shared/src/main/scala/scala/xml/QNode.scala index 212554acb..ddf7818c4 100644 --- a/shared/src/main/scala/scala/xml/QNode.scala +++ b/shared/src/main/scala/scala/xml/QNode.scala @@ -21,5 +21,5 @@ package xml */ object QNode { def unapplySeq(n: Node): Some[(String, String, MetaData, ScalaVersionSpecific.SeqOfNode)] = - Some((n.scope.getURI(n.prefix), n.label, n.attributes, n.child.toSeq)) + Some((n.scope.getURI(n.prefix), n.label, n.attributes, n.child)) } diff --git a/shared/src/main/scala/scala/xml/UnprefixedAttribute.scala b/shared/src/main/scala/scala/xml/UnprefixedAttribute.scala index 0f0446802..870833ab8 100644 --- a/shared/src/main/scala/scala/xml/UnprefixedAttribute.scala +++ b/shared/src/main/scala/scala/xml/UnprefixedAttribute.scala @@ -23,11 +23,13 @@ import scala.collection.Seq // Note: used by the Scala compiler. class UnprefixedAttribute( override val key: String, - override val value: Seq[Node], + _value: Seq[Node], next1: MetaData ) extends Attribute { + override val value: ScalaVersionSpecific.SeqOfNode = if (_value == null) null else _value.toSeq + final override val pre: scala.Null = null override val next: MetaData = if (value != null) next1 else next1.remove(key) @@ -50,7 +52,7 @@ class UnprefixedAttribute( * @param key * @return value as Seq[Node] if key is found, null otherwise */ - override def apply(key: String): Seq[Node] = + override def apply(key: String): ScalaVersionSpecific.SeqOfNode = if (key == this.key) value else next(key) /** @@ -61,7 +63,7 @@ class UnprefixedAttribute( * @param key * @return .. */ - override def apply(namespace: String, scope: NamespaceBinding, key: String): Seq[Node] = + override def apply(namespace: String, scope: NamespaceBinding, key: String): ScalaVersionSpecific.SeqOfNode = next(namespace, scope, key) } object UnprefixedAttribute { From 0023e9395b2924a0fc5f523c8f324a1a427d39ea Mon Sep 17 00:00:00 2001 From: Lukas Rytz Date: Wed, 21 May 2025 12:03:18 +0200 Subject: [PATCH 759/789] Change theSeq to immtuable.Seq --- build.sbt | 4 ++++ .../src/main/scala-2.13+/scala/xml/ScalaVersionSpecific.scala | 2 ++ shared/src/main/scala/scala/xml/Document.scala | 2 +- shared/src/main/scala/scala/xml/Group.scala | 2 +- shared/src/main/scala/scala/xml/Node.scala | 2 +- shared/src/main/scala/scala/xml/NodeSeq.scala | 4 ++-- 6 files changed, 11 insertions(+), 5 deletions(-) diff --git a/build.sbt b/build.sbt index 20167efd3..d58433ef4 100644 --- a/build.sbt +++ b/build.sbt @@ -82,6 +82,7 @@ lazy val xml = crossProject(JSPlatform, JVMPlatform, NativePlatform) ProblemFilters.exclude[ReversedMissingMethodProblem]("scala.xml.Attribute.value"), ProblemFilters.exclude[ReversedMissingMethodProblem]("scala.xml.MetaData.apply"), ProblemFilters.exclude[ReversedMissingMethodProblem]("scala.xml.MetaData.value"), + ProblemFilters.exclude[ReversedMissingMethodProblem]("scala.xml.NodeSeq.theSeq"), // Synthetic static accessors (for Java interop) have a changed return type ProblemFilters.exclude[IncompatibleResultTypeProblem]("scala.xml.Null.apply"), @@ -95,6 +96,9 @@ lazy val xml = crossProject(JSPlatform, JVMPlatform, NativePlatform) ProblemFilters.exclude[IncompatibleSignatureProblem]("scala.xml.PrefixedAttribute.value"), ProblemFilters.exclude[IncompatibleSignatureProblem]("scala.xml.UnprefixedAttribute.apply"), ProblemFilters.exclude[IncompatibleSignatureProblem]("scala.xml.UnprefixedAttribute.value"), + ProblemFilters.exclude[IncompatibleSignatureProblem]("scala.xml.Document.theSeq"), + ProblemFilters.exclude[IncompatibleSignatureProblem]("scala.xml.Group.theSeq"), + ProblemFilters.exclude[IncompatibleSignatureProblem]("scala.xml.Node.theSeq"), // Option[c.Seq] => Option[i.Seq] results in a changed generic signature ProblemFilters.exclude[IncompatibleSignatureProblem]("scala.xml.MetaData.get"), diff --git a/shared/src/main/scala-2.13+/scala/xml/ScalaVersionSpecific.scala b/shared/src/main/scala-2.13+/scala/xml/ScalaVersionSpecific.scala index 5a4d4e72a..5c5aa272e 100644 --- a/shared/src/main/scala-2.13+/scala/xml/ScalaVersionSpecific.scala +++ b/shared/src/main/scala-2.13+/scala/xml/ScalaVersionSpecific.scala @@ -48,6 +48,8 @@ private[xml] trait ScalaVersionSpecificNodeSeq fromSpecific(new View.Map(this, f)) def flatMap(f: Node => IterableOnce[Node]): NodeSeq = fromSpecific(new View.FlatMap(this, f)) + + def theSeq: scala.collection.Seq[Node] } private[xml] trait ScalaVersionSpecificNodeBuffer { self: NodeBuffer => diff --git a/shared/src/main/scala/scala/xml/Document.scala b/shared/src/main/scala/scala/xml/Document.scala index b1cd23f26..8fe1c6ae4 100644 --- a/shared/src/main/scala/scala/xml/Document.scala +++ b/shared/src/main/scala/scala/xml/Document.scala @@ -96,7 +96,7 @@ class Document extends NodeSeq with Serializable { // methods for NodeSeq - override def theSeq: Seq[Node] = this.docElem + override def theSeq: ScalaVersionSpecific.SeqOfNode = this.docElem override def canEqual(other: Any): Boolean = other match { case _: Document => true diff --git a/shared/src/main/scala/scala/xml/Group.scala b/shared/src/main/scala/scala/xml/Group.scala index 4c8fd7baf..3abc72226 100644 --- a/shared/src/main/scala/scala/xml/Group.scala +++ b/shared/src/main/scala/scala/xml/Group.scala @@ -22,7 +22,7 @@ import scala.collection.Seq */ // Note: used by the Scala compiler. final case class Group(nodes: Seq[Node]) extends Node { - override def theSeq: Seq[Node] = nodes + override def theSeq: ScalaVersionSpecific.SeqOfNode = nodes.toSeq override def canEqual(other: Any): Boolean = other match { case _: Group => true diff --git a/shared/src/main/scala/scala/xml/Node.scala b/shared/src/main/scala/scala/xml/Node.scala index d44dbd4e1..d9c41dd1e 100755 --- a/shared/src/main/scala/scala/xml/Node.scala +++ b/shared/src/main/scala/scala/xml/Node.scala @@ -166,7 +166,7 @@ abstract class Node extends NodeSeq with ScalaVersionSpecificNode { /** * returns a sequence consisting of only this node */ - override def theSeq: Seq[Node] = this :: Nil + override def theSeq: ScalaVersionSpecific.SeqOfNode = this :: Nil /** * String representation of this node diff --git a/shared/src/main/scala/scala/xml/NodeSeq.scala b/shared/src/main/scala/scala/xml/NodeSeq.scala index bdf316f92..7e37369ce 100644 --- a/shared/src/main/scala/scala/xml/NodeSeq.scala +++ b/shared/src/main/scala/scala/xml/NodeSeq.scala @@ -26,7 +26,7 @@ import scala.collection.Seq object NodeSeq { final val Empty: NodeSeq = fromSeq(Nil) def fromSeq(s: Seq[Node]): NodeSeq = new NodeSeq { - override def theSeq: Seq[Node] = s + override def theSeq: ScalaVersionSpecific.SeqOfNode = s.toSeq } // --- @@ -48,7 +48,7 @@ object NodeSeq { * @author Burak Emir */ abstract class NodeSeq extends AbstractSeq[Node] with immutable.Seq[Node] with ScalaVersionSpecificNodeSeq with Equality with Serializable { - def theSeq: Seq[Node] + def theSeq: ScalaVersionSpecific.SeqOfNode override def length: Int = theSeq.length override def iterator: Iterator[Node] = theSeq.iterator From e044d5d53feaf52d36c9f60b20754a704a8c18d1 Mon Sep 17 00:00:00 2001 From: Lukas Rytz Date: Wed, 21 May 2025 13:28:46 +0200 Subject: [PATCH 760/789] Use immutable.Seq in utilities --- build.sbt | 5 +++++ .../scala-2.12/scala/xml/ScalaVersionSpecific.scala | 5 +++++ .../scala-2.13+/scala/xml/ScalaVersionSpecific.scala | 10 ++++++++++ shared/src/main/scala/scala/xml/TextBuffer.scala | 7 ++++--- shared/src/main/scala/scala/xml/Utility.scala | 6 +++--- 5 files changed, 27 insertions(+), 6 deletions(-) diff --git a/build.sbt b/build.sbt index d58433ef4..a20199816 100644 --- a/build.sbt +++ b/build.sbt @@ -87,6 +87,8 @@ lazy val xml = crossProject(JSPlatform, JVMPlatform, NativePlatform) // Synthetic static accessors (for Java interop) have a changed return type ProblemFilters.exclude[IncompatibleResultTypeProblem]("scala.xml.Null.apply"), ProblemFilters.exclude[IncompatibleResultTypeProblem]("scala.xml.Null.value"), + ProblemFilters.exclude[IncompatibleResultTypeProblem]("scala.xml.Utility.parseAttributeValue"), + ProblemFilters.exclude[IncompatibleResultTypeProblem]("scala.xml.Utility.trimProper"), // used to be a declared method, now a bridge without generic signature ProblemFilters.exclude[IncompatibleSignatureProblem]("scala.xml.MetaData.apply"), @@ -99,6 +101,9 @@ lazy val xml = crossProject(JSPlatform, JVMPlatform, NativePlatform) ProblemFilters.exclude[IncompatibleSignatureProblem]("scala.xml.Document.theSeq"), ProblemFilters.exclude[IncompatibleSignatureProblem]("scala.xml.Group.theSeq"), ProblemFilters.exclude[IncompatibleSignatureProblem]("scala.xml.Node.theSeq"), + ProblemFilters.exclude[IncompatibleSignatureProblem]("scala.xml.TextBuffer.toText"), + ProblemFilters.exclude[IncompatibleSignatureProblem]("scala.xml.Utility.trimProper"), + ProblemFilters.exclude[IncompatibleSignatureProblem]("scala.xml.Utility.parseAttributeValue"), // Option[c.Seq] => Option[i.Seq] results in a changed generic signature ProblemFilters.exclude[IncompatibleSignatureProblem]("scala.xml.MetaData.get"), diff --git a/shared/src/main/scala-2.12/scala/xml/ScalaVersionSpecific.scala b/shared/src/main/scala-2.12/scala/xml/ScalaVersionSpecific.scala index f90feadd2..71f130031 100644 --- a/shared/src/main/scala-2.12/scala/xml/ScalaVersionSpecific.scala +++ b/shared/src/main/scala-2.12/scala/xml/ScalaVersionSpecific.scala @@ -23,6 +23,7 @@ private[xml] object ScalaVersionSpecific { override def apply(): mutable.Builder[Node, NodeSeq] = NodeSeq.newBuilder } type SeqOfNode = scala.collection.Seq[Node] + type SeqOfText = scala.collection.Seq[Text] } private[xml] trait ScalaVersionSpecificNodeSeq extends SeqLike[Node, NodeSeq] { self: NodeSeq => @@ -37,3 +38,7 @@ private[xml] trait ScalaVersionSpecificNodeBuffer { self: NodeBuffer => private[xml] trait ScalaVersionSpecificNode { self: Node => } private[xml] trait ScalaVersionSpecificMetaData { self: MetaData => } + +private[xml] trait ScalaVersionSpecificTextBuffer { self: TextBuffer => } + +private[xml] trait ScalaVersionSpecificUtility { self: Utility.type => } diff --git a/shared/src/main/scala-2.13+/scala/xml/ScalaVersionSpecific.scala b/shared/src/main/scala-2.13+/scala/xml/ScalaVersionSpecific.scala index 5c5aa272e..49da95b8b 100644 --- a/shared/src/main/scala-2.13+/scala/xml/ScalaVersionSpecific.scala +++ b/shared/src/main/scala-2.13+/scala/xml/ScalaVersionSpecific.scala @@ -25,6 +25,7 @@ private[xml] object ScalaVersionSpecific { def fromSpecific(from: Coll)(it: IterableOnce[Node]): NodeSeq = (NodeSeq.newBuilder ++= from).result() } type SeqOfNode = scala.collection.immutable.Seq[Node] + type SeqOfText = scala.collection.immutable.Seq[Text] } private[xml] trait ScalaVersionSpecificNodeSeq @@ -70,3 +71,12 @@ private[xml] trait ScalaVersionSpecificMetaData { self: MetaData => def value: scala.collection.Seq[Node] } + +private[xml] trait ScalaVersionSpecificTextBuffer { self: TextBuffer => + def toText: scala.collection.Seq[Text] +} + +private[xml] trait ScalaVersionSpecificUtility { self: Utility.type => + def trimProper(x: Node): scala.collection.Seq[Node] + def parseAttributeValue(value: String): scala.collection.Seq[Node] +} diff --git a/shared/src/main/scala/scala/xml/TextBuffer.scala b/shared/src/main/scala/scala/xml/TextBuffer.scala index a56fde475..5492790a3 100644 --- a/shared/src/main/scala/scala/xml/TextBuffer.scala +++ b/shared/src/main/scala/scala/xml/TextBuffer.scala @@ -14,6 +14,7 @@ package scala package xml import scala.collection.Seq +import scala.collection.immutable.{Seq => ISeq} import Utility.isSpace object TextBuffer { @@ -26,7 +27,7 @@ object TextBuffer { * appended with the `append` method will be replaced by a single space * character, and leading and trailing space will be removed completely. */ -class TextBuffer { +class TextBuffer extends ScalaVersionSpecificTextBuffer { val sb: StringBuilder = new StringBuilder() /** @@ -45,8 +46,8 @@ class TextBuffer { * * @return the text without whitespaces. */ - def toText: Seq[Text] = sb.toString.trim match { + def toText: ScalaVersionSpecific.SeqOfText = sb.toString.trim match { case "" => Nil - case s => Seq(Text(s)) + case s => ISeq(Text(s)) } } diff --git a/shared/src/main/scala/scala/xml/Utility.scala b/shared/src/main/scala/scala/xml/Utility.scala index 3a3d36549..cf85be14f 100755 --- a/shared/src/main/scala/scala/xml/Utility.scala +++ b/shared/src/main/scala/scala/xml/Utility.scala @@ -25,7 +25,7 @@ import scala.collection.immutable.{Seq => ISeq} * * @author Burak Emir */ -object Utility extends AnyRef with parsing.TokenTests { +object Utility extends AnyRef with parsing.TokenTests with ScalaVersionSpecificUtility { final val SU: Char = '\u001A' // [Martin] This looks dubious. We don't convert StringBuilders to @@ -66,7 +66,7 @@ object Utility extends AnyRef with parsing.TokenTests { * trim a child of an element. `Attribute` values and `Atom` nodes that * are not `Text` nodes are unaffected. */ - def trimProper(x: Node): Seq[Node] = x match { + def trimProper(x: Node): ScalaVersionSpecific.SeqOfNode = x match { case Elem(pre, lab, md, scp, child@_*) => val children = combineAdjacentTextNodes(child).flatMap(trimProper) Elem(pre, lab, md, scp, children.isEmpty, children: _*) @@ -355,7 +355,7 @@ object Utility extends AnyRef with parsing.TokenTests { } // unused, untested - def parseAttributeValue(value: String): Seq[Node] = { + def parseAttributeValue(value: String): ScalaVersionSpecific.SeqOfNode = { val sb: StringBuilder = new StringBuilder var rfb: StringBuilder = null val nb: NodeBuffer = new NodeBuffer() From 1399695869771abf5123a8f54b3ea494d00eb45e Mon Sep 17 00:00:00 2001 From: Lukas Rytz Date: Fri, 23 May 2025 10:40:58 +0200 Subject: [PATCH 761/789] Use Vector for non-immutable collecitons --- shared/src/main/scala/scala/xml/NodeSeq.scala | 5 ++++- shared/src/main/scala/scala/xml/PrefixedAttribute.scala | 5 ++++- shared/src/main/scala/scala/xml/UnprefixedAttribute.scala | 5 ++++- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/shared/src/main/scala/scala/xml/NodeSeq.scala b/shared/src/main/scala/scala/xml/NodeSeq.scala index 7e37369ce..07cbb8a65 100644 --- a/shared/src/main/scala/scala/xml/NodeSeq.scala +++ b/shared/src/main/scala/scala/xml/NodeSeq.scala @@ -26,7 +26,10 @@ import scala.collection.Seq object NodeSeq { final val Empty: NodeSeq = fromSeq(Nil) def fromSeq(s: Seq[Node]): NodeSeq = new NodeSeq { - override def theSeq: ScalaVersionSpecific.SeqOfNode = s.toSeq + override def theSeq: ScalaVersionSpecific.SeqOfNode = s match { + case ns: ScalaVersionSpecific.SeqOfNode => ns + case _ => s.toVector + } } // --- diff --git a/shared/src/main/scala/scala/xml/PrefixedAttribute.scala b/shared/src/main/scala/scala/xml/PrefixedAttribute.scala index fcd60c490..1dc6ba124 100644 --- a/shared/src/main/scala/scala/xml/PrefixedAttribute.scala +++ b/shared/src/main/scala/scala/xml/PrefixedAttribute.scala @@ -32,7 +32,10 @@ class PrefixedAttribute( ) extends Attribute { - override val value: ScalaVersionSpecific.SeqOfNode = if (_value == null) null else _value.toSeq + override val value: ScalaVersionSpecific.SeqOfNode = if (_value == null) null else _value match { + case ns: ScalaVersionSpecific.SeqOfNode => ns + case _ => _value.toVector + } override val next: MetaData = if (value != null) next1 else next1.remove(key) diff --git a/shared/src/main/scala/scala/xml/UnprefixedAttribute.scala b/shared/src/main/scala/scala/xml/UnprefixedAttribute.scala index 870833ab8..877a59b25 100644 --- a/shared/src/main/scala/scala/xml/UnprefixedAttribute.scala +++ b/shared/src/main/scala/scala/xml/UnprefixedAttribute.scala @@ -28,7 +28,10 @@ class UnprefixedAttribute( ) extends Attribute { - override val value: ScalaVersionSpecific.SeqOfNode = if (_value == null) null else _value.toSeq + override val value: ScalaVersionSpecific.SeqOfNode = if (_value == null) null else _value match { + case ns: ScalaVersionSpecific.SeqOfNode => ns + case _ => _value.toVector + } final override val pre: scala.Null = null override val next: MetaData = if (value != null) next1 else next1.remove(key) From caa287e8825d2579ece0431d924684c6090d87ea Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Sat, 24 May 2025 20:42:39 +0000 Subject: [PATCH 762/789] Update sbt, scripted-plugin to 1.11.0 --- project/build.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/build.properties b/project/build.properties index cc68b53f1..6520f6981 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version=1.10.11 +sbt.version=1.11.0 From d04f3c33201fb7380cf77fd14de148956118179f Mon Sep 17 00:00:00 2001 From: Lukas Rytz Date: Tue, 27 May 2025 09:44:42 +0200 Subject: [PATCH 763/789] Ensure conversion to imm.Seq is only done once --- shared/src/main/scala/scala/xml/Group.scala | 4 ++++ shared/src/main/scala/scala/xml/NodeSeq.scala | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/shared/src/main/scala/scala/xml/Group.scala b/shared/src/main/scala/scala/xml/Group.scala index 3abc72226..4498dbef5 100644 --- a/shared/src/main/scala/scala/xml/Group.scala +++ b/shared/src/main/scala/scala/xml/Group.scala @@ -22,6 +22,10 @@ import scala.collection.Seq */ // Note: used by the Scala compiler. final case class Group(nodes: Seq[Node]) extends Node { + // Ideally, the `immutable.Seq` would be stored as a field. + // But evolving the case class and remaining binary compatible is very difficult + // Since `Group` is used rarely, call `toSeq` on the field. + // In practice, it should not matter - the `nodes` field anyway contains an `immutable.Seq`. override def theSeq: ScalaVersionSpecific.SeqOfNode = nodes.toSeq override def canEqual(other: Any): Boolean = other match { diff --git a/shared/src/main/scala/scala/xml/NodeSeq.scala b/shared/src/main/scala/scala/xml/NodeSeq.scala index 07cbb8a65..39fdbf865 100644 --- a/shared/src/main/scala/scala/xml/NodeSeq.scala +++ b/shared/src/main/scala/scala/xml/NodeSeq.scala @@ -26,7 +26,7 @@ import scala.collection.Seq object NodeSeq { final val Empty: NodeSeq = fromSeq(Nil) def fromSeq(s: Seq[Node]): NodeSeq = new NodeSeq { - override def theSeq: ScalaVersionSpecific.SeqOfNode = s match { + override val theSeq: ScalaVersionSpecific.SeqOfNode = s match { case ns: ScalaVersionSpecific.SeqOfNode => ns case _ => s.toVector } From 1adde38da12d01d177bdbadb7e94ab84c73cc6bf Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Tue, 3 Jun 2025 22:13:31 +0000 Subject: [PATCH 764/789] Update sbt, scripted-plugin to 1.11.1 --- project/build.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/build.properties b/project/build.properties index 6520f6981..61c9b1cb1 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version=1.11.0 +sbt.version=1.11.1 From 7fbb438b165b9cbd8c3f547f8446dae85e1db27b Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Fri, 6 Jun 2025 06:59:11 +0000 Subject: [PATCH 765/789] Update sbt-scala-module to 3.3.0 --- project/plugins.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/plugins.sbt b/project/plugins.sbt index bfec069c2..39d80f82e 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,4 +1,4 @@ -addSbtPlugin("org.scala-lang.modules" % "sbt-scala-module" % "3.2.2") +addSbtPlugin("org.scala-lang.modules" % "sbt-scala-module" % "3.3.0") addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.3.2") addSbtPlugin("org.portable-scala" % "sbt-scala-native-crossproject" % "1.3.2") addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.19.0") From f857246d3410d854dbe434577c75202338657704 Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Sat, 7 Jun 2025 18:07:03 +0000 Subject: [PATCH 766/789] Update auxlib, clib, javalib, junit-runtime, ... to 0.5.8 --- project/plugins.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/plugins.sbt b/project/plugins.sbt index bfec069c2..f43e1e520 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -2,5 +2,5 @@ addSbtPlugin("org.scala-lang.modules" % "sbt-scala-module" % "3.2.2") addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.3.2") addSbtPlugin("org.portable-scala" % "sbt-scala-native-crossproject" % "1.3.2") addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.19.0") -addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.5.7") +addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.5.8") addSbtPlugin("de.heikoseeberger" % "sbt-header" % "5.10.0") From 3a9e2592329d6d1928b82d90ca5e604694ca1ed8 Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Tue, 10 Jun 2025 02:23:40 +0000 Subject: [PATCH 767/789] Update sbt, scripted-plugin to 1.11.2 --- project/build.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/build.properties b/project/build.properties index 61c9b1cb1..bbb0b608c 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version=1.11.1 +sbt.version=1.11.2 From c41183f500457b4c355d0541e98613aaf4b77ee4 Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Sun, 6 Jul 2025 19:22:51 +0000 Subject: [PATCH 768/789] Update sbt, scripted-plugin to 1.11.3 --- project/build.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/build.properties b/project/build.properties index bbb0b608c..c02c575fd 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version=1.11.2 +sbt.version=1.11.3 From cb1df112eda81866e7e48d449c4c4c1a854765d2 Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Wed, 9 Jul 2025 23:45:29 +0000 Subject: [PATCH 769/789] Update commons-lang3 to 3.18.0 --- build.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index a20199816..10f5acef1 100644 --- a/build.sbt +++ b/build.sbt @@ -166,7 +166,7 @@ lazy val xml = crossProject(JSPlatform, JVMPlatform, NativePlatform) libraryDependencies += "junit" % "junit" % "4.13.2" % Test, libraryDependencies += "com.github.sbt" % "junit-interface" % "0.13.3" % Test, - libraryDependencies += "org.apache.commons" % "commons-lang3" % "3.17.0" % Test, + libraryDependencies += "org.apache.commons" % "commons-lang3" % "3.18.0" % Test, libraryDependencies += "xerces" % "xercesImpl" % "2.12.2" % Test, libraryDependencies ++= (CrossVersion.partialVersion(scalaVersion.value) match { case Some((3, _)) => From e9a9c718be8b2b82620a96bae35184444da077bb Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Tue, 12 Aug 2025 20:02:12 +0000 Subject: [PATCH 770/789] Update sbt, scripted-plugin to 1.11.4 --- project/build.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/build.properties b/project/build.properties index c02c575fd..489e0a72d 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version=1.11.3 +sbt.version=1.11.4 From b02b775a6564ae9e0c36d19885f386f7d432d450 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 18 Aug 2025 06:23:03 +0000 Subject: [PATCH 771/789] Bump actions/checkout from 4 to 5 Bumps [actions/checkout](https://github.com/actions/checkout) from 4 to 5. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/checkout/compare/v4...v5) --- updated-dependencies: - dependency-name: actions/checkout dependency-version: '5' dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/ci.yml | 2 +- .github/workflows/release.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b0594e67c..eeeb10de3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,7 +13,7 @@ jobs: scala: [2.12.x, 2.13.x, 3.x] runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v5 with: fetch-depth: 0 - uses: actions/setup-java@v4 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 1e5360b8a..e326ecc97 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -6,7 +6,7 @@ jobs: publish: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v5 with: fetch-depth: 0 - uses: actions/setup-java@v4 From 25447d1985d537be11c3768a68b4f42e786fd612 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 25 Aug 2025 06:39:37 +0000 Subject: [PATCH 772/789] Bump actions/setup-java from 4 to 5 Bumps [actions/setup-java](https://github.com/actions/setup-java) from 4 to 5. - [Release notes](https://github.com/actions/setup-java/releases) - [Commits](https://github.com/actions/setup-java/compare/v4...v5) --- updated-dependencies: - dependency-name: actions/setup-java dependency-version: '5' dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/ci.yml | 2 +- .github/workflows/release.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index eeeb10de3..5ea052184 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,7 +16,7 @@ jobs: - uses: actions/checkout@v5 with: fetch-depth: 0 - - uses: actions/setup-java@v4 + - uses: actions/setup-java@v5 with: distribution: temurin java-version: ${{matrix.java}} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index e326ecc97..764ad61bc 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -9,7 +9,7 @@ jobs: - uses: actions/checkout@v5 with: fetch-depth: 0 - - uses: actions/setup-java@v4 + - uses: actions/setup-java@v5 with: distribution: temurin java-version: 8 From 58e30ddb3914b8c2bcd4925f9ca5b684442e039e Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Tue, 26 Aug 2025 20:29:10 +0000 Subject: [PATCH 773/789] Update sbt, scripted-plugin to 1.11.5 --- project/build.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/build.properties b/project/build.properties index 489e0a72d..e480c675f 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version=1.11.4 +sbt.version=1.11.5 From b7f821e495af804d45f165d6e426fe976e1c0979 Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Sun, 7 Sep 2025 20:46:10 +0000 Subject: [PATCH 774/789] Update sbt-scalajs, scalajs-compiler, ... to 1.20.1 --- project/plugins.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/plugins.sbt b/project/plugins.sbt index 2d6b8de43..633efb76e 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,6 +1,6 @@ addSbtPlugin("org.scala-lang.modules" % "sbt-scala-module" % "3.3.0") addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.3.2") addSbtPlugin("org.portable-scala" % "sbt-scala-native-crossproject" % "1.3.2") -addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.19.0") +addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.20.1") addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.5.8") addSbtPlugin("de.heikoseeberger" % "sbt-header" % "5.10.0") From 6b57bec9cf04e40af3fb28516807a944bdecdaf2 Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Sun, 7 Sep 2025 20:46:12 +0000 Subject: [PATCH 775/789] Update sbt, scripted-plugin to 1.11.6 --- project/build.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/build.properties b/project/build.properties index e480c675f..5e6884d37 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version=1.11.5 +sbt.version=1.11.6 From 94eed0f98d9c4e57d194e887ed9e41a9e71730b4 Mon Sep 17 00:00:00 2001 From: xuwei-k <6b656e6a69@gmail.com> Date: Sun, 14 Sep 2025 15:18:34 +0900 Subject: [PATCH 776/789] update scala3 repository links --- README.md | 4 ++-- shared/src/main/scala/scala/xml/parsing/MarkupParser.scala | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 6cd3fe413..5e743beaa 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ scala-xml [![latest release for 3.0](https://img.shields.io/maven-central/v/org.scala-lang.modules/scala-xml_3.svg?label=scala+3)](http://mvnrepository.com/artifact/org.scala-lang.modules/scala-xml_3) ========= -The standard Scala XML library. Please file XML issues here, not at https://github.com/scala/bug/issues or http://github.com/lampepfl/dotty/issues. +The standard Scala XML library. Please file XML issues here, not at https://github.com/scala/bug/issues or http://github.com/scala/scala3/issues. The decoupling of scala-xml from the Scala compiler and standard library is possible because the compiler desugars XML literals in Scala source code into a set of method calls. Alternative implementations of these calls are welcome! @@ -12,7 +12,7 @@ Compiler code that shows the calls needed: [Scala 2.11](https://github.com/scala/scala/blob/2.11.x/src/compiler/scala/tools/nsc/ast/parser/SymbolicXMLBuilder.scala), [Scala 2.12](https://github.com/scala/scala/blob/2.12.x/src/compiler/scala/tools/nsc/ast/parser/SymbolicXMLBuilder.scala), [Scala 2.13](https://github.com/scala/scala/blob/2.13.x/src/compiler/scala/tools/nsc/ast/parser/SymbolicXMLBuilder.scala), - [Scala 3](https://github.com/lampepfl/dotty/blob/main/compiler/src/dotty/tools/dotc/parsing/xml/SymbolicXMLBuilder.scala). + [Scala 3](https://github.com/scala/scala3/blob/main/compiler/src/dotty/tools/dotc/parsing/xml/SymbolicXMLBuilder.scala). API documentation is available [here](https://javadoc.io/doc/org.scala-lang.modules/scala-xml_2.13/). diff --git a/shared/src/main/scala/scala/xml/parsing/MarkupParser.scala b/shared/src/main/scala/scala/xml/parsing/MarkupParser.scala index 618133a2b..688ca3425 100755 --- a/shared/src/main/scala/scala/xml/parsing/MarkupParser.scala +++ b/shared/src/main/scala/scala/xml/parsing/MarkupParser.scala @@ -60,7 +60,7 @@ trait MarkupParser extends MarkupParserCommon with TokenTests { // See ticket #3720 for motivations. // As for why it's `private[parsing]` rather than merely `private`, see // https://github.com/scala/scala-xml/issues/541 ; the broader access is necessary, - // for now anyway, to work around https://github.com/lampepfl/dotty/issues/13096 + // for now anyway, to work around https://github.com/scala/scala3/issues/13096 private[parsing] class WithLookAhead(underlying: Source) extends Source { private val queue: scala.collection.mutable.Queue[Char] = scala.collection.mutable.Queue[Char]() def lookahead(): BufferedIterator[Char] = { @@ -99,7 +99,7 @@ trait MarkupParser extends MarkupParserCommon with TokenTests { /** holds temporary values of pos */ // Note: if marked as an override, this causes a "...cannot override a mutable variable" error with Scala 3; - // SethTisue noted on Oct 14, 2021 that lampepfl/dotty#13744 should fix it - and it probably did, + // SethTisue noted on Oct 14, 2021 that scala/scala3#13744 should fix it - and it probably did, // but Scala XML still builds against Scala 3 version that has this bug, so this still can not be marked as an override :( var tmppos: Int = _ From 4e558befbef5ac66e16bf23227a2e5d9c29693f1 Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Thu, 25 Sep 2025 17:52:27 +0000 Subject: [PATCH 777/789] Update commons-lang3 to 3.19.0 --- build.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index 10f5acef1..14b90336f 100644 --- a/build.sbt +++ b/build.sbt @@ -166,7 +166,7 @@ lazy val xml = crossProject(JSPlatform, JVMPlatform, NativePlatform) libraryDependencies += "junit" % "junit" % "4.13.2" % Test, libraryDependencies += "com.github.sbt" % "junit-interface" % "0.13.3" % Test, - libraryDependencies += "org.apache.commons" % "commons-lang3" % "3.18.0" % Test, + libraryDependencies += "org.apache.commons" % "commons-lang3" % "3.19.0" % Test, libraryDependencies += "xerces" % "xercesImpl" % "2.12.2" % Test, libraryDependencies ++= (CrossVersion.partialVersion(scalaVersion.value) match { case Some((3, _)) => From 4414dfc249a446328e201445e1e0a265a3e510bd Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Mon, 6 Oct 2025 06:47:46 +0000 Subject: [PATCH 778/789] Update sbt, scripted-plugin to 1.11.7 --- project/build.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/build.properties b/project/build.properties index 5e6884d37..01a16ed14 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version=1.11.6 +sbt.version=1.11.7 From aa5bbccbeb0130f4dc7a1451c4787e259ad43e1f Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Mon, 13 Oct 2025 19:07:01 +0000 Subject: [PATCH 779/789] Update auxlib, clib, javalib, junit-runtime, ... to 0.5.9 --- project/plugins.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/plugins.sbt b/project/plugins.sbt index 633efb76e..5d1b5abd2 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -2,5 +2,5 @@ addSbtPlugin("org.scala-lang.modules" % "sbt-scala-module" % "3.3.0") addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.3.2") addSbtPlugin("org.portable-scala" % "sbt-scala-native-crossproject" % "1.3.2") addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.20.1") -addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.5.8") +addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.5.9") addSbtPlugin("de.heikoseeberger" % "sbt-header" % "5.10.0") From c6cbb7b4e5cba13723c8fa8349a94c9815a8dd58 Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Tue, 7 Oct 2025 19:47:25 +0000 Subject: [PATCH 780/789] Update scala-compiler, scala-library to 2.13.17 --- .circleci/config.yml | 12 ++++++------ build.sbt | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 63b364a21..7109e4360 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -102,7 +102,7 @@ workflows: - scala_job: name: 2.13.x java_version: jdk8 - scala_version: 2.13.16 + scala_version: 2.13.17 - scala_job: name: 3.x java_version: jdk8 @@ -114,7 +114,7 @@ workflows: - scala_job: name: jdk11_2.13.x java_version: jdk11 - scala_version: 2.13.16 + scala_version: 2.13.17 - scala_job: name: jdk11_3.x java_version: jdk11 @@ -126,7 +126,7 @@ workflows: - scala_job: name: jdk17_2.13.x java_version: jdk17 - scala_version: 2.13.16 + scala_version: 2.13.17 - scala_job: name: jdk17_3.x java_version: jdk17 @@ -138,7 +138,7 @@ workflows: - scala_job: name: jdk21_2.13.x java_version: jdk21 - scala_version: 2.13.16 + scala_version: 2.13.17 - scala_job: name: jdk21_3.x java_version: jdk21 @@ -148,7 +148,7 @@ workflows: scala_version: 2.12.20 - scalajs_job: name: sjs1.0_2.13.x - scala_version: 2.13.16 + scala_version: 2.13.17 - scalajs_job: name: sjs1.0_3.x scala_version: 3.3.6 @@ -157,7 +157,7 @@ workflows: scala_version: 2.12.20 - scalanative_job: name: native0.4_2.13.x - scala_version: 2.13.16 + scala_version: 2.13.17 - scalanative_job: name: native0.4_3.x scala_version: 3.3.6 diff --git a/build.sbt b/build.sbt index 14b90336f..bda4df8b2 100644 --- a/build.sbt +++ b/build.sbt @@ -37,7 +37,7 @@ lazy val xml = crossProject(JSPlatform, JVMPlatform, NativePlatform) .settings( name := "scala-xml", scalaModuleAutomaticModuleName := Some("scala.xml"), - crossScalaVersions := Seq("2.13.16", "2.12.20", "3.3.6"), + crossScalaVersions := Seq("2.13.17", "2.12.20", "3.3.6"), scalaVersion := "2.12.20", scalacOptions ++= (CrossVersion.partialVersion(scalaVersion.value) match { From b84a5a76467f1299a4275c73a88106d5f82bab9b Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Wed, 15 Oct 2025 20:33:52 +0000 Subject: [PATCH 781/789] Update scala3-library, ... to 3.3.7 --- .circleci/config.yml | 12 ++++++------ build.sbt | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 7109e4360..ed7b822f4 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -106,7 +106,7 @@ workflows: - scala_job: name: 3.x java_version: jdk8 - scala_version: 3.3.6 + scala_version: 3.3.7 - scala_job: name: jdk11_2.12.x java_version: jdk11 @@ -118,7 +118,7 @@ workflows: - scala_job: name: jdk11_3.x java_version: jdk11 - scala_version: 3.3.6 + scala_version: 3.3.7 - scala_job: name: jdk17_2.12.x java_version: jdk17 @@ -130,7 +130,7 @@ workflows: - scala_job: name: jdk17_3.x java_version: jdk17 - scala_version: 3.3.6 + scala_version: 3.3.7 - scala_job: name: jdk21_2.12.x java_version: jdk21 @@ -142,7 +142,7 @@ workflows: - scala_job: name: jdk21_3.x java_version: jdk21 - scala_version: 3.3.6 + scala_version: 3.3.7 - scalajs_job: name: sjs1.0_2.12.x scala_version: 2.12.20 @@ -151,7 +151,7 @@ workflows: scala_version: 2.13.17 - scalajs_job: name: sjs1.0_3.x - scala_version: 3.3.6 + scala_version: 3.3.7 - scalanative_job: name: native0.4_2.12.x scala_version: 2.12.20 @@ -160,4 +160,4 @@ workflows: scala_version: 2.13.17 - scalanative_job: name: native0.4_3.x - scala_version: 3.3.6 + scala_version: 3.3.7 diff --git a/build.sbt b/build.sbt index bda4df8b2..566683a8e 100644 --- a/build.sbt +++ b/build.sbt @@ -37,7 +37,7 @@ lazy val xml = crossProject(JSPlatform, JVMPlatform, NativePlatform) .settings( name := "scala-xml", scalaModuleAutomaticModuleName := Some("scala.xml"), - crossScalaVersions := Seq("2.13.17", "2.12.20", "3.3.6"), + crossScalaVersions := Seq("2.13.17", "2.12.20", "3.3.7"), scalaVersion := "2.12.20", scalacOptions ++= (CrossVersion.partialVersion(scalaVersion.value) match { From b5b20809b0fe39170783854ad7a6d5d8fc8264eb Mon Sep 17 00:00:00 2001 From: Seth Tisue Date: Tue, 11 Nov 2025 15:59:03 -0600 Subject: [PATCH 782/789] remove redundant dependency (#785) sbt-scala-module brings in sbt-header itself --- project/plugins.sbt | 1 - 1 file changed, 1 deletion(-) diff --git a/project/plugins.sbt b/project/plugins.sbt index 5d1b5abd2..daa6f005e 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -3,4 +3,3 @@ addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.3.2") addSbtPlugin("org.portable-scala" % "sbt-scala-native-crossproject" % "1.3.2") addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.20.1") addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.5.9") -addSbtPlugin("de.heikoseeberger" % "sbt-header" % "5.10.0") From ecc9082502ca128ebd45f3f66ef7636a63b4072e Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Wed, 12 Nov 2025 20:25:10 +0000 Subject: [PATCH 783/789] Update sbt-scala-module to 3.4.0 --- project/plugins.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/plugins.sbt b/project/plugins.sbt index daa6f005e..c1bb697f9 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,4 +1,4 @@ -addSbtPlugin("org.scala-lang.modules" % "sbt-scala-module" % "3.3.0") +addSbtPlugin("org.scala-lang.modules" % "sbt-scala-module" % "3.4.0") addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.3.2") addSbtPlugin("org.portable-scala" % "sbt-scala-native-crossproject" % "1.3.2") addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.20.1") From 01e99502dfc00ab4526905d96004b562524552fa Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Tue, 18 Nov 2025 00:41:19 +0000 Subject: [PATCH 784/789] Update commons-lang3 to 3.20.0 --- build.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index 566683a8e..f21d73846 100644 --- a/build.sbt +++ b/build.sbt @@ -166,7 +166,7 @@ lazy val xml = crossProject(JSPlatform, JVMPlatform, NativePlatform) libraryDependencies += "junit" % "junit" % "4.13.2" % Test, libraryDependencies += "com.github.sbt" % "junit-interface" % "0.13.3" % Test, - libraryDependencies += "org.apache.commons" % "commons-lang3" % "3.19.0" % Test, + libraryDependencies += "org.apache.commons" % "commons-lang3" % "3.20.0" % Test, libraryDependencies += "xerces" % "xercesImpl" % "2.12.2" % Test, libraryDependencies ++= (CrossVersion.partialVersion(scalaVersion.value) match { case Some((3, _)) => From 4e23bfae712a38e303026322757bcb7c3262328f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 24 Nov 2025 04:09:26 +0000 Subject: [PATCH 785/789] Bump actions/checkout from 5 to 6 Bumps [actions/checkout](https://github.com/actions/checkout) from 5 to 6. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/checkout/compare/v5...v6) --- updated-dependencies: - dependency-name: actions/checkout dependency-version: '6' dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/ci.yml | 2 +- .github/workflows/release.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5ea052184..727f99175 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,7 +13,7 @@ jobs: scala: [2.12.x, 2.13.x, 3.x] runs-on: ubuntu-latest steps: - - uses: actions/checkout@v5 + - uses: actions/checkout@v6 with: fetch-depth: 0 - uses: actions/setup-java@v5 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 764ad61bc..cdef358d8 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -6,7 +6,7 @@ jobs: publish: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v5 + - uses: actions/checkout@v6 with: fetch-depth: 0 - uses: actions/setup-java@v5 From f3340be6ec0360b1850dc7ae85fc12eac959d91d Mon Sep 17 00:00:00 2001 From: Lukas Rytz Date: Tue, 25 Nov 2025 22:12:52 +0100 Subject: [PATCH 786/789] Call `reset` on reusable `SAXParser` instance (#742) --- jvm/src/test/scala/scala/xml/XMLTest.scala | 5 +++-- shared/src/main/scala/scala/xml/factory/XMLLoader.scala | 6 +++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/jvm/src/test/scala/scala/xml/XMLTest.scala b/jvm/src/test/scala/scala/xml/XMLTest.scala index 5bad0fb38..4e5dba1a6 100644 --- a/jvm/src/test/scala/scala/xml/XMLTest.scala +++ b/jvm/src/test/scala/scala/xml/XMLTest.scala @@ -667,13 +667,14 @@ class XMLTestJVM { @UnitTest def checkThatErrorHandlerIsNotOverwritten(): Unit = { var gotAnError: Boolean = false - XML.reader.setErrorHandler(new org.xml.sax.ErrorHandler { + val reader = XML.reader + reader.setErrorHandler(new org.xml.sax.ErrorHandler { override def warning(e: SAXParseException): Unit = gotAnError = true override def error(e: SAXParseException): Unit = gotAnError = true override def fatalError(e: SAXParseException): Unit = gotAnError = true }) try { - XML.loadString("") + XML.adapter.loadDocument(Source.fromString(""), reader) } catch { case _: org.xml.sax.SAXParseException => } diff --git a/shared/src/main/scala/scala/xml/factory/XMLLoader.scala b/shared/src/main/scala/scala/xml/factory/XMLLoader.scala index 251027c18..356e67a1c 100644 --- a/shared/src/main/scala/scala/xml/factory/XMLLoader.scala +++ b/shared/src/main/scala/scala/xml/factory/XMLLoader.scala @@ -45,7 +45,11 @@ trait XMLLoader[T <: Node] { } /* Override this to use a different SAXParser. */ - def parser: SAXParser = parserInstance.get + def parser: SAXParser = { + val p = parserInstance.get + p.reset() + p + } /* Override this to use a different XMLReader. */ def reader: XMLReader = parser.getXMLReader From ec4064a742e881fec93306254e13088bfb3735bf Mon Sep 17 00:00:00 2001 From: Lukas Rytz Date: Wed, 26 Nov 2025 09:27:52 +0100 Subject: [PATCH 787/789] catch UnsupportedOperationException in sax parser reset --- shared/src/main/scala/scala/xml/factory/XMLLoader.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shared/src/main/scala/scala/xml/factory/XMLLoader.scala b/shared/src/main/scala/scala/xml/factory/XMLLoader.scala index 356e67a1c..068b5cd37 100644 --- a/shared/src/main/scala/scala/xml/factory/XMLLoader.scala +++ b/shared/src/main/scala/scala/xml/factory/XMLLoader.scala @@ -47,7 +47,7 @@ trait XMLLoader[T <: Node] { /* Override this to use a different SAXParser. */ def parser: SAXParser = { val p = parserInstance.get - p.reset() + try { p.reset() } catch { case _: UnsupportedOperationException => } p } From 530125a6dda1a400aff5cda700242c0db6d45411 Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Wed, 26 Nov 2025 23:39:14 +0000 Subject: [PATCH 788/789] Update scala-compiler, scala-library to 2.13.18 --- .circleci/config.yml | 12 ++++++------ build.sbt | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index ed7b822f4..984794397 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -102,7 +102,7 @@ workflows: - scala_job: name: 2.13.x java_version: jdk8 - scala_version: 2.13.17 + scala_version: 2.13.18 - scala_job: name: 3.x java_version: jdk8 @@ -114,7 +114,7 @@ workflows: - scala_job: name: jdk11_2.13.x java_version: jdk11 - scala_version: 2.13.17 + scala_version: 2.13.18 - scala_job: name: jdk11_3.x java_version: jdk11 @@ -126,7 +126,7 @@ workflows: - scala_job: name: jdk17_2.13.x java_version: jdk17 - scala_version: 2.13.17 + scala_version: 2.13.18 - scala_job: name: jdk17_3.x java_version: jdk17 @@ -138,7 +138,7 @@ workflows: - scala_job: name: jdk21_2.13.x java_version: jdk21 - scala_version: 2.13.17 + scala_version: 2.13.18 - scala_job: name: jdk21_3.x java_version: jdk21 @@ -148,7 +148,7 @@ workflows: scala_version: 2.12.20 - scalajs_job: name: sjs1.0_2.13.x - scala_version: 2.13.17 + scala_version: 2.13.18 - scalajs_job: name: sjs1.0_3.x scala_version: 3.3.7 @@ -157,7 +157,7 @@ workflows: scala_version: 2.12.20 - scalanative_job: name: native0.4_2.13.x - scala_version: 2.13.17 + scala_version: 2.13.18 - scalanative_job: name: native0.4_3.x scala_version: 3.3.7 diff --git a/build.sbt b/build.sbt index f21d73846..d1fd9a4f8 100644 --- a/build.sbt +++ b/build.sbt @@ -37,7 +37,7 @@ lazy val xml = crossProject(JSPlatform, JVMPlatform, NativePlatform) .settings( name := "scala-xml", scalaModuleAutomaticModuleName := Some("scala.xml"), - crossScalaVersions := Seq("2.13.17", "2.12.20", "3.3.7"), + crossScalaVersions := Seq("2.13.18", "2.12.20", "3.3.7"), scalaVersion := "2.12.20", scalacOptions ++= (CrossVersion.partialVersion(scalaVersion.value) match { From 2deffada16038651b94fea3b3344ee80968aa026 Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Fri, 12 Dec 2025 22:34:36 +0000 Subject: [PATCH 789/789] Update scala-compiler, scala-library to 2.12.21 --- .circleci/config.yml | 12 ++++++------ build.sbt | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 984794397..8f3ac6805 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -98,7 +98,7 @@ workflows: - scala_job: name: 2.12.x java_version: jdk8 - scala_version: 2.12.20 + scala_version: 2.12.21 - scala_job: name: 2.13.x java_version: jdk8 @@ -110,7 +110,7 @@ workflows: - scala_job: name: jdk11_2.12.x java_version: jdk11 - scala_version: 2.12.20 + scala_version: 2.12.21 - scala_job: name: jdk11_2.13.x java_version: jdk11 @@ -122,7 +122,7 @@ workflows: - scala_job: name: jdk17_2.12.x java_version: jdk17 - scala_version: 2.12.20 + scala_version: 2.12.21 - scala_job: name: jdk17_2.13.x java_version: jdk17 @@ -134,7 +134,7 @@ workflows: - scala_job: name: jdk21_2.12.x java_version: jdk21 - scala_version: 2.12.20 + scala_version: 2.12.21 - scala_job: name: jdk21_2.13.x java_version: jdk21 @@ -145,7 +145,7 @@ workflows: scala_version: 3.3.7 - scalajs_job: name: sjs1.0_2.12.x - scala_version: 2.12.20 + scala_version: 2.12.21 - scalajs_job: name: sjs1.0_2.13.x scala_version: 2.13.18 @@ -154,7 +154,7 @@ workflows: scala_version: 3.3.7 - scalanative_job: name: native0.4_2.12.x - scala_version: 2.12.20 + scala_version: 2.12.21 - scalanative_job: name: native0.4_2.13.x scala_version: 2.13.18 diff --git a/build.sbt b/build.sbt index d1fd9a4f8..00b8c209a 100644 --- a/build.sbt +++ b/build.sbt @@ -37,8 +37,8 @@ lazy val xml = crossProject(JSPlatform, JVMPlatform, NativePlatform) .settings( name := "scala-xml", scalaModuleAutomaticModuleName := Some("scala.xml"), - crossScalaVersions := Seq("2.13.18", "2.12.20", "3.3.7"), - scalaVersion := "2.12.20", + crossScalaVersions := Seq("2.13.18", "2.12.21", "3.3.7"), + scalaVersion := "2.12.21", scalacOptions ++= (CrossVersion.partialVersion(scalaVersion.value) match { case Some((3, _)) =>