Strange indeed
Anyway, while I don't believe that's your issue I just wanted to point out
that the code below proves nothing:
> Log.error("classloaders: " + other.getClass.getClassLoader.
eq(None.getClass.getClassLoader)) // true
. . . since it will always be 'true'
I believe your were trying to see if matching key's class was loaded by the
same class loader as matcher class, so you have to compare the ClassLoader
of the actual type of the key vs None, other etc.
For example:
val v1 = new Foo
val v2 = new URLClassLoader(Array[URL](new URL("file:///foo/bar/foo.jar")),
null).loadClass("Foo").newInstance();
val map = Map(v1 -> "", v2 -> "");
map.keys.foreach{
key => println(key.getClass.getClassLoader())
}
Cheers
Oleg
On Wed, Feb 12, 2014 at 9:40 PM, √iktor Ҡlang <[email protected]>wrote:
> I'd start by doing a clean build.
>
>
> On Thu, Feb 13, 2014 at 1:43 AM, Guillaume Simard <[email protected]>wrote:
>
>> Hello,
>>
>> For some reason, the code below will make it to "case other" when the
>> map.get(key) returns None. In other words, "case None" will not match the
>> "None" returned by map.get(key).
>>
>> I did not redefine "None" anywhere.
>>
>> map.get(key) match {
>> case Some(ent) =>
>> ent.update()
>> case None =>
>> Log.error("None")
>> case other =>
>> Log.error("other: " + other)
>> }
>>
>>
>> The above code runs within an Actor (i.e.: multithreading) and it's quite
>> likely the thread that populates the map is not the one reading it later.
>> I'm only ever accessing the map from within this Actor, however.
>>
>> I have ran the following code within "case other":
>>
>> Log.error("classloaders: " +
>> other.getClass.getClassLoader.eq(None.getClass.getClassLoader)) // true
>>
>> Log.error("class: " + (other.getClass() == None.getClass())) // true
>> Log.error("hash: " + (other.hashCode == None.hashCode())) // true
>> Log.error("system hash: " + (System.identityHashCode(other) ==
>> System.identityHashCode(None))) // false
>>
>> Log.error("test 1: " + (None == other)) // false
>> Log.error("test 2: " + (None.eq(other))) // false
>> Log.error("test 3: " + (None.equals(other))) // false
>>
>> The file path from which scala.None$ is loaded is the same for "other"
>> and "None".
>>
>> I'm running out of ideas here, what can I do next to troubleshoot and
>> find the root cause ?
>>
>> Regards,
>>
>> --
>> >>>>>>>>>> Read the docs: http://akka.io/docs/
>> >>>>>>>>>> Check the FAQ: http://akka.io/faq/
>> >>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user
>> ---
>> You received this message because you are subscribed to the Google Groups
>> "Akka User List" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected].
>> To post to this group, send email to [email protected].
>> Visit this group at http://groups.google.com/group/akka-user.
>>
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>
>
>
> --
> Cheers,
> √
>
> * ——————— **Viktor Klang*
> *Chief Architect - **Typesafe <http://www.typesafe.com/>*
>
> Twitter: @viktorklang
>
> --
> >>>>>>>>>> Read the docs: http://akka.io/docs/
> >>>>>>>>>> Check the FAQ: http://akka.io/faq/
> >>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user
> ---
> You received this message because you are subscribed to the Google Groups
> "Akka User List" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/akka-user.
> For more options, visit https://groups.google.com/groups/opt_out.
>
--
>>>>>>>>>> Read the docs: http://akka.io/docs/
>>>>>>>>>> Check the FAQ: http://akka.io/faq/
>>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user
---
You received this message because you are subscribed to the Google Groups "Akka
User List" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/groups/opt_out.