Uploaded image for project: 'Scala Programming Language'
  1. Scala Programming Language
  2. SI-5037

IllegalAccessError when accessing private[this] final var from an inner class.

    Details

      Description

      The following code produces IllegalAccessError when run. Since the variable is annotated as private[this] the compiler should catch the access violation at compile time.

      object Test {
        def main(args: Array[String]) {
          val t = new Test
          t.inner.foo()
        }
      }
       
      class Test {
        class Inner {
          def foo() { bar = false }
        }
        val inner = new Inner
        private[this] final var bar = true
      }
      

        Attachments

          Activity

            People

            • Assignee:
              extempore Paul Phillips
              Reporter:
              lexn82 Aleksey Nikiforov
            • Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: