diff --git a/cli/src/main/resources/scalaxb.scala.template b/cli/src/main/resources/scalaxb.scala.template index d490df882..9ace62d41 100644 --- a/cli/src/main/resources/scalaxb.scala.template +++ b/cli/src/main/resources/scalaxb.scala.template @@ -16,7 +16,7 @@ object `package` { def fromXML[A](seq: NodeSeq, stack: List[ElemName] = Nil) (implicit format: XMLFormat[A]): A = format.reads(seq, stack) match { case Right(a) => a - case Left(a) => throw new ParserFailure("Error while parsing %s: %s" format(seq.toString, a)) + case Left(a) => throw new ParserFailure("Error while parsing %s: %s".format(seq.toString, a)) } @implicitNotFound(msg = "Cannot find XMLFormat type class for ${A}") @@ -880,7 +880,7 @@ object Helper { def toString(value: QName, scope: NamespaceBinding): String = Option[String](scope.getPrefix(value.getNamespaceURI)) map { - "%s:%s" format (_, value.getLocalPart)} getOrElse {value.getLocalPart} + "%s:%s".format(_, value.getLocalPart)} getOrElse {value.getLocalPart} def toCalendar(value: String): XMLGregorianCalendar = { DataTypeFactory.get().newXMLGregorianCalendar(value) @@ -959,7 +959,7 @@ object Helper { else nullOrEmpty(scope.getPrefix(namespace.orNull)) def prefixedName(namespace: Option[String], name: String, scope: scala.xml.NamespaceBinding) = - getPrefix(namespace, scope) map { """%s:%s""" format(_, name) + getPrefix(namespace, scope) map { """%s:%s""".format(_, name) } getOrElse {name} def stringToXML(obj: String, namespace: Option[String], elementLabel: Option[String], diff --git a/cli/src/main/resources/soap12.scala.template b/cli/src/main/resources/soap12.scala.template index 8d7b48f19..3bde8bb46 100644 --- a/cli/src/main/resources/soap12.scala.template +++ b/cli/src/main/resources/soap12.scala.template @@ -36,7 +36,7 @@ trait SoapClients { this: HttpClients => case x => sys.error("unexpected non-elem: " + x.toString) }} val contentType = "application/soap+xml; charset=utf-8" + - (action map {"""; action="%s"""" format(_)} getOrElse {""}) + (action map {"""; action="%s"""".format(_)} getOrElse {""}) val headers = Map[String, String]("Content-Type" -> contentType) val s = httpClient.request(r map {_.toString} getOrElse {""}, address, headers) diff --git a/cli/src/main/resources/soap12_async.scala.template b/cli/src/main/resources/soap12_async.scala.template index d77fa94d4..ed76bf2b0 100644 --- a/cli/src/main/resources/soap12_async.scala.template +++ b/cli/src/main/resources/soap12_async.scala.template @@ -41,7 +41,7 @@ trait SoapClientsAsync { case x => sys.error("unexpected non-elem: " + x.toString) }} val contentType = "application/soap+xml; charset=utf-8" + - (action map {"""; action="%s"""" format(_)} getOrElse {""}) + (action map {"""; action="%s"""".format(_)} getOrElse {""}) val headers = Map[String, String]("Content-Type" -> contentType) val ftr: Future[String] = httpClient.request(r map {_.toString} getOrElse {""}, address, headers) ftr map { s: String => diff --git a/cli/src/main/scala/scalaxb/compiler/wsdl11/GenSource.scala b/cli/src/main/scala/scalaxb/compiler/wsdl11/GenSource.scala index ddf93ac14..1fb0aca47 100644 --- a/cli/src/main/scala/scalaxb/compiler/wsdl11/GenSource.scala +++ b/cli/src/main/scala/scalaxb/compiler/wsdl11/GenSource.scala @@ -188,7 +188,7 @@ trait {interfaceTypeName} {{ } outputOpt flatMap { output: XParamType => isMultiPart(output, binding.output) map { _ => - "case class %s(%s)" format( + "case class %s(%s)".format( makeOperationOutputWrapperName(op), makeOperationOutputArgs map {_.toScalaCode} mkString(", ") ) @@ -522,8 +522,8 @@ trait {interfaceTypeName} {{ } match { case Nil => "Nil" case x :: Nil => x - case xs if config.useLists => "List.concat(%s)" format (xs.mkString("," + NL + " ")) - case xs => "Seq.concat(%s)" format (xs.mkString("," + NL + " ")) + case xs if config.useLists => "List.concat(%s)".format(xs.mkString("," + NL + " ")) + case xs => "Seq.concat(%s)".format(xs.mkString("," + NL + " ")) } // http://www.w3.org/TR/wsdl#_soap:body @@ -609,14 +609,14 @@ trait {interfaceTypeName} {{ val elem = xsdgenerator.elements(splitTypeName(elementQName)) """({ scala.xml.Elem(null, "Body", scala.xml.Null, defaultScope, true, body.toSeq: _*) - } \ "%s").head""" format (elem.name) + } \ "%s").head""".format(elem.name) case (DocumentStyle, None) => """body.head""" case (RpcStyle, Some(elementQName)) => val elem = xsdgenerator.elements(splitTypeName(elementQName)) - """(body.head \ "%s").head""" format (elem.name) + """(body.head \ "%s").head""".format(elem.name) case (RpcStyle, None) => - """(body.head \ "%s").head""" format (p.name.get) + """(body.head \ "%s").head""".format(p.name.get) } buildPartArg(p, v) + (soapBindingStyle match { case DocumentStyle => @@ -628,13 +628,13 @@ trait {interfaceTypeName} {{ }) }) ++ (headerParts map { p => val v = - if (p.element.isDefined) """({header} \ "%s").head""" format (p.element.get.getLocalPart) - else """({header} \ "%s").head""" format (p.name.get) + if (p.element.isDefined) """({header} \ "%s").head""".format(p.element.get.getLocalPart) + else """({header} \ "%s").head""".format(p.name.get) buildPartArg(p, v) }) if (!multipart) fromXmls.head - else "%s(%s)" format (xsdgenerator.buildFullyQualifiedNameFromPackage(pkg, makeOperationOutputWrapperName(op)), + else "%s(%s)".format(xsdgenerator.buildFullyQualifiedNameFromPackage(pkg, makeOperationOutputWrapperName(op)), fromXmls.mkString("," + NL + " ")) } } @@ -666,7 +666,7 @@ trait {interfaceTypeName} {{ } def baseTypeName: String = xsdgenerator.buildTypeName(typeSymbol) def toParamName = escapeKeyWord(paramName) - def toScalaCode: String = "%s: %s" format(toParamName, typeName) + def toScalaCode: String = "%s: %s".format(toParamName, typeName) def toVarg: String = if (seqParam) toParamName + ": _*" else toParamName @@ -768,12 +768,13 @@ trait {interfaceTypeName} {{ } def faultsToTypeName(faults: Seq[XFaultType], soap12: Boolean): String = - "%s[%s]" format (if (soap12) "scalaxb.Fault" - else "scalaxb.Soap11Fault", - faultsToFaultParamTypeName(faults) match { - case (x, true) => s"""Option[$x]""" - case (x, _) => x - }) + "%s[%s]".format( + if (soap12) "scalaxb.Fault" else "scalaxb.Soap11Fault", + faultsToFaultParamTypeName(faults) match { + case (x, true) => s"""Option[$x]""" + case (x, _) => x + } + ) // param type and nillable def faultParamTypeName(fault: XFaultType): (String, Boolean) = { diff --git a/cli/src/main/scala/scalaxb/compiler/xsd/ContextProcessor.scala b/cli/src/main/scala/scalaxb/compiler/xsd/ContextProcessor.scala index 483d2f0b5..ca91a794f 100644 --- a/cli/src/main/scala/scalaxb/compiler/xsd/ContextProcessor.scala +++ b/cli/src/main/scala/scalaxb/compiler/xsd/ContextProcessor.scala @@ -77,7 +77,7 @@ trait ContextProcessor extends ScalaNames with PackageName { val anonymousTypes = mutable.ListBuffer.empty[(SchemaDecl, ComplexTypeDecl)] for (schema <- schemas) { - logger.debug("processContext - " + schema.targetNamespace) + logger.debug("processContext - %s".format(schema.targetNamespace)) context.typeNames(schema) = makeProtectedTypeName(schema, context) resolveType(schema, context) } @@ -92,7 +92,7 @@ trait ContextProcessor extends ScalaNames with PackageName { if (context.typeNames.contains(decl)) registerDuplicatedType(schema, decl, decl.name) else { context.typeNames(decl) = makeProtectedTypeName(schema.targetNamespace, initialName, postfix, context) - logger.debug("processContent: enum %s is named %s" format(decl.name, context.typeNames(decl))) + logger.debug("processContent: enum %s is named %s".format(decl.name, context.typeNames(decl))) makeEnumValues(decl, schema.scope, context) } // if-else } @@ -107,7 +107,7 @@ trait ContextProcessor extends ScalaNames with PackageName { } ref.decl match { case decl: ComplexTypeDecl => anonymousTypes += ((schema, decl)) - logger.debug("processContent: %s's %s" format(elem.name, decl.name)) + logger.debug("processContent: %s's %s".format(elem.name, decl.name)) if (context.typeNames.contains(decl)) registerDuplicatedType(schema, decl, elem.name) context.typeNames.getOrElseUpdate(decl, { @@ -115,13 +115,13 @@ trait ContextProcessor extends ScalaNames with PackageName { if (decl.family != List(elem.name, elem.name) && config.prependFamilyName) Some(decl.family.head) else None val name = makeProtectedTypeName(schema.targetNamespace, prefix, elem, context) - logger.debug("processContent: %s's %s is named %s" format(elem.name, decl.name, name)) + logger.debug("processContent: %s's %s is named %s".format(elem.name, decl.name, name)) name }) // simple types are handled later. // case decl: SimpleTypeDecl if containsEnumeration(decl) => -// logger.debug("processContent: %s's %s" format(elem.name, decl.name)) +// logger.debug("processContent: %s's %s".format(elem.name, decl.name)) // nameEnumSimpleType(schema, decl, elem.name, "") case _ => } @@ -132,16 +132,16 @@ trait ContextProcessor extends ScalaNames with PackageName { typ <- schema.topTypes } typ match { case (_, decl: ComplexTypeDecl) => - logger.debug("processContext: top-level type %s" format (decl.name)) + logger.debug("processContext: top-level type %s".format(decl.name)) namedTypes += ((schema, decl)) if (context.typeNames.contains(decl)) registerDuplicatedType(schema, decl, decl.name) else { val name = makeProtectedTypeName(schema.targetNamespace, decl, context) - logger.debug("processContext: top-level type %s is named %s" format (decl.name, name)) + logger.debug("processContext: top-level type %s is named %s".format(decl.name, name)) context.typeNames.getOrElseUpdate(decl, name) } case (_, decl@SimpleTypeDecl(_, _, _, _, _)) if containsEnumeration(decl) => - logger.debug("processContext: top-level type %s" format (decl.name)) + logger.debug("processContext: top-level type %s".format(decl.name)) nameEnumSimpleType(schema, decl, decl.name) case _ => } @@ -172,14 +172,14 @@ trait ContextProcessor extends ScalaNames with PackageName { if !base.abstractValue && !context.schemas.exists(schema => context.duplicatedTypes.contains((schema, base))) ) { context.typeNames(base) = makeTraitName(base) - logger.debug("processContext: naming trait %s" format context.typeNames(base)) + logger.debug("processContext: naming trait %s".format(context.typeNames(base))) } for (schema <- schemas; group <- schema.topGroups.valuesIterator.toList) { val pair = (schema, group) context.groups += pair - logger.debug("processContext: added group " + group.name) + logger.debug("processContext: added group %s".format(group.name)) } for (schema <- schemas; @@ -187,7 +187,7 @@ trait ContextProcessor extends ScalaNames with PackageName { elem.substitutionGroup foreach { sub => if (!context.substituteGroups.contains(sub)) { context.substituteGroups += sub - logger.debug("processContext: added sub group " + sub) + logger.debug("processContext: added sub group %s".format(sub)) } } } @@ -197,7 +197,7 @@ trait ContextProcessor extends ScalaNames with PackageName { typ <- schema.typeList if !(schema.topTypes.valuesIterator contains typ) } typ match { case decl: SimpleTypeDecl if containsEnumeration(decl) => - logger.debug("processContext: inner simple type %s" format (decl.name)) + logger.debug("processContext: inner simple type %s".format(decl.name)) nameEnumSimpleType(schema, decl, decl.family.last) case _ => } @@ -509,7 +509,7 @@ trait ContextProcessor extends ScalaNames with PackageName { def makeProtectedTypeName(namespace: Option[String], prefix: Option[String], elem: ElemDecl, context: XsdContext): String = makeProtectedTypeName(elem.namespace orElse namespace, - prefix map { "%s%s" format (_, elem.name.capitalize) } getOrElse {elem.name}, "", context) + prefix map { "%s%s".format(_, elem.name.capitalize) } getOrElse {elem.name}, "", context) def makeProtectedTypeName(namespace: Option[String], decl: ComplexTypeDecl, context: XsdContext): String = makeProtectedTypeName(decl.namespace orElse namespace, decl.name, "Type", context) diff --git a/cli/src/main/scala/scalaxb/compiler/xsd/Decl.scala b/cli/src/main/scala/scalaxb/compiler/xsd/Decl.scala index fcccd076a..66675e4a8 100644 --- a/cli/src/main/scala/scalaxb/compiler/xsd/Decl.scala +++ b/cli/src/main/scala/scalaxb/compiler/xsd/Decl.scala @@ -420,7 +420,7 @@ object ElemDecl { } getOrElse { for (child <- node.child) child match { case { _* } => - val decl = ComplexTypeDecl.fromXML(child, "@%s" format (family :+ name).mkString("/"), family :+ name, config) + val decl = ComplexTypeDecl.fromXML(child, "@%s".format((family :+ name).mkString("/")), family :+ name, config) config.typeList += decl val symbol = ReferenceTypeSymbol(config.targetNamespace, decl.name) symbol.decl = decl diff --git a/cli/src/main/scala/scalaxb/compiler/xsd/Parsers.scala b/cli/src/main/scala/scalaxb/compiler/xsd/Parsers.scala index ca28041e4..6b8bd2ded 100644 --- a/cli/src/main/scala/scalaxb/compiler/xsd/Parsers.scala +++ b/cli/src/main/scala/scalaxb/compiler/xsd/Parsers.scala @@ -53,13 +53,15 @@ trait Parsers extends Args with Params { if (laxAny) "_ => true" else namespaceConstraint match { case ("##any" :: Nil) | Nil | ("" :: Nil) => "_ => true" - case "##other" :: Nil => "_.namespace != %s" format (quoteNamespace(schema.targetNamespace)) + case "##other" :: Nil => "_.namespace != %s".format(quoteNamespace(schema.targetNamespace)) case _ => - """x => %s contains x.namespace""" format (namespaceConstraint.map { - case "##targetNamespace" => quoteNamespace(schema.targetNamespace) - case "##local" => "None" - case x => quoteNamespace(Some(x)) - }).mkString("List(", ", ", ")") + """x => %s contains x.namespace""".format( + namespaceConstraint.map { + case "##targetNamespace" => quoteNamespace(schema.targetNamespace) + case "##local" => "None" + case x => quoteNamespace(Some(x)) + }.mkString("List(", ", ", ")") + ) }) buildParserString(if (mixed) "((" + parser + " ^^ (" + converter + ")) " + follow + newline + diff --git a/cli/src/main/scala/scalaxb/compiler/xsd/XMLOutput.scala b/cli/src/main/scala/scalaxb/compiler/xsd/XMLOutput.scala index 66261026d..bff2f515c 100644 --- a/cli/src/main/scala/scalaxb/compiler/xsd/XMLOutput.scala +++ b/cli/src/main/scala/scalaxb/compiler/xsd/XMLOutput.scala @@ -114,7 +114,7 @@ trait XMLOutput extends Args { def buildToString(selector: String, typeSymbol: XsTypeSymbol): String = typeSymbol match { case symbol: BuiltInSimpleTypeSymbol => buildTypeName(symbol) match { - case "javax.xml.namespace.QName" => "scalaxb.Helper.toString(%s, __scope)" format selector + case "javax.xml.namespace.QName" => "scalaxb.Helper.toString(%s, __scope)".format(selector) case "BigDecimal" => selector + ".bigDecimal.toPlainString" case _ => selector + ".toString" } diff --git a/cli/src/main/scala/scalaxb/compiler/xsd/XsTypeSymbol.scala b/cli/src/main/scala/scalaxb/compiler/xsd/XsTypeSymbol.scala index cbb2e6af0..9c7e511b2 100644 --- a/cli/src/main/scala/scalaxb/compiler/xsd/XsTypeSymbol.scala +++ b/cli/src/main/scala/scalaxb/compiler/xsd/XsTypeSymbol.scala @@ -75,7 +75,7 @@ object ReferenceTypeSymbol { class ReferenceTypeSymbol(val qname: QName) extends XsTypeSymbol { val namespace = masked.scalaxb.Helper.nullOrEmpty(qname.getNamespaceURI) val localPart = qname.getLocalPart - val name: String = (namespace map {"{%s}" format _} getOrElse("")) + localPart + val name: String = (namespace map {"{%s}".format(_)} getOrElse("")) + localPart var decl: TypeDecl = null override def toString(): String = { diff --git a/cli/src_managed/scalaxb/scalaxb.scala b/cli/src_managed/scalaxb/scalaxb.scala index 07d891ffd..631bde819 100644 --- a/cli/src_managed/scalaxb/scalaxb.scala +++ b/cli/src_managed/scalaxb/scalaxb.scala @@ -18,7 +18,7 @@ object `package` { def fromXML[A](seq: NodeSeq, stack: List[ElemName] = Nil) (implicit format: XMLFormat[A]): A = format.reads(seq, stack) match { case Right(a) => a - case Left(a) => throw new ParserFailure("Error while parsing %s: %s" format(seq.toString, a)) + case Left(a) => throw new ParserFailure("Error while parsing %s: %s".format(seq.toString, a)) } @implicitNotFound(msg = "Cannot find XMLFormat type class for ${A}") @@ -810,7 +810,7 @@ object Helper { def toString(value: QName, scope: NamespaceBinding): String = Option[String](scope.getPrefix(value.getNamespaceURI)) map { - "%s:%s" format (_, value.getLocalPart)} getOrElse {value.getLocalPart} + "%s:%s".format(_, value.getLocalPart)} getOrElse {value.getLocalPart} def toCalendar(value: String): XMLGregorianCalendar = { DataTypeFactory.get().newXMLGregorianCalendar(value) @@ -889,7 +889,7 @@ object Helper { else nullOrEmpty(scope.getPrefix(namespace.orNull)) def prefixedName(namespace: Option[String], name: String, scope: scala.xml.NamespaceBinding) = - getPrefix(namespace, scope) map { """%s:%s""" format(_, name) + getPrefix(namespace, scope) map { """%s:%s""".format(_, name) } getOrElse {name} def stringToXML(obj: String, namespace: Option[String], elementLabel: Option[String], diff --git a/integration/src/test/scala-2.13-/CompilerMatcher.scala b/integration/src/test/scala-2.13-/CompilerMatcher.scala index 0fd532207..594bdf1ab 100644 --- a/integration/src/test/scala-2.13-/CompilerMatcher.scala +++ b/integration/src/test/scala-2.13-/CompilerMatcher.scala @@ -99,7 +99,7 @@ trait CompilerMatcher { sys.error(s"""Error compiling: ${ files.mkString(",") }""") } code foreach { c => main.interpret(c) match { - case IR.Error => sys.error("Error interpreting %s" format (c)) + case IR.Error => sys.error("Error interpreting %s".format(c)) case _ => }} val holder0 = allCatch opt { diff --git a/project/dependencies.scala b/project/dependencies.scala index 6b94d6418..c0ce357d1 100644 --- a/project/dependencies.scala +++ b/project/dependencies.scala @@ -1,8 +1,8 @@ import sbt._ object Dependencies { - val scala213 = "2.13.1" - val scala212 = "2.12.10" + val scala213 = "2.13.3" + val scala212 = "2.12.11" val scala211 = "2.11.12" val scala210 = "2.10.7"