where does this name come from?

51 views
Skip to first unread message

Roland Kuhn

unread,
May 21, 2013, 9:32:15 AM5/21/13
to scala-i...@googlegroups.com
Welcome to Scala version 2.11.0-M3 (Java HotSpot(TM) 64-Bit Server VM, Java 1.6.0_45).
Type in expressions to have them evaluated.
Type :help for more information.

scala> trait X extends scala.concurrent.ExecutionContext { val name = "" }
<console>:7: error: overriding value name in trait ExecutionContext of type String;
 value name needs `override' modifier
       trait X extends scala.concurrent.ExecutionContext { val name = "" }
                                                               ^

scala> trait X extends scala.concurrent.ExecutionContext { val namen = "" }
defined trait X

For those of you who wonder why this is relevant, here is javap listing for interface ExecutionContext:

public interface scala.concurrent.ExecutionContext{
    public abstract void execute(java.lang.Runnable);
    public abstract void reportFailure(java.lang.Throwable);
    public abstract scala.concurrent.ExecutionContext prepare();
}

No “name” field anywhere. I guess it comes from this part of the source:

  def reportFailure(@deprecatedName('t) cause: Throwable): Unit

I assume that I shall file a ticket?

Regards,


Dr. Roland Kuhn
Akka Tech Lead
Typesafe – Empowering professional developers to build amazing apps.
twitter: @rolandkuhn

See you at Scala Days 2013 in NYC!
June 10th - June 12th
www.scaladays.org

Johannes Rudolph

unread,
May 21, 2013, 9:58:51 AM5/21/13
to scala-i...@googlegroups.com
On Tue, May 21, 2013 at 3:32 PM, Roland Kuhn <goo...@rkuhn.info> wrote:
No “name” field anywhere. I guess it comes from this part of the source:

  def reportFailure(@deprecatedName('t) cause: Throwable): Unit

It seems so, without the annotation it succeeds. What else is needed? 
a) separate compilation
b) It is related to the `Symbol`-type. You have to use a Symbol-constructor in the annotation argument expression to trigger the bug. E.g. this compiles:

class strangeTest(x: Symbol) extends scala.annotation.StaticAnnotation

object X {
  val T = 't
}

trait A {
  @strangeTest(X.T) def test(x: String): Unit
}

// compile separately
// trait B extends A { val test = 12 }


--
Johannes

-----------------------------------------------
Johannes Rudolph
http://virtual-void.net

Jason Zaugg

unread,
May 21, 2013, 10:27:12 AM5/21/13
to scala-i...@googlegroups.com
On Tue, May 21, 2013 at 3:58 PM, Johannes Rudolph <johannes...@googlemail.com> wrote:
On Tue, May 21, 2013 at 3:32 PM, Roland Kuhn <goo...@rkuhn.info> wrote:
No “name” field anywhere. I guess it comes from this part of the source:

  def reportFailure(@deprecatedName('t) cause: Throwable): Unit

It seems so, without the annotation it succeeds. What else is needed? 
a) separate compilation
b) It is related to the `Symbol`-type. You have to use a Symbol-constructor in the annotation argument expression to trigger the bug. E.g. this compiles:

class strangeTest(x: Symbol) extends scala.annotation.StaticAnnotation

object X {
  val T = 't
}

trait A {
  @strangeTest(X.T) def test(x: String): Unit
}

// compile separately
// trait B extends A { val test = 12 }

Great minimization. Looks like a pickler/unpickler bug.

Looks like the name "name" comes from:

  final class Symbol private (val name: String)

-jason

Jason Zaugg

unread,
May 21, 2013, 10:50:07 AM5/21/13
to scala-i...@googlegroups.com
On Tue, May 21, 2013 at 3:32 PM, Roland Kuhn <goo...@rkuhn.info> wrote:

I assume that I shall file a ticket?


-jason 

Roland Kuhn

unread,
May 21, 2013, 11:30:34 AM5/21/13
to scala-i...@googlegroups.com
Thanks!

--
You received this message because you are subscribed to the Google Groups "scala-internals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scala-interna...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 
Reply all
Reply to author
Forward
0 new messages