JML

org.multijava.mjc
Interface CMethodContextType

All Superinterfaces:
CContextType
All Known Subinterfaces:
CConstructorContextType, CInitializerContextType
All Known Implementing Classes:
CConstructorContext, CInitializerContext, CMethodContext, JmlConstructorContext, JmlInitializerContext, JmlMethodContext

public interface CMethodContextType
extends CContextType

This class represents the context for a method during checking passes (checkInterface, checkInitializers, typecheck).

See Also:
CContextType

Method Summary
 void addThrowable(CThrowableInfo throwable)
          Registers that the given throwable can be thrown within this context.
 CFlowControlContextType createFlowControlContext(int localVars, boolean isInExternalGF, TokenReference where)
           
 CFlowControlContextType createFlowControlContext(int localVars, TokenReference where)
           
 CMethod getCMethod()
          Returns the signature of the method declaration in which this context is enclosed, or null if this context is not enclosed in a method declaration.
 CMethodContextType getMethodContext()
          Returns the nearest surrounding context of type CMethodContextType.
 boolean isInConstructor()
          Indicates whether this context is enclosed in a constructor.
 boolean isInInitializer()
          Indicates whether this context is enclosed in an instance or static initializer.
 boolean isPure()
          Indicates whether this context is "pure".
 boolean isStatic()
          Indicates whether this context is "static".
 Set throwables()
           
 void verifyExceptions(TokenReference ref)
          Verifies that all checked exceptions are defined in the throw list.
 
Methods inherited from interface org.multijava.mjc.CContextType
addFANonNull, addFANonNulls, addFANull, addFANulls, adoptNullityInfo, arithmeticMode, catchUp, check, check, check, check, classToGenerate, createClassContext, createExtMethodContext, createInterfaceContext, declaredOutsideOfLoop, declares, dumpNonNulls, fail, fail, findNearestHost, getClassContext, getCompilationUnit, getCompiler, getFANonNulls, getFANulls, getFlowControlContext, getParentContext, initializeField, isBeforeSuperConstructorCall, isFANonNull, isFieldDefinitelyAssigned, isInLoop, lookupClass, lookupField, lookupField, lookupLocalVariable, lookupMethod, lookupMethod, lookupMethodOrSet, lookupMethodOrSet, lookupOuterField, lookupOuterField, lookupOuterLocalVariable, lookupTypeVariable, mergeNullityInfo, modUtil, registerGFDecl, registerVisibleMethod, registerVisibleType, removeAllFANullity, removeFANonNull, replaceFieldInfoUpTo, reportTrouble, resolveMaybeExtMethodRef
 

Method Detail

verifyExceptions

public void verifyExceptions(TokenReference ref)
                               throws PositionedError
Verifies that all checked exceptions are defined in the throw list.

Throws:
PositionedError - if checks fail

createFlowControlContext

public CFlowControlContextType createFlowControlContext(int localVars,
                                                        TokenReference where)

createFlowControlContext

public CFlowControlContextType createFlowControlContext(int localVars,
                                                        boolean isInExternalGF,
                                                        TokenReference where)

getCMethod

public CMethod getCMethod()
Returns the signature of the method declaration in which this context is enclosed, or null if this context is not enclosed in a method declaration.

Specified by:
getCMethod in interface CContextType

getMethodContext

public CMethodContextType getMethodContext()
Returns the nearest surrounding context of type CMethodContextType.

Specified by:
getMethodContext in interface CContextType
Returns:
the nearest parent of type CMethodContextType.

isInInitializer

public boolean isInInitializer()
Indicates whether this context is enclosed in an instance or static initializer.

Specified by:
isInInitializer in interface CContextType

isInConstructor

public boolean isInConstructor()
Indicates whether this context is enclosed in a constructor.

Specified by:
isInConstructor in interface CContextType

isStatic

public boolean isStatic()
Indicates whether this context is "static".

Specified by:
isStatic in interface CContextType
Returns:
true iff this context is enclosed in a context for a static initializer or static method.

isPure

public boolean isPure()
Indicates whether this context is "pure".

Specified by:
isPure in interface CContextType
Returns:
true iff this context is enclosed in a pure method.

addThrowable

public void addThrowable(CThrowableInfo throwable)
Registers that the given throwable can be thrown within this context. The implementation passes the throwable up through the nested contexts until a surrounding context is found that can handle throwables. For example, a CMethodContextType instance collects the throwables that are uncaught within a method body, while a CTryContext collects the throwables that are thrown within a try-block and are therefore subject to handling by associated catch-blocks.

Parameters:
throwable - the type of the new throwable

throwables

public Set throwables()
Returns:
the set of exception that may be thrown

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.