views:

149

answers:

1

Suppose I have the following Java file in a library:

package test;
public abstract class AbstractFoo {
   protected static class FooHelper {
      public FooHelper() {}
   }
}

I would like to extend it from Scala:

package test2
import test.AbstractFoo
class Foo extends AbstractFoo {
  new AbstractFoo.FooHelper()
}

I get an error, "class FooHelper cannot be accessed in object test.AbstractFoo". (I'm using a Scala 2.8 nightly). The following Java compiles correctly:

package test2;
import test.AbstractFoo;
public class Foo2 extends AbstractFoo {
    { new FooHelper(); }
}

The Scala version also compiles if it's placed in the test package. Is there another way to get it to compile?

+7  A: 

Hmm, I could just read the Java Interoperability FAQ:

http://www.scala-lang.org/faq/4#4n1381

Matt R