Scala Programming Language
  1. Scala Programming Language
  2. SI-4567

Classes defined in REPL have no ScalaSig annotation

    Details

    • Type: Improvement Improvement
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: Repl / Interpreter
    • Labels:
    • Environment:

      ScalaSig pickled Scala signature

      Description

      Classes defined in the REPL are missing ScalaSig annotation.

      === What steps will reproduce the problem? ===

      In 2.8.1 REPL:

          Welcome to Scala version 2.8.1.final (Java HotSpot(TM) 64-Bit
      Server VM, Java 1.6.0_24).
      
          scala> case class Foo(x: String)
          defined class Foo
      
          scala> val clazz = classOf[Foo]
          clazz: java.lang.Class[Foo] = class Foo
      
          scala> clazz.getAnnotations
          res1: Array[java.lang.annotation.Annotation] = Array() 
      

      In 2.9.0.RC4 REPL:

          Welcome to Scala version 2.9.0.RC4 (Java HotSpot(TM) 64-Bit Server
      VM, Java 1.6.0_24).
      
          scala> case class Foo(x: String)
          defined class Foo
      
          scala> val clazz = classOf[Foo]
          clazz: java.lang.Class[Foo] = class Foo
      
          scala> clazz.getAnnotations
          res0: Array[java.lang.annotation.Annotation] = Array() 
      

      === What is the expected behavior? ===
      Compare with this example, running sbt console in the Salat project
      looking at one of the Salat test model classes, which has of course
      a .class file but also a ScalaSig annotation:

          scala> import com.novus.salat.test.model._
          import com.novus.salat.test.model._
      
          scala> val clazz = classOf[Hector]
          x: java.lang.Class[com.novus.salat.test.model.Hector] = class
      com.novus.salat.test.model.Hector
      
          scala> clazz.getAnnotations
          res2: Array[java.lang.annotation.Annotation] =
          !A/Z:u s9 "A tC2,GN   calaSignature(bytes=   c C                Q
                          GO  
          // etc etc etc 
      

      === What do you see instead? ===

      I expect that defining a class in the REPL should create a class with a ScalaSig annotation.

      Failing that, extending ScalaSigParser to be able to manually derive a ScalaSig annotation on a class defined in the REPL (or anywhere) would be extremely useful.

      === Additional information ===
      http://groups.google.com/group/scala-user/browse_thread/thread/484ed3e719f13fdf

      === What versions of the following are you using? ===

      • Scala: 2.8.1
      • Java: 1.6.0_24-b07
      • Operating system: Ubuntu 11.04 64-bit

        Activity

        Hide
        Paul Phillips added a comment -

        Based on iulian's input on the mailing list I am reclassifying as enhancement, since the signature is not missing. But it is not ideally located.

        Show
        Paul Phillips added a comment - Based on iulian's input on the mailing list I am reclassifying as enhancement, since the signature is not missing. But it is not ideally located.
        Hide
        Rose Toomey added a comment -

        Here is a gist showing my defined class vs the ScalaSig of its containing object:
        https://gist.github.com/966803

        Show
        Rose Toomey added a comment - Here is a gist showing my defined class vs the ScalaSig of its containing object: https://gist.github.com/966803

          People

          • Assignee:
            Unassigned
            Reporter:
            Rose Toomey
            TracCC:
            Johannes Rudolph, Paul Phillips
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:

              Development