Eliminate some compiler warnings in generated code #321

merged 5 commits into from May 6, 2015


None yet

2 participants

liff commented May 6, 2015

Eliminates the following compiler warnings in the generated scalaxb.scala:

Adapted arguments
[warn] ... scalaxb.scala:566: Adapting argument list by creating a 3-tuple: this may not be what you want.
[warn]         signature: Some.apply[A](x: A): Some[A]
[warn]   given arguments: record.namespace, record.key, record.value
[warn]  after adaptation: Some((record.namespace, record.key, record.value): (Option[String], Option[String], A))
[warn]     Some(record.namespace, record.key, record.value)
Shadowed and unused type parameters
[warn] scalaxb.scala:710: type parameter A defined in method parse shadows type A defined in trait ElemNameParser. You may want to rename your type parameter, or possibly remove it.
[warn]   def parse[A](p: Parser[A], in: Seq[scala.xml.Node]): ParseResult[A] =
Postfix operators
[warn] scalaxb.scala:219: postfix operator orNull should be enabled
[warn] by making the implicit value scala.language.postfixOps visible.
[warn] This can be achieved by adding the import clause 'import scala.language.postfixOps'
[warn] or by setting the compiler option -language:postfixOps.
[warn] See the Scala docs for value scala.language.postfixOps for a discussion
[warn] why the feature should be explicitly enabled.
[warn]           Right(new QName(namespace orNull, localPart))
View bounds
[warn] scalaxb.scala:635: View bounds are deprecated. Use an implicit parameter instead.
[warn] Example: Instead of `def f[A <% Int](a: A)` use `def f[A](a: A)(implicit ev: A => Int)`.
[warn]   implicit class ParserExt[+T, P <% Parser[T]](current: P) {
Olli Helenius added some commits May 6, 2015
Olli Helenius Use an explicit tuple instead of adapted arguments.
Allows compilation with -Yno-adapted-args.
Olli Helenius Remove uses of postfix operators 47db26e
Olli Helenius Remove unused type parameters from unapplySeq methods 671bce7
Olli Helenius Get rid of shadowed type parameter warnings 7867c54
Olli Helenius Remove use of view bound
Use an implicit parameter instead as per scalac's recommendation.
eed3si9n commented May 6, 2015

Awesome! Thanks for this.

@eed3si9n eed3si9n merged commit 0f695b6 into eed3si9n:master May 6, 2015
@eed3si9n eed3si9n added a commit that referenced this pull request Jul 20, 2015
@eed3si9n Workaround for Scala 2.10.x. Ref #321 c04a30d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment