This page is no longer maintained — Please continue to the home page at www.scala-lang.org

suddenly

6 replies
vpatryshev
Joined: 2009-02-16,
User offline. Last seen 1 year 24 weeks ago.
We use 2.8

Now, in a piece of code that was not touched, the compiler says this:

Connection.scala:27: error: object Array is not a value
[INFO]       val child = new URLClassLoader(Array[URL](new File(path).toURI.toURL),getClass.getClassLoader)





I do not understand it, and I do not see an error either...




Thanks,
-Vlad
Jason Zaugg
Joined: 2009-05-18,
User offline. Last seen 38 weeks 5 days ago.
Re: suddenly
Sounds like you've introduced an import that binds the identifier to `Array` to a Java class, rather than `scala.Array`.
scala> String(1)<console>:8: error: object String is not a value               String(1)              ^
-jason
On Sat, Jan 14, 2012 at 12:02 AM, Vlad Patryshev <vpatryshev [at] gmail [dot] com> wrote:
We use 2.8

Now, in a piece of code that was not touched, the compiler says this:

Connection.scala:27: error: object Array is not a value
[INFO]       val child = new URLClassLoader(Array[URL](new File(path).toURI.toURL),getClass.getClassLoader)





I do not understand it, and I do not see an error either...




Thanks,
-Vlad

vpatryshev
Joined: 2009-02-16,
User offline. Last seen 1 year 24 weeks ago.
Re: suddenly
Thank you; seems like this is the case. Was fixed by using List(...).toArray.

Still, probably makes sense to file a bug; the message is pretty confusing.

Thanks,
-Vlad


On Fri, Jan 13, 2012 at 3:14 PM, Jason Zaugg <jzaugg [at] gmail [dot] com> wrote:
Sounds like you've introduced an import that binds the identifier to `Array` to a Java class, rather than `scala.Array`.
scala> String(1)<console>:8: error: object String is not a value               String(1)              ^
-jason
On Sat, Jan 14, 2012 at 12:02 AM, Vlad Patryshev <vpatryshev [at] gmail [dot] com> wrote:
We use 2.8

Now, in a piece of code that was not touched, the compiler says this:

Connection.scala:27: error: object Array is not a value
[INFO]       val child = new URLClassLoader(Array[URL](new File(path).toURI.toURL),getClass.getClassLoader)





I do not understand it, and I do not see an error either...




Thanks,
-Vlad


vpatryshev
Joined: 2009-02-16,
User offline. Last seen 1 year 24 weeks ago.
Re: suddenly
So, what happened.

First, we did not have an import of a class Array. But we had
import java.sql.{Connection,Driver... } - in total more than five classes listed.

So IntelliJ's scala plugin replaced it with java.sql._

and java.sql package has a class called Array.

=> Evil!

Thanks,
-Vlad


On Fri, Jan 13, 2012 at 3:21 PM, Vlad Patryshev <vpatryshev [at] gmail [dot] com> wrote:
Thank you; seems like this is the case. Was fixed by using List(...).toArray.

Still, probably makes sense to file a bug; the message is pretty confusing.

Thanks,
-Vlad


On Fri, Jan 13, 2012 at 3:14 PM, Jason Zaugg <jzaugg [at] gmail [dot] com> wrote:
Sounds like you've introduced an import that binds the identifier to `Array` to a Java class, rather than `scala.Array`.
scala> String(1)<console>:8: error: object String is not a value               String(1)              ^
-jason
On Sat, Jan 14, 2012 at 12:02 AM, Vlad Patryshev <vpatryshev [at] gmail [dot] com> wrote:
We use 2.8

Now, in a piece of code that was not touched, the compiler says this:

Connection.scala:27: error: object Array is not a value
[INFO]       val child = new URLClassLoader(Array[URL](new File(path).toURI.toURL),getClass.getClassLoader)





I do not understand it, and I do not see an error either...




Thanks,
-Vlad



Jason Zaugg
Joined: 2009-05-18,
User offline. Last seen 38 weeks 5 days ago.
Re: suddenly
On Sat, Jan 14, 2012 at 12:26 AM, Vlad Patryshev <vpatryshev [at] gmail [dot] com> wrote:
So, what happened.

First, we did not have an import of a class Array. But we had
import java.sql.{Connection,Driver... } - in total more than five classes listed.

So IntelliJ's scala plugin replaced it with java.sql._

and java.sql package has a class called Array.

=> Evil!

I've lodged a bug: http://youtrack.jetbrains.net/issues/SCL?q=import+scala#
In the meantime, you could set the threshold for switching to wildcard imports to a large number.
-jason 
Chris Marshall
Joined: 2009-06-17,
User offline. Last seen 44 weeks 3 days ago.
RE: suddenly
It would be cool if scalac "knew" about certain Scala classes, like Map/Iterable/Array/Set etc etc and decided to fully-qualify such error messages that are involved in name clashes:
    "java.sql.Array is not a value"
I'll bet all of us have been puzzled many a time by similar wtf? errors
Chris

From: jzaugg [at] gmail [dot] com
Date: Sat, 14 Jan 2012 00:32:23 +0100
Subject: Re: [scala-user] suddenly
To: vpatryshev [at] gmail [dot] com
CC: scala-user [at] googlegroups [dot] com

On Sat, Jan 14, 2012 at 12:26 AM, Vlad Patryshev <vpatryshev [at] gmail [dot] com> wrote:
So, what happened.

First, we did not have an import of a class Array. But we had
import java.sql.{Connection,Driver... } - in total more than five classes listed.

So IntelliJ's scala plugin replaced it with java.sql._

and java.sql package has a class called Array.

=> Evil!

I've lodged a bug: http://youtrack.jetbrains.net/issues/SCL?q=import+scala#
In the meantime, you could set the threshold for switching to wildcard imports to a large number.
-jason 
Naftoli Gugenheim
Joined: 2008-12-17,
User offline. Last seen 42 years 45 weeks ago.
Re: suddenly
Instead of going by special classes, the rule could be "any identifier that was shadowed by an import etc." should have its FQN in error messages.

On Sat, Jan 14, 2012 at 11:21 AM, Chris Marshall <oxbow_lakes [at] hotmail [dot] com> wrote:
It would be cool if scalac "knew" about certain Scala classes, like Map/Iterable/Array/Set etc etc and decided to fully-qualify such error messages that are involved in name clashes:
    "java.sql.Array is not a value"
I'll bet all of us have been puzzled many a time by similar wtf? errors
Chris

From: jzaugg [at] gmail [dot] com
Date: Sat, 14 Jan 2012 00:32:23 +0100
Subject: Re: [scala-user] suddenly
To: vpatryshev [at] gmail [dot] com
CC: scala-user [at] googlegroups [dot] com

On Sat, Jan 14, 2012 at 12:26 AM, Vlad Patryshev <vpatryshev [at] gmail [dot] com> wrote:
So, what happened.

First, we did not have an import of a class Array. But we had
import java.sql.{Connection,Driver... } - in total more than five classes listed.

So IntelliJ's scala plugin replaced it with java.sql._

and java.sql package has a class called Array.

=> Evil!

I've lodged a bug: http://youtrack.jetbrains.net/issues/SCL?q=import+scala#
In the meantime, you could set the threshold for switching to wildcard imports to a large number.
-jason 

Copyright © 2012 École Polytechnique Fédérale de Lausanne (EPFL), Lausanne, Switzerland