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

privateWithin is broken for java package private objects

    Details

      Description

      The documentation for privateWithin says:

           *  The java access levels translate as follows:
           *
           *  java private:     isPrivate                  && (privateWithin == NoSymbol)
           *  java package:     !isPrivate && !isProtected && (privateWithin == enclosingPackage)
           *  java protected:   isProtected                && (privateWithin == enclosingPackage)
           *  java public:      !isPrivate && !isProtected && (privateWithin == NoSymbol)
      

      However, here's what I get for getPrefixLength in java.io.File (which is package private):

      Welcome to Scala version 2.10.0 (Java HotSpot(TM) 64-Bit Server VM, Java 1.7.0_09).
      Type in expressions to have them evaluated.
      Type :help for more information.
      
      scala> import reflect.runtime.universe._
      import reflect.runtime.universe._
      
      scala> val t = weakTypeOf[java.io.File]
      t: reflect.runtime.universe.Type = java.io.File
      
      scala> val m = t.member(newTermName("getPrefixLength"))
      m: reflect.runtime.universe.Symbol = method getPrefixLength
      
      scala> m.isPrivate
      res0: Boolean = false
      
      scala> m.isProtected
      res1: Boolean = false
      
      scala> m.privateWithin
      res2: reflect.runtime.universe.Symbol = <none>
      
      scala> m.isPublic
      res3: Boolean = true
      

        Activity

        Show
        Eugene Burmako added a comment - https://github.com/scala/scala/pull/2035
        Hide
        Adriaan Moors added a comment -

        Due to binary compatibility reasons, this cannot go into 2.10.1-RC1.

        Show
        Adriaan Moors added a comment - Due to binary compatibility reasons, this cannot go into 2.10.1-RC1.
        Show
        Adriaan Moors added a comment - https://github.com/scala/scala/pull/2103
        Hide
        Adriaan Moors added a comment -

        PR amended to leave the fix in by refactoring it to be binary compatible

        Show
        Adriaan Moors added a comment - PR amended to leave the fix in by refactoring it to be binary compatible

          People

          • Assignee:
            Eugene Burmako
            Reporter:
            Paul Butcher
          • Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development