is it a bug?

View: New views
2 Messages — Rating Filter:   Alert me  

is it a bug?

by Vlad Patryshev :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

scala> def a[X] = new { def f(x:X) = Set(x)}
a: [X]java.lang.Object{def f(X): scala.collection.immutable.Set[X]}

scala> a.f("abc")
res10: scala.collection.immutable.Set[java.lang.String] = Set(abc)

scala> a[String].f("abc")
java.lang.NoSuchMethodException: $anon$1.f(java.lang.String)
        at java.lang.Class.getMethod(Class.java:1605)
        at .reflMethod$Method1(<console>:6)
        at .<init>(<console>:6)
        at .<clinit>(<console>)
        at RequestResult$.<init>(<console>:3)
        at RequestResult$.<clinit>(<console>)
        at RequestResult$result(<console>)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflec...
scala>


--
Thanks,
-Vlad

Re: is it a bug?

by Daniel Sobral :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Looks like one to me. I suggest you open a ticket. The worst that can happen is that it gets closed with an explanation of why it is not a bug.

On Sun, Jul 5, 2009 at 2:37 PM, Vlad Patryshev <vpatryshev@...> wrote:
scala> def a[X] = new { def f(x:X) = Set(x)}
a: [X]java.lang.Object{def f(X): scala.collection.immutable.Set[X]}

scala> a.f("abc")
res10: scala.collection.immutable.Set[java.lang.String] = Set(abc)

scala> a[String].f("abc")
java.lang.NoSuchMethodException: $anon$1.f(java.lang.String)
        at java.lang.Class.getMethod(Class.java:1605)
        at .reflMethod$Method1(<console>:6)
        at .<init>(<console>:6)
        at .<clinit>(<console>)
        at RequestResult$.<init>(<console>:3)
        at RequestResult$.<clinit>(<console>)
        at RequestResult$result(<console>)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflec...
scala>


--
Thanks,
-Vlad



--
Daniel C. Sobral

Something I learned in academia: there are three kinds of academic reviews: review by name, review by reference and review by value.