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 for details.
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
.
You can write annotation declarations - see Annotations for details.
Kawa does not yet support annotations on types, or declaring new annotation classes.