JML

Package org.multijava.mjc

Implements mjc, a MultiJava compiler.

See:
          Description

Interface Summary
CAmbiguousDispatcherClass This interface is implemented by classes that represent the dispatcher class for the ambiguous error method of an external generic function.
CClass.Observer  
CClassContextType This class represents the context for a class during checking passes (checkInterface, checkInitializers, typecheck).
CCompilationUnitContextType This class represents the context for a compilation unit during checking passes (checkInterface, checkInitializers, typecheck).
CConstructorContextType This class represents the context for a constructor during checking passes (checkInterface, checkInitializers, typecheck).
CContextType Descendents of this class represent local contexts during checking passes (checkInterface, checkInitializers, typecheck).
CDispatcherSignature This interface is implemented by classes that represent the type (i.e., $signature) for inner dispatcher classes of an external generic function.
CExpressionContextType This class represents the context for an expression during checking passes (checkInterface, checkInitializers, typecheck).
CFieldAccessor This interface represents a field or proxy for a field (a field getter or setter method)
CFlowControlContextType This class is used during typechecking for control flow analysis that maintains local variable definite assignment (JLS2, 16), throwable, and reachability information (JLS2, 14.20).
CGenericFunctionCollection This interface represents a single generic function collection, which encapsulates all the top-level methods of the same name declared in a given context.
CInitializable Interface for all left-value expressions
CInitializerContextType This class represents the context for a static initializer during checking passes (checkInterface, checkInitializers, typecheck).
CInterfaceContextType This class represents the context for an interface declaration during checking passes (checkInterface, checkInitializers, typecheck).
CMemberHost This interface is implementation by abstractions that can host members.
CMethodContextType This class represents the context for a method during checking passes (checkInterface, checkInitializers, typecheck).
CMethodSet.Strategy Represents the interface for strategies used in accumulating method sets.
CompilerPassEnterable This is the type of AST nodes that provide methods for handling individual passes of the compilation process.
Constants Defines all constants shared by compiler
CTypeSignatureAppender This interface is implemented by classes that represent types and that are able to append a String representation of the represented type to a FastStringBuffer.
FileFinder This is an interface to classes that find files for an application (such as with a given set of suffixes and given sequence of directories).
JavadocLexerTokenTypes  
JavadocTokenTypes  
JClassDeclarationType This type represents a java class declaration in the syntax tree.
JClassOrGFImportType This type represents (in the AST) import statements for single classes or generic functions, e.g., import java.util.ArrayList; or import org.multijava.samples.typecheck.
JCompilationUnitType This type represents a single Java compilation unit (typically a file in a file-based compiler like this) in the AST.
JConstructorDeclarationType This type represents a constructor in the AST.
JFieldDeclarationType This type represents a field declaration in the syntax tree.
JInterfaceDeclarationType This type represents a java interface in the syntax tree.
JMemberDeclarationType This type represents a java declaration in the syntax tree.
JMethodDeclarationType This type represents a java method in the syntax tree.
JPackageImportType This type represents (in the AST) full-package import statements, with an asterisk.
JTypeDeclarationType This type represents a java class or interface in the syntax tree
Main.Trees  
MjcIDTokenTypes  
MjcLexerTokenTypes  
MjcTokenTypes  
MjcVisitor Implementation of Visitor Design Pattern for KJC.
MJSpecialMethod This marker interface is implemented by classes that represent special methods generated for MultiJava purposes.
MJTopLevelDeclaration This interface is implemented by all classes that represent top-level declarations in MultiJava, i.e., all open-class declarations.
SignatureParser  
SigSourceMember This interface is implemented by signature forest classes that correspond to specific member declarations in an AST.
VariableDescriptor This interface represents the type of an object that provides a description of a variable or field (hereafter, "slot").
 

Class Summary
AbstractFileFinder This class provides a method for converting anchor class names to the prefixes of the files declaring the anchored generic function.
CAbstractMethodSet This class encapsulates a collection of method signatures.
CAnchorInitializer This is used as a wrapper around the normal static or instance initializer method of a class that includes nested dispatcher classes (e.g., an anchor class).
CArrayType This class represents the array type in the type structure.
CAssertHelperMethod This class represents a synthetic method used in the implementation of Java's assertion mechanism.
CAssertStaticInitMethod This class represents a static initializer that begins with code to figure out if the associated class has assertions enabled or not.
CAugmentationMap This class implements a function mapping from classes and contexts to method sets, CAugmentationMap: CClass x CContextType -> CMethodSet.
CAugmentationMap.ContextMap  
CBadClass This class represents an undefined class (something that comes from a bad classfile) This class is not usable to anything, so it will sooner or later produce a comprehensive error.
CBinaryClass This class represents a class read from a *.class file.
CBinaryClassContext This represents the context of a binary (i.e., read from .class file) class declaration.
CBinaryField This class represents loaded (compiled) class fields.
CBinaryGFCollection This class represents a single generic function collection as read from a .class file.
CBinaryMethod This class represents a loaded (already compiled) class method.
CBooleanType This class represents the Java boolean type.
CBooleanValueType This class represents a value specializer for booleans.
CCaptureType Type resulting from applying capture conversion (JLS3 5.1.10) to a wildcard.
CClass This class represents a class declaration in the signature hierarchy.
CClassContext This class represents the context for a class during checking passes (checkInterface, checkInitializers, typecheck).
CClassFQNameType This class represents a class type when the class name first appears as a forward reference and the name is definitely fully qualified as in an import clause.
CClassNameType This class represents a class type when the class name first appears as a forward reference.
CClassType This class represents a class type in the type structure.
CCompilationUnit This class handles namespace management for a compilation unit.
CCompilationUnitContext This class represents the context for a compilation unit during checking passes (checkInterface, checkInitializers, typecheck).
CConstructorContext This class represents the context for a constructor during checking passes (checkInterface, checkInitializers, typecheck).
CContext Descendents of this class represent local contexts during checking passes (checkInterface, checkInitializers, typecheck).
CContextNullity This class provides routines used to implement the Nullity Accessor methods that are delcared in CContextType.
CCORInitializer This generates code to add external generic function dispatcher classes to the chain of responsibility for the appropriate generic function anchor class.
CDispatcherInitializer This is used as the initializer of a dispatcher class, in RMJ.
CErasedClassType This class represents class type in the type structure
CExpressionContext This class represents the context for an expression during checking passes (checkInterface, checkInitializers, typecheck).
CExtendedClassContext This class represents the context for a class during checking passes (checkInterface, checkInitializers, typecheck).
CExtendedCompilationUnitContext This class represents the context for a class during checking passes (checkInterface, checkInitializers, typecheck).
CExtMethodContext This represents the context in which an external method declaration is typechecked.
CField This class represents an exported member of a class (fields)
CFieldAccessorMethod This class is the abstract base class for the field getter and setter methods.
CFieldGetterMethod This class represents a getter method for a field that an inner or enclosing class has privileged access to.
CFieldSetterMethod This class represents a setter method for a field that an inner or enclosing class has privileged access to.
CFieldTable This class encapsulates the fields of a class.
CFinallyContext This class implements the special definite assignment and reachability calculations for combining try and finally blocks in a try-finally statement.
CFlowControlContext This class is used during typechecking for control flow analysis that maintains local variable definite assignment (JLS2, 16), throwable, and reachability information (JLS2, 14.20).
CFunctionAccessMethod This generates code to thread-safely return the function field of an external generic function.
CGenericFunctionCollection.CGenericFunctionCollection$1  
CGenericFunctionCollection.Impl  
CGFCollectionMap This represents a mapping from compilation units and strings to sets of collections of generic functions: CGFCollectionMap: CCompilationUnit x String -> { CGFCollection }.
CGFCollectionMap.SetMap  
CInitializerContext This class represents the context for a static initializer during checking passes (checkInterface, checkInitializers, typecheck).
CInterfaceContext This class represents the context for an interface declaration during checking passes (checkInterface, checkInitializers, typecheck).
CLabeledContext This class represents a labeled context during checking passes (checkInterface, checkInitializers, typecheck).
ClassCreator A factory class to create classes.
CLoopContext This class represents the context for a loop statement during checking passes (checkInterface, checkInitializers, typecheck).
CMember This class represents a member of a class or compilation unit.
CMethod This class represents an actual method, whether generated from source code or read from a class file.
CMethodContext This class represents the context for a method during checking passes (checkInterface, checkInitializers, typecheck).
CMethodInfo VMS 4.6: Methods Each method, and each (class or instance) initialization method is described by this structure.
CMethodSet This class encapsulates a collection of method signatures.
CMethodSet.MethodArgsPair  
CModifier This class provides utilities for operating on modifier bit masks.
CNullType This class represents null class type in the type structure
CNumericType This class represents java and kopi numericals types Such as byte, short, int, long, float, double
CodeLabel This class represents a position in the code array where the associated instruction has not yet been generated.
CodeSequence  
COrdinalValueType This class represents a value specializer for ordinal types such as byte, short, int, and long.
CParseClassContext This class is used by the parser to collect the members of a class declaration.
CParseCompilationUnitContext This class is used by the parser to collect the contents of a compilation unit.
CRealValueType This class represents a value specializer for floats and doubles.
CSourceAmbiguousDispatcherClass This class represents an inner dispatcher class from which an ambiguous error method can be generated.
CSourceClass This class represents a class read from a *.java file.
CSourceDispatcherClass This class represents an inner dispatcher class for a collection of multimethods of the same generic function declared in a single lexical context.
CSourceDispatcherMethod This class represents a dispatcher method wrapping a set of multimethods of the same generic function as read from a source file.
CSourceDispatcherMethod.CSourceDispatcherMethod$1  
CSourceDispatcherSignature This class represents the type (i.e., $signature) for inner dispatcher classes of an external generic function.
CSourceField This class represents an exported member of a class (fields)
CSourceFilteredDispatcherMethod This class represents a special dispatcher method for superclass method invocations whose caller is an external method and whose target is the same external generic function to which the caller belongs [see Clifton-01, Figure 24, case s-e4].
CSourceGFCollection This class represents a single generic function collection, which encapsulates all the top-level methods declared in a given context.
CSourceMethod This class represents a method read from a source code (*.java) file.
CSourceRedirectorMethod This class represents a redirector method for a pleomorphic method that belongs to an internal and external generic function.
CSpecializedType This class represents a specialized type like type1@type2.
CStdType This class is a singleton that provides variables for the various built-in and java.lang types.
CStringValueType This class represents a value specializer for Strings.
CSwitchBodyContext This class represents the context for the body of a switch statement during checking passes (checkInterface, checkInitializers, typecheck).
CSwitchGroupContext This class represents the context for a switch group during checking passes.
CThrowableInfo This class represents information on the sorts of exceptions that can be thrown in a particular context.
CTopLevel This class is a facade for an instance of TypeLoader (or a subclass).
CTopLevel.CTopLevel$1  
CTryContext This class represents the context for a try statement during checking passes (checkInterface, checkInitializers, typecheck).
CType This class is the root for type hierarchy.
CType.MethodSignature This data structure represents a method type signature as an array of specialized parameter types, a return type, and a receiver type (which may be null for regular Java method signatures).
CType.MethodSignatureParser This inner class provides methods for converting a bytecode type signature into an instance of (a subclass of) CType for use in compilation.
CType.StringBuffers This inner class optimizes performance by maintaining a stack of FastStringBuffers to be recycled.
CType.TupleCollection This nested class defines a collection of tuples where only the most general type tuples are retained in the collection.
CTypeNullity This class performs nullity type information checks.
CTypeVariable  
CTypeVariableAlias  
CUniverse This is the abstract base class that represents Universes.
CUniverseAttr Attributes given at a universe creation.
CUniverseImplicitPeer This class implements a peer/ground/default universe.
CUniverseImplicitReadonly Implements the readonly universe.
CUniverseMessages  
CUniverseMethodAnnotation This class represents a universe annotation for a method.
CUniversePeer This class implements a peer/ground/default universe.
CUniverseReadonly Implements the readonly universe.
CUniverseRep Implements the rep universe that specifies the representation of the current object.
CUniverseRuntimeHelper This is a helper class for the universe runtime checks.
CUniverseTypeAnnotation This class represents a universe annotation for a type.
CValueType This class represents a value specializer "type."
CVariableInfoTable This class stores information about the set of local variables in a given context.
CVariableState The class stores information about the definitely assigned state of a variable or field.
CVoidType This class represents Java void type
CWildcardType Type representing a wildcard (JLS3 4.5.1).
CWrapperMethod This class represents a wrapper method for a method that an inner or enclosing class has privileged access to.
Debug This singleton class localizes the reporting of debugging information.
DefaultFilter This is the default warning filter.
FunctionalTestSuite  
FunctionalTestSuite.FunctionalTestSuite$1  
FunctionalTestSuite.TestCase  
FunctionalTestSuite.TestCase.CodeGenResults Represents the results of disassembling, including a success flag and any error messages.
FunctionalTestSuite.TestCase.CompilationResults A string representation of the working directory, used in matching expected error messages.
FunctionalTestSuite.TestCase.FunctionalTestSuite$TestCase$1  
FunctionalTestSuite.TestCase.FunctionalTestSuite$TestCase$2  
FunctionalTestSuite.TestCase.Processor  
FunctionalTestSuite.TestCase.RuntimeResults Represents the results of a runtime test, including a success flag, any exception thrown and the values written to standard error and standard out.
JAddExpression This class represents the addition binary expression.
JArrayAccessExpression This class implements an access to an array.
JArrayDimsAndInits This class implements an AST node representing a list of expressions used in array dimensioning and an array initialization expression, as in the [1][2][3] in new Integer[1][2][3] or the { 1, 2, 3 } in Integer[] foo = { 1, 2, 3 }.
JArrayInitializer This class implements a constant list of expressions used in array initialisation.
JArrayLengthExpression This class represents an array length expression in the AST.
JAssertStatement The syntax for Java assert statements is defined as follows.
JAssignmentExpression This class implements the assignment operation
JavadocLexer  
JavadocParser  
JBinaryArithmeticExpression This class is an abstract root class for binary expressions.
JBinaryExpression This class is an abstract root class for binary expressions Here are conversion method following JLS 5.6.2
JBitwiseExpression This class represents the bitwise AND, OR, and XOR binary expressions.
JBlock A block is a sequence of statements and local variable declaration statements within braces.
JBooleanLiteral Root class for all expressions
JBreakStatement This class represents a break statement.
JCastExpression This class represents a cast expression '((byte)2)'
JCatchClause This class represents a catch clause in the syntax tree.
JCharLiteral A simple character constant
JCheckedExpression This AST node is used to add a portion of already checked code into code that needs to be checked.
JClassBlock This class represents an initializer block in a type declaration.
JClassDeclaration This class represents a java class in the syntax tree
JClassExpression This class represents an AST node for a class literal expression, e.g., int.class and String.class.
JClassFieldDeclarator JLS 14.5: Field Statement.
JClassFieldExpression This class represents the AST node for a field access, e.g.
JClassOrGFImport This class represents (in the AST) import statements for single classes or generic functions, e.g., import java.util.ArrayList; or import org.multijava.samples.typecheck.
JCompilationUnit This class represents a single Java compilation unit (typically a file in a file-based compiler like this) in the AST.
JCompilationUnit.JCompilationUnit$1  
JCompilationUnit.JCompilationUnit$2  
JCompilationUnit.JCompilationUnit$4  
JCompoundAssignmentExpression This class represents the compound assignment operation, e.g., x += 3 and y *= 4, in the AST.
JCompoundStatement A compound statement is a sequence of statements and local variable declaration statements without braces.
JConditionalAndExpression This class implements the conditional and operation
JConditionalExpression This class implements expressions using the conditional operator.
JConditionalOrExpression This class implements the conditional or operation
JConstructorBlock This class represents the block of a constructor.
JConstructorDeclaration This class represents a constructor in the AST
JContinueStatement A continue statement may occur only in a while, do, or for statement; statements of these three kinds are called iteration statements.
JDivideExpression This class represents the division binary expression.
JDoStatement This class represents a do statement in the AST.
JEmptyStatement This class represents an empty statement, which does nothing.
JEqualityExpression This class represents the AST node for the equality operators.
JExplicitConstructorInvocation This class represents a explicit call to a super or self constructor.
JExpression This class is the root class for all classes representing expression nodes in the AST.
JExpressionFactory Expression AST node factory class.
JExpressionListStatement This class represents an expression list, a comma-separated list of expression statements used in the initializer and iterator of a for-loop statement.
JExpressionStatement Certain kinds of expressions may be used as statements by following them with semicolon.
JFieldDeclaration This class represents a field declaration in the syntax tree.
JFormalParameter This class represents a parameter declaration in the syntax tree
JForStatement This class represents a for statement in the AST.
JGeneratedLocalVariable This class represents a compiler-generated local variable declaration.
JIfStatement This class represents an if statement in the AST.
JInitializerDeclaration This class represents an initializer (either static or instance) in the AST.
JInstanceofExpression This class represents an instanceof expression.
JInterfaceDeclaration This class represents a java interface in the syntax tree
JLabeledStatement This class represents a labeled statement.
JLiteral Root class for all literals expression
JLocalVariable This class represents a local variable declaration in the AST.
JLocalVariableExpression This class represents the AST node for local variable references.
JLoopStatement This abstract class is the superclass for all the classes representing loop statements in the AST.
JMemberDeclaration This class represents a java declaration in the syntax tree
JMethodCallExpression This class represents method calls methodname( e1, e2, ..., en )
JMethodDeclaration This class represents a java method in the syntax tree.
JMinusExpression This class represents the subtraction binary expression.
JModuloExpression This class represents the modulo binary expression.
JMultExpression This class represents the multiplication binary expression.
JNameExpression This class represents a name within an expression.
JNewAnonymousClassExpression This class represents a new anonymous class allocation expression.
JNewArrayExpression This class represents a new array allocation expression 'new type[...]'
JNewObjectExpression This class represents an object instantiation expression 'new type(...)'
JNewObjectExpression.ArgTypes This nested class is used to track the argument types of the actual constructor call.
JNullLiteral A simple character constant
JNumberLiteral Root class for all number literals
JOrdinalLiteral This class represents literals of primitive integral types (byte, short, int, long).
JOuterLocalVariableExpression This class is an AST node and represents a reference to a variable of a surrounding lexical context from within an inner class.
JPackageImport This class represents (in the AST) full-package import statements, an asterisk.
JPackageName This class represents package statements in the AST, like package org.multijava.mjc.
JParenthesedExpression This class represents expression within parentheses.
JPhylum This class is a superclass for all elements of the parsing tree.
JPostfixExpression This class represents postfix increment and decrement expressions.
JPrefixExpression This class represents prefix increment and decrement expressions.
JRealLiteral This class represents real-valued literals (float, double)
JRelationalExpression This class represents the AST node for the relational operators, <, >, etc.
JResendExpression This class represents a MultiJava resend expression, for invoking a directly overridden method of the caller's generic function.
JReturnStatement This class represents a return statement in the AST.
JShiftExpression This class represents the shift (left, right, boolean-right) binary expressions.
JStatement This class is the root class for all classes representing statement nodes in the AST.
JStringLiteral A simple character constant
JSuperExpression This class represents a "super" primary expression in an AST.
JSwitchGroup This class represents an AST node for a group in a switch statement.
JSwitchLabel This class represents an AST node for the label for a single case of a switch statement.
JSwitchStatement This class represents a switch statement in the AST.
JSynchronizedStatement This class represents a synchronized statement in an AST.
JThisExpression A 'this' expression
JThrowStatement This class represents a throw statement in the AST.
JTryCatchStatement This class represents a try-catch statement in the AST.
JTryFinallyStatement This class represents a try-catch statement in the AST.
JTypeDeclaration This class represents a java class or interface in the syntax tree
JTypeDeclaration.WrapResult This nested class is used to return the results from dispatcherWrapMethods
JTypeDeclarationStatement This class represents a local type declaration statement.
JTypeNameExpression This class represents the AST node for a type name expression like Object
JUnaryExpression This class represents unary expressions (unary plus, unary minus, bitwise complement, and logical not).
JUnaryPromote This class promotes an arithmetic expression to a new type.
JVariableDeclarationStatement A local variable declaration statement declares one or more local variable names.
JVariableDefinition This class represents a local variable definition in the syntax tree.
JWhileStatement This class represents a while statement in the AST.
Main This class implements the entry point of the MultiJava compiler.
Main.ContextBehavior  
Main.DFilter This class is used with the Directory.list method to list the subdirectories in a directory (ignoring the special case of the 'CVS' subdirectory).
Main.ExpectedGF  
Main.ExpectedIndifferent  
Main.ExpectedResult This class represents the expected result of parsing a file.
Main.ExpectedType  
Main.Filter This class is used with the Directory.list method to list those files in a directory that this program is interested in processing - in this case, all those that end in '.java'
Main.TaskTimes  
MemberAccess This class represents and contains the information needed to determine whether a member of a class or compilation unit can be accessed from some other member.
MjcCommonOptions This class is automatically generated from MjcCommonOptions.opt and contains member fields corresponding to command-line options.
MjcFileFinder This FileFinder looks for a .class file and a .java file, returning whichever one is newer.
MjcGUI This class is automatically generated from MjcGUI.gui and contains member fields corresponding to tool-specific GUI specifications.
MjcIDKeywords  
MjcLexer  
MjcMessages  
MjcOptions This class is automatically generated from MjcOptions.opt and contains member fields corresponding to command-line options.
MjcParser  
MjcPrettyPrinter This class implements a Java pretty printer
MjcSignatureParser  
MJGenericFunctionDecl This class represents a group of method declarations, all sharing the same name, that together form the top of one or more overloaded external generic function lattices.
MJMathMode  
MJMathModeExpression This AST node is used to change the arithmetic mode for a given expression.
MJTopLevelAbstractMethodDeclaration  
MJTopLevelMethodDeclaration  
MJWarnExpression This AST node is used to enable or disable the compile-time and run-time checking of integral arithmetic overflow.
ParserUtility This class is delegated to my the parser classes and provides a place to encapsulate the utility methods of those classes.
ParsingController This class manages the parsing of source code.
ParsingController.InputState This nested class is a hack to expose the line and column fields of LexerSharedInputState for reading.
ParsingController.TokenWrapper This inner class wraps a single token.
SafeIntegralArithmetic  
SignatureParser.ClassSignature  
TestCContext Unit tests for CContext
TestJTypeDeclaration Unit tests for JTypeDeclaration
TestMain_CodeGen  
TestMain_Runtime  
TestMain_TransCompile This class includes test cases for the transitive compilation of referenced files.
TestMain_Typecheck  
TestMjcParser Unit tests for MjcParser
TestMjcParser.TestCompiler  
TestParsingController Unit tests for ParsingController
TestParsingController.TestParsingController$1  
TestSuite This class is automatically generated using org.multijava.util.testing.Main and is used to group a collection of JUnit tests for the local package and perhaps some subpackages.
TestSuite.TestSuite$1  
TypeLoader This class acts as a symbol table and a cache for types, type signatures, and external generic functions.
UniverseFilter A filter that lets all Universe related messages pass.
 

Exception Summary
CBlockError This class represents block errors in the error hierarchy.
CExpressionError This class represents Expression errors in error hierarchy
CLineError This class represents Line errors in error hierarchy.
CMethodNotFoundError This error display all parameters of method call
ParsingController.ConfigurationException This inner class represents exceptions that can be thrown because of misconfiguration of the parsing controller.
ParsingController.KeyException This inner class represents exceptions that can be thrown because of bad key values passed as arguments to the outer classes methods.
 

Package org.multijava.mjc Description

Implements mjc, a MultiJava compiler.

Package Specification

This section is not yet completed.

!FIXME! Clean-up and move most of the root-level overview document to this point.

Related Documentation

Bytecode Encoding of MultiJava Information

The MultiJava language specifies that certain information must be added to the bytecode produced from source files that use MultiJava-specific features. This information is added to the generated bytecode using custom attributes (see the Java Virtual Machine Specification, 2nd edition, section 4.1). A MultiJava compiler must parse these custom attributes to determine the static type signature of the multimethods and generic functions implemented by the bytecode.

The specification of these attributes belongs in a language reference manual. Until we have time to produce a MultiJava reference manual we are putting the specification here. In the following, numbers in square brackets are references to sections of the JVM Specification, 2nd edition.

External Generic Functions

One instance of the following attribute must appear in the attributes list of a ClassFile structure [4.1] that corresponds to the anchor class of an external generic function.

org.multijava.anchor_attribute {
        u2      attribute_name_index;
        u4      attribute_length;
}

attribute_name_index

The value of this item must be a valid index into the constant_pool table. The entry at that index must be a CONSTANT_Utf8_info structure [4.4.7] representing the string "org.multijava.anchor".

attribute_length

The value of the attribute_length item must be 0.

Dispatchers

One instance of the following attribute must appear in the attributes list of a ClassFile structure [4.1] that corresponds to the compiler generated dispatcher class of an external generic function and in the attributes list of a MethodInfo structure [4.6] that corresponds to the compiler generated dispatcher method of a multimethod.

org.multijava.dispatcher {
        u2      attribute_name_index;
        u4      attribute_length;
}

attribute_name_index

The value of this item must be a valid index into the constant_pool table. The entry at that index must be a CONSTANT_Utf8_info structure [4.4.7] representing the string "org.multijava.dispatcher".

attribute_length

The value of the attribute_length item must be 0.

Multimethod Bodies

One instance of the following attribute must appear in the attributes list of a MethodInfo structure [4.6] that corresponds to the compiler generated body method of a multimethod.

org.multijava.mm_body {
        u2      attribute_name_index;
        u4      attribute_length;
}

attribute_name_index

The value of this item must be a valid index into the constant_pool table. The entry at that index must be a CONSTANT_Utf8_info structure [4.4.7] representing the string "org.multijava.mm_body".

attribute_length

The value of the attribute_length item must be 0.

Pleomorphic Method Redirectors

One instance of the following attribute must appear in the attributes list of a MethodInfo structure [4.6] that corresponds to the compiler generated redirector method for a method that is pleomorphic on an interface generic function and an external generic function.

org.multijava.redirector {
        u2      attribute_name_index;
        u4      attribute_length;
}

attribute_name_index

The value of this item must be a valid index into the constant_pool table. The entry at that index must be a CONSTANT_Utf8_info structure [4.4.7] representing the string "org.multijava.redirector".

attribute_length

The value of the attribute_length item must be 0.

Generic Functions

One instance of the generic_functions attribute, defined below, must appear in the attributes list of any ClassFile structure [4.1] that corresponds to

The generic_functions attribute is defined as follows:

org.multijava.generic_functions_attribute {
        u2      attribute_name_index;
        u4      attribute_length;
        u2      gf_count;
        org.multijava.gf_info 
                generic_functions[gf_count];
}

attribute_name_index

The value of this item must be a valid index into the constant_pool table. The entry at that index must be a CONSTANT_Utf8_info structure [4.4.7] representing the string "org.multijava.generic_functions".

attribute_length

The value of the attribute_length item indicates the length of the attribute excluding the initial 6 bytes.

gf_count

The value of the gf_count attribute indicates the number of generic functions for which the class or anchor includes specializing methods. A generic function is included in this count only if a method of that generic function declared in the corresponding source code is accessed via a synthetic dispatch mechanism. For example, suppose there is an internal generic function, F, for which a class only includes an unspecialized method, i.e., a regular Java method. Then F is not included in the gf_count for the class. However, if specialized methods of F are declared in the class, then F is included in the gf_count for the class.

generic_functions

Each entry in the generic_functions array gives the type signature for a collection of multimethods all declared in the same compilation unit and all overriding the same generic function.

The next data structure is used to describe the signature for a collection of multimethods all declared in the same compilation unit and all overriding the same generic function. It is quite similar to the method_info data structure [4.6], but is expanded to reference an arbitrary number of multimethods.

org.multijava.gf_info {
        u2      name_index;
        u2      descriptor_index;
        u2      collection_index;
        u2      function_number;
        u2      mm_count;
        org.multijava.mm_info 
		multimethods[mm_count];
}

name_index

The value of the name_index item must be a valid index into the constant_pool table. The constant_pool entry at that index must be a CONSTANT_Utf8_info structure [4.4.7] representing a valid name in the Java programming language [2.7], stored as a simple name [2.7.1].

descriptor_index

The descriptor_index item must be a valid index into the constant_pool table. The constant_pool entry at the index must be a CONSTANT_Utf8_info [4.4.7] structure representing a valid method descriptor [4.3.3] giving the type signature for the generic function without explicit specializers.

collection_index

If the methods in this collection belong to an internal generic function or are external methods of an external generic function, then the collection_index item must be a valid index into the constant_pool table and the constant_pool entry at the index must be a CONSTANT_Utf8_info [4.4.7] structure representing the empty string.
Otherwise the methods in this collection must be internal methods of an external generic function. Then the collection_index item must be a valid index into the constant_pool table and the constant_pool entry at the index must be a CONSTANT_Utf8_info [4.4.7] structure representing the valid fully qualified name [2.7.5] of the generic function to which the methods in this collection belong. For example, for a generic function named func whose top method is declared in a package named pack.sub the constant_pool entry should be pack.sub.func.

function_number

The value of the function_number item must be a unique number for differentiating overloaded external generic functions within the same anchor class. The number is used in the naming of the synthetic dispatcher and signature classes of the generic function.

mm_count

The value of the mm_count attribute indicates the number of multimethods declared in the class or anchor that belong to the generic function. If the gf_info attribute represents an external generic function, then this count includes all methods of that generic function that are defined in the source code file. If the gf_info attribute represents an internal generic function, then it must be the case that there are multimethods declared on that generic function in the source code file. In this case the mm_count include both the multimethods and the regular (i.e., non-multiple-dispath) methods of that generic function that are defined in the source code file.

multimethods

Each entry in the multimethods array must be a valid multimethod information structure (described below), one for each method of the generic function declared in the corresponding source code file.

Multimethod Signatures

The next data structure is used to describe the signature for a single multimethod. It is essentially the same as the method_info data structure [4.6], but the referenced type descriptor includes a receiver type and can include explicit specializers.

org.multijava.mm_info {
        u2      access_flags;
        u2      name_index;
        u2      descriptor_index;
        u2      attributes_count;
        attribute_info 
                attributes[attributes_count];
}

access_flags

See the item of the same name in [4.6].

name_index

The value of the name_index item must be a valid index into the constant_pool table. The constant_pool entry at that index must be a CONSTANT_Utf8_info structure [4.4.7] representing a valid name in the Java programming language [2.7], stored as a simple name [2.7.1].

descriptor_index

The descriptor_index item must be a valid index into the constant_pool table. The constant_pool entry at the index must be a CONSTANT_Utf8_info [4.4.7] structure representing a valid multimethod descriptor (defined below).

attributes_count

See the item of the same name in [4.6].

attributes[]

Each value of the attributes table must be an attribute structure [4.7]. A multimethod can have any number of optional attributes associated with it. The only attribute defined by this and the Java Virtual Machine specification as appearing in the attributes table of an org.multijava.mm_info structure is the Exceptions [4.7.4] attribute. As in the virtual machine specification, tools must silently ignore unrecognized attributes.

The constant_pool table of a class declaring multimethods must include one CONSTANT_Utf8_info [4.4.7] structure for each multimethod. Each of these items is an instance of multimethod descriptor, which is closely related to method descriptor [4.3.3]. MultiJava simply adds some productions to the grammar for method descriptors. For completeness the full multimethod desciptor grammar is given below, with terminal symbols in single quotes. Non-terminal symbols not defined here are defined in the JVM Specification, section 4.3.2.

MultimethodDescriptor:
    '(' ParameterDescriptor* ')' ReturnDescriptor ReceiverDescriptor

ParameterDescriptor:
    FieldType
    '@' FieldType ObjectOrArrayType
    '@@' FieldType ValueSpecializer
    
ObjectOrArrayType:
    ObjectType
    ArrayType

ReturnDescriptor:
    FieldType
    'V'

ReceiverDescriptor:
    ObjectType

ValueSpecializer:
    'X' ConstantValue '"'

ConstantValue:
    IntegerLiteral
    FloatingPointLiteral
    BooleanLiteral
    CharacterLiteral
    StringLiteral
Note that CharacterLiterals and StringLiterals in the grammar above should be escaped (including their surrounding quotes), so that the trailing double-quote of a ValueSpecializer can be uniquely determined.

Credits

The code for Mjc originated from the Kopi project. This code was adapted for the Multijava project by Curtis Clifton, Todd Millstein (value dispatching), Yoonsik Cheon and Clyde Ruby (refactoring to make mjc serve as a compiler framework), and Gary T. Leavens (project leadership, system architecture, build system, testing).

Thanks also to any contributors whose names we have failed to mention. If we've left you off this list, it is a mistake on our part and we apologize. Please let us know so the mistake can be rectified.


JML

JML is Copyright (C) 1998-2002 by Iowa State University and is distributed under the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This release depends on code from the MultiJava project and is based in part on the Kopi project Copyright (C) 1990-99 DMS Decision Management Systems Ges.m.b.H.