Previous: , Up: Kawa Scheme Tutorial   [Contents][Index]

Other Java features

Import

The import form can be used to avoid having to write fully-qualified class names. For example:

(import (class java.util
               Map
               (HashMap HMap)))

This defines aliases for two classes in the java.util package, one with renaming: Map is an alias for java.util.Map, and HMap is an alias for java.util.HashMap.

The class keyword is needed because the import form is also used for Kawa’s module system. See importing-class-names and Importing from a library for details.

Synchronized blocks

You can use a synchronized expression:

(synchronized obj form1 ... formn)

This waits until it can get an exclusive lock on obj and then evaluates form1 through formn. Unlike Java, this is an expression and returns the value of formn.

Annotations

You can write annotation declarations - see Annotations of declarations for details.

Kawa does not yet support annotations on types, or declaring new annotation classes.


Previous: , Up: Kawa Scheme Tutorial   [Contents][Index]