Skip to content

Fix #51 (replaces #61) #64

New issue

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

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

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jul 24, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ language: scala

env:
global:
- PUBLISH_JDK=openjdk6
# PGP_PASSPHRASE
- secure: "BYC1kEnHjNrINrHYWPGEuTTJ2V340/0ByzqeihLecjoZ75yrjWdsh6MI1JEUWgv5kb+58vLzib21JfnjsPK6Yb2bSXuCFCsEtJNh6RJKgxkWlCOzfTSh5I2wl7PCjRClRL6gseX2uTSvFjL4Z//pmxwxeXlLp7voQe4QAUq1+sE="
# SONA_USER
Expand All @@ -14,7 +13,7 @@ script: admin/build.sh

jdk:
- openjdk6
- openjdk7
- oraclejdk8

notifications:
email: [email protected]
5 changes: 2 additions & 3 deletions admin/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -30,7 +31,6 @@ form:
language: scala
env:
global:
- PUBLISH_JDK=openjdk6
# PGP_PASSPHRASE
- secure: "XXXXXX"
# SONA_USER
Expand Down Expand Up @@ -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.

2 changes: 1 addition & 1 deletion admin/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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'"'
Expand Down
15 changes: 14 additions & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,20 @@ version := "1.0.5-SNAPSHOT"

scalaVersion := crossScalaVersions.value.head

crossScalaVersions := Seq("2.11.6", "2.12.0-M1")
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"

// important!! must come here (why?)
scalaModuleOsgiSettings
Expand Down
23 changes: 17 additions & 6 deletions src/main/scala/scala/xml/dtd/ContentModel.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down Expand Up @@ -72,14 +82,15 @@ object ContentModel extends WordExp {
case Letter(ElemName(name)) =>
sb.append(name)
}

}

sealed abstract class ContentModel {
override def toString(): String = sbToString(buildString)
def buildString(sb: StringBuilder): StringBuilder
}

import ContentModel.RegExp

case object PCDATA extends ContentModel {
override def buildString(sb: StringBuilder): StringBuilder = sb.append("(#PCDATA)")
}
Expand All @@ -91,16 +102,16 @@ 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)
new SubsetConstruction(nfa).determinize
}
}

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: _*) }
Expand All @@ -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)
}
1 change: 1 addition & 0 deletions src/main/scala/scala/xml/dtd/impl/WordBerrySethi.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion src/main/scala/scala/xml/pull/XMLEventReader.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions src/test/scala/scala/xml/ShouldCompile.scala
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ class Foo {
}

// t2281
class A {
class t2281A {
def f(x: Boolean) = if (x) <br/><br/> else <br/>
}

class B {
class t2281B {
def splitSentences(text: String): ArrayBuffer[String] = {
val outarr = new ArrayBuffer[String]
var outstr = new StringBuffer
Expand Down Expand Up @@ -92,4 +92,4 @@ object shouldCompile {
case 1 => <xml:group></xml:group>
case 2 => <p></p>
}
}
}
2 changes: 2 additions & 0 deletions src/test/scala/scala/xml/XMLTest.scala
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package scala.xml

import language.postfixOps

import org.junit.{Test => UnitTest}
import org.junit.Ignore
import org.junit.runner.RunWith
Expand Down