1 Nov 2006 10:58
Re: Java nested static classes
Iulian Dragos <iulian.dragos <at> epfl.ch>
2006-11-01 09:58:26 GMT
2006-11-01 09:58:26 GMT
Carlos Pita wrote:
> Hi all,
Hi Carlos,
> I'm having trouble when trying to access nested static classes from a
> java lib (lucene). Namely Field.Index and Field.Store as documented
> here:
>
> file:///data1/install/java5-packages/docs/lucene-2.0.0/api/index.html
>
> I guess scala maps these static classes to singleton objects or
> something, but anyway Field.Index and Field.Store are not working. Are
> java nested static classes supported? Which is the way to deal with
> them?
In what way it's not working? This program compiles (using scala's
latest release):
import org.apache.lucene.document._
object Main extends Application {
val i: Field.Index = new Field.Index
}
For java nested/inner classes, Scala creates type aliases in their
enclosing class, so Field (as seen from Scala programs) looks like
having a 'type Index = Field$Index' inside it. Note that for Java inner
classes the outer instance is not passed automatically when
instantiated. A more complete scheme which handles Java inner classes
(Continue reading)
found bugs are better that not-yet-found ones, and you found one. Though Martin's comment hints at some demotivation, he just fixed something like 20 in a row and now it seems to start all over again.
RSS Feed