Darwin Project

The Darwin Project

Darwin Project

Home
Delegation
Project
Compiler
Downloads
History
Papers
People
Contact

The Lava Compiler

The Lava compiler, lavac, is an extension of the javac compiler for Java. It can be used exactly like javac (same options, etc.). On our download page you can find the newest release of lavac and an integration of lavac into the NetBeans IDE.

Feature Description

The rightmost column indicates the first compiler version that contained the respective feature.

Variable annotation "mandatory"
... whereby annotated variables will never refer to null. An attempt to assign null throws an unchecked AssignmentOfNullException.
Basics
Mandatory instance fields (instance variables) 0.15
Check that initialisation of mandatroy instance fields is the first block of actions in a constructor and that the initialisation value is a parameter of the constructor [Tobias, didn't we relax the second constraint?] 0.15
Check of assignments to mandatory variables (at compile-time and run-time) 0.15
Extensions
Mandatory method parameters 0.16
Mandatory local variables 0.16
Mandatory return types 0.16
Extended subtyping relation
... whereby child classes are subtypes of their declared parent types
Subtype by consultation
Child classes derived from their declared parent types by consultation behave with respect to subtyping just like subclasses derived by inheritance. 0.15
Subtype by delegation
Child classes derived from their declared parent types by delegation behave with respect to subtyping just like subclasses derived by inheritance. 0.15
Extended visibility relation
... whereby delegating child classes "see" the same as subclasses
Visibility in delegation children
Child classes derived from their declared parent type by delegation behave with respect to visibility of public, protected and package members just like subclasses derived by inheritance. (Children derived by consultation are analoguous to normal message sending clients and hence see just the public interface of the parent).  0.15
Atomic types
... whereby expressions of static type T are confined to evaluate to values that are legal subtypes of T in Java (excluding subtypes by delegation and consultation).
For delegatee fields
Use of atomic type declaration for fields referring to delegation parents. 0.15
Consultation
... whereby method and variable accesses are forwarded automatically to the parent object
Automatic forwarding
Method invocations and variable accesses are forwarded automatically to the parent object if the object if the accessed object does not contain a proper method or variable definition. 0.15
Subtype by consultation
See comment in "Extended subtyping relation" section above. 0.15
Delegation
... whereby method and variable accesses are delegated automatically to the parent object
General
Automatic forwarding [except for accesses to static fields (class variables)] 0.15
Overriding of methods from parent types 0.15
Subtype of declared parent type (see above) 0.15
Extended visibility (see above) 0.15
Anticipated dynamic delegation
"delegatee" annotation for classes and interfaces 0.15
"holder" keyword 0.15
Check that fields annotated as "delegatee" are either "final" or "atomic" and that their declared type is annotated as "delegatee" 0.20
Unanticipated static delegation
Final delegatee fields may refer to any object type. 0.19
Inner classes
... whereby we integrated even the most ugly part of Java :-)
Inner classes
Up to a few known bugs, normal use of inner classes possible (including static and anonymous ones). 0.20
Delegation to inner classes possible (including static and anonymous ones). 0.20
Delegation from inner classes possible (including static and anonymous ones). 0.20

Lava Compiler: Limitations

The following limitations are not due to conceptual problems, just to missing man-power. They are likely to be removed (sooner or later :-) We welcome your opinion on which missing feature you consider highest priority (write to lava-talk).

No mandatory static fields
Currently, the "mandatory" annotation cannot be added to class variables (static fields).
No atomic types outside declarations of delegatee fields
Currently, the "atomic" annotation can only be used in the declaration of a delegation parent field (i.e. only in conjunction with the "delegatee" annotation). In the future the "atomic" modifier will be usable in conjunction with any class or interface type.
No cast to atomic type

Currently, there is no explicit dynamic check that an expression of static type T evaluates to an object whose type is a legal subtype of T in Java. However, this check happens implicitly whenever one attempts to assign an expression of type T to an expression of type "atomic T". So the cast can be simulated by trying to perform the assignment while being prepared to catch the org.cs3.tailor.lava.lang.NonAtomicInstanceException thrown if a non-atomic value is assigned.

No consultation and delegation via class variables
Currently, the "delegatee" and "consultee" annotation cannot be added to class variables (static fields).
No delegation to external types
External types are any classes and interfaces not compiled by the lava compiler (e.g. all JDK classes - except java.lang.Object). Currently, delegation to external types and their subtypes (even non-external one's) is not supported. For instance, you cannot delegate to java.util.Stack or any subclass of it.
Note that d
elegation from a subtype of an external type is possible. For instance, your subclass of Stack could declare a delegatee field (of some non-external type).
No multiple delegation
Currently, there is at most one consultee or delegatee field in a class. Looking back at our past experiments with multiple delegation, condensing them into a good language design and extending the current implementation accordingly   is the topic of an ongoing diploma thesis.
No assertions

Currently, the compiler does not recognize the language extensions added in JDK 1.4 in support of assertions. Java files with assertions cannot be compiled. So the current Lava release implements a superset of Java 1.3 but not of Java 1.4.

Compilation dependencies

Whenever a class or interface changes, all its children need to be recompiled. [The children of a type are all classes that declare delegatee or consultee fields of that type and their own children.] Therefore it is best to set up your project build tool (e.g. ANT) to enforce a complete rebuild of the project.
If you think this is a serious limitation you should bear in mind that if you used manual message forwarding instead of delegation or consultation you would need to change the source code of every single child class in order to propagate interface changes.

Lava Compiler: Known Bugs

The following table always refers to the newest release. These issues are plain bugs and due to be removed in the next release.

Inner classes
Inner classes cannot be used for the initialisation of object variables.

A local class cannot refer to itself in type declarations.

This is still an "alpha" version. There might be issues that have not yet been detected by our test suites, so any kind of feedback is most welcome. Please use the appropriate Lava mailing lists.


Home
Delegation
Project
Compiler
Downloads
History
Papers
People
Contact

© 1997-2002 Günter Kniesel Date: 01.08.2005