Conflict scala.array and java.sql.Array

1,135 views
Skip to first unread message

Cecil Westerhof

unread,
Jan 29, 2013, 5:01:29 PM1/29/13
to scala...@googlegroups.com
For your main you have normally:
def main(args: Array[String]) = {

But in my imports I have:
import java.sql._

Then I get:
error: java.sql.Array does not take type parameters
def main(args: Array[String]) = {
^

I can solve this by using:
def main(args: scala.Array[String]) = {

I also use:
new scala.Array[String](fieldTypes.length)

Is there a better way to do this?

--
Cecil Westerhof

Cecil Westerhof

unread,
Jan 29, 2013, 5:11:31 PM1/29/13
to scala...@googlegroups.com
2013/1/29 Cecil Westerhof <cldwes...@gmail.com>:
After asking, I got an idea. When my last import is:
import scala.Array

I can use Array instead of scala.Array.

Sorry for the noise.

--
Cecil Westerhof

Roland Kuhn

unread,
Jan 29, 2013, 5:13:42 PM1/29/13
to Cecil Westerhof, scala...@googlegroups.com
Hi Cecil,

you can also

import java.sql.{Array => SqlArray, _}


Regards,

Dr. Roland Kuhn
Akka Tech Lead
Typesafe – The software stack for applications that scale.
twitter: @rolandkuhn
--
You received this message because you are subscribed to the Google Groups "scala-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scala-user+...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Lanny Ripple

unread,
Jan 30, 2013, 3:56:33 PM1/30/13
to scala...@googlegroups.com
Another solution is to not pull in the symbols but name them with the package as prefix.

    import java.sql

    def main(args: Array[String]) {
      val arr = new sql.Array(3)
      ...
Reply all
Reply to author
Forward
0 new messages