extern classes

JOOS contains a simple extension to Java that allows the compiler to access libraries without having to parse class files to determine class signatures.

An extern class definition contains a class signature along with the name of a library that is guaranteed to implement that class. The JOOS compiler trusts this information implicitly and generates code accordingly. Thus, if an extern class is not correct, then the compiled JOOS program may fail at class loading time.

The following extern classes have been predefined. They are mainly designed to give access to the standard Java libraries, either by matching the given signatures or by providing special JOOS "wrappers" when the signature of a Java class cannot be expressed in JOOS.

A JOOS program that uses extern classes must import the corresponding Java library.

  • The file javalib.joos contains extern classes for the libraries "java.lang.*" and "java.util.*"..
  • The file awtlib.joos contains extern classes for the library "java.awt.*".
  • The file netlib.joos contains extern classes for the library "java.net.*".
  • The file appletlib.joos contains extern classes for the library "java.applet.*".
  • The file jooslib.joos contains extern classes for JOOS-specific wrappers in "joos.lib".
Note that it is easy to write additional extern classes, provided the corresponding classes are implemented in some Java library. When writing an extern, remember to include a constructor prototype.

The above extern classes are automatically included when the joosc command is used.

Maintained by Laurie Hendren. [HOME]