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

java.lang.NoSuchFieldError: $outer when mixing Scala and Java

    Details

      Description

      Outer.java
      public class Outer {
          public class Inner {
          }
      }
      
      Test.scala
      object Test extends App {
      
        val so = new SubOuter
        val si = new so.SubInner
        println(si.bar)
      }
      
      class SubOuter extends Outer {
      
        val foo = "hello"
      
        class SubInner extends Inner {
          def bar = foo
        }
      
      }
      

      Worked in 2.9, throws NoSuchFieldError: $outer in 2.10. Error only occurs when defining Outer and Inner in Java; equivalent definitions of Outer and Inner in Scala don't cause the regression.

        Activity

        Show
        Jason Zaugg added a comment - https://github.com/scala/scala/pull/2270

          People

          • Assignee:
            Jason Zaugg
            Reporter:
            Ryan Hendrickson
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development