Given the following Java:
> public class Foo {
> public class Bar {
> Bar() {}
> }
>
> public Bar getBar() { return new Bar(); }
> }
I get:
> scala> val f = new Foo
> f: Foo = Foo@756a7c99
>
> scala> val b = new Foo.Bar
> <console>:5: error: type Bar is not a member of object Foo
> val b = new Foo.Bar
> ^
>
> scala> val b = f.getBar
> b: Foo#Bar = Foo$Bar@3cecfaea
>
> scala> val b2 = new Foo#Bar
> <console>:5: error: Foo is not a legal prefix for a constructor
> val b2 = new Foo#Bar
> ^
What am I missing?
(note that I'm aware of the "Scala can't access a static inner class" issue. But this isn't a static inner class).
--
paul.butcher->msgCount++
Snetterton, Castle Combe, Cadwell Park...
Who says I have a one track mind?
http://www.paulbutcher.com/
LinkedIn: http://www.linkedin.com/in/paulbutcher
MSN: pa...@paulbutcher.com
AIM: paulrabutcher
Skype: paulrabutcher
scala> new f.Bar
res1: f.Bar = Foo$Bar@53e36ec6
Foo#Bar is a supertype of f.Bar, but it's not a class, so you can't instantiate it. I had to make the Bar constructor public to avoid an IllegalAccessError.
Nate
D'oh! I knew I was being dumb. Thanks!