Open mmc41 opened 11 years ago
Thanks for the feedback. The problem with writing code generator like scalaxb is that I need to target the oldest Scala version that would be useful to provide. For the current scalaxb, that's Scala 2.9.x.
I didn't check all the warning above, but the most look like SIP-18 warnings and deprecation on Elem.apply
, both something new to 2.10. You should be able to suppress SIP-18 by using -language:_
flag.
To avoid this, I would need to release a new version of scalaxb that targets 2.10, or introduce an option so it could generate either.
Thanks for looking at my issue and for explaining. If I try to supress the warnings as you suggested I only get 5 warnings and besides I am not so happy with supressing warnings as it impacts other files as well where I need to observe if any warnings occur. I hope that you will support 2.10 (with no warnings) in the future as I can't move my current java code to scala until then. Anyway, thanks for a great promising project with apart from this issue looks very good. Look forward to revisit it again at a later time.
+1 for an option that enables different code generation for 2.10+
+1 for an option that enables different code generation for 2.10+. (Other than that, I've had no issues so far and found it very useful indeed.)
scalaxb 1.2.0 dropped support for Scala 2.9 and I think I now use Elem constructor for 2.10. I probably should check what else warnings show up.
FYI, I am using scalaxb 1.2.1 and I get the following warnings below in scalaxb.scala. Perhaps they could be addressed if you include the following imports:
import scala.language.postfixOps
import scala.language.implicitConversions
import scala.language.existentials
I put these into scalaxb.scala by hand and it did the trick for me. (Of course that's not really a solution but shows what needs to be done). Thanks for scalaxb. This is a minor thing but hopefully easy to address.
Warning:(219, 37) postfix operator orNull should be enabled
by making the implicit value scala.language.postfixOps visible.
This can be achieved by adding the import clause 'import scala.language.postfixOps'
or by setting the compiler option -language:postfixOps.
See the Scala docs for value scala.language.postfixOps for a discussion
why the feature should be explicitly enabled.
Right(new QName(namespace orNull, localPart))
^
Warning:(853, 62) postfix operator != should be enabled
by making the implicit value scala.language.postfixOps visible.
def splitBySpace(text: String) = text.split(' ').filter("" !=)
^
Warning:(371, 22) inferred existential type Option[(Option[String], Option[String], Option[String], Option[String], A, scalaxb.CanWriteXML[_$1])] forSome { type _$1 }, which cannot be expressed by wildcards, should be enabled
by making the implicit value scala.language.existentials visible.
This can be achieved by adding the import clause 'import scala.language.existentials'
or by setting the compiler option -language:existentials.
See the Scala docs for value scala.language.existentials for a discussion
why the feature should be explicitly enabled.
private case class DataWriter[+A](
^
Warning:(599, 16) implicit conversion method apply should be enabled
by making the implicit value scala.language.implicitConversions visible.
This can be achieved by adding the import clause 'import scala.language.implicitConversions'
or by setting the compiler option -language:implicitConversions.
See the Scala docs for value scala.language.implicitConversions for a discussion
why the feature should be explicitly enabled.
implicit def apply(node: scala.xml.Node): ElemName = node match {
^
Warning:(610, 16) implicit conversion method toNodeSeq should be enabled
by making the implicit value scala.language.implicitConversions visible.
implicit def toNodeSeq(elem: ElemName): scala.xml.NodeSeq = elem.node
^
Warning:(619, 16) implicit conversion method toNodeSeq should be enabled
by making the implicit value scala.language.implicitConversions visible.
implicit def toNodeSeq(elem: Elem): scala.xml.NodeSeq = elem.node
^
In one of the wsdl files I'm parsing I'm getting a ton of Option.headOption is not recommended
warnings... which makes sense as it's redundant. I can't really share the wsdl as it's private unfortunately. If you need me to dig into this a bit more to find out why it's doing this I can but it might be tricky for me.
Calls to headOption
are likely generated by Args.scala - https://github.com/eed3si9n/scalaxb/blob/1c6f4fbc6e551ffdb25cb26686430eb34f06e7d7/cli/src/main/scala/scalaxb/compiler/xsd/Args.scala#L55-L103
Also seeing a few "Using toString on something that is already of type String"
I got lots of warnings when compiling generated code from an XSD file using mavens scalaxb pluging (btw: nice plugin!) and latest scala version. For people (like me) that leans towards a no-warning policy this makes use of scalaxb problematic: