|
JML | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectorg.multijava.util.Utils
org.multijava.mjc.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.
It was factored out of CMember so it could more easily be
extended by JML classes without having to repeat code
over several subclasses. It has the interface checking code for
ensuring that modifiers are valid for the member containing it,
e.g., class, field, and method signature classes.
The modifier checking code was factored out of
JTypeDeclaration, JFieldDeclaration, and
JMethodDeclaration rather than using callbacks so
the modifier checking could all be done in one class.
Callbacks are used in some of the accessibility computations.
CMember| Field Summary | |
protected CMemberHost |
host
Denotes the context in which this member is declared. |
protected CCompilationUnit |
hostCompilationUnit
Stores a cached copy of the result of getCCompilationUnit. |
protected static long |
interfaceFieldModifiers
|
protected static long |
interfaceMethodModifiers
|
protected static long |
invalidAbstractMethodModifiers
|
protected static long |
invalidClassModifiers
|
protected static long |
invalidFieldModifiers
|
protected static long |
invalidMethodModifiers
|
protected long |
modifiers
Subclasses may need to modify this field to hack around the problem of privileged access to private methods/fields from an enclosing/inner class. |
protected CClass |
owner
Denotes the class in which this member appears logically. |
| Fields inherited from class org.multijava.util.Utils |
DBG_LEVEL_HIGH, DBG_LEVEL_LOW, DBG_LEVEL_NO |
| Constructor Summary | |
MemberAccess(CClass owner,
long modifiers)
Constructs a member export |
|
MemberAccess(CClass owner,
CMemberHost host,
long modifiers)
Constructs a top-level member export |
|
| Method Summary | |
void |
checkAccessModifiers(CContextType context,
JMemberDeclaration member)
Check illegal combinations of modifiers common to classes, interfaces, fields, and methods. |
void |
checkClassModifiers(CContextType context,
JTypeDeclaration member)
Check for illegal combinations of modifiers disallowed in classes and interfaces. |
void |
checkExternalMethodModifiers(CContextType context,
JMethodDeclaration member)
Check for illegal combinations of modifiers disallowed in external method declarations. |
void |
checkFieldModifiers(CContextType context,
JFieldDeclaration member)
Check for illegal combinations of modifiers disallowed in field declarations. |
long |
checkInterfaceFieldModifiers(CContextType context,
JFieldDeclaration member)
Check for illegal combinations of modifiers disallowed in interface field declarations. |
long |
checkInterfaceMethodModifiers(CContextType context,
JMethodDeclaration member)
Check for illegal combinations of modifiers disallowed in interface method declarations. |
void |
checkMethodModifiers(CContextType context,
JMethodDeclaration member)
Check for illegal combinations of modifiers disallowed in method declarations. |
CCompilationUnit |
getCCompilationUnit()
Returns the compilation unit that hosts this member. |
String |
getOwnerName()
|
boolean |
hasDefaultAccess()
|
CMemberHost |
host()
Returns the host of this member's declaration, which is the same value returned by owner() unless this is a
top-level declaration. |
boolean |
isAbstract()
A member is abstract if it is annotated with the abstract modifier. |
boolean |
isExternalMethod()
Used to determine whether a method is external, i.e., whether its host is different than its logical owner. |
boolean |
isFinal()
A member is final if it is annotated with the final modifier. |
boolean |
isInterface()
Returns true iff this member is an interface. |
boolean |
isMemberVisibleIn(CMember member,
CMemberHost from)
Indicates whether this is accessible from the given host. |
boolean |
isNative()
A member is native if it is annotated with the native modifier. |
boolean |
isPrivate()
A member is private if it is annotated with the private modifier. |
boolean |
isProtected()
A member is protected if it is annotated with the protected modifier. |
boolean |
isPublic()
A member is public if it is annotated with the public modifier. |
boolean |
isPure()
A member is pure if it is annotated with the pure modifier. |
boolean |
isStatic()
A member is static if it is annotated with the static modifier. |
boolean |
isStrictFP()
A member is strictfp if it is annotated with the strictfp modifier. |
boolean |
isSynchronized()
A member is synchronized if it is annotated with the synchronized modifier. |
boolean |
isTransient()
A member is transient if it is annotated with the transient modifier. |
boolean |
isVolatile()
A member is volatile if it is annotated with the volatile modifier. |
long |
modifiers()
|
CClass |
owner()
Returns the owner of this member or null if this is a top-level class declaration. |
void |
removeAbstractModifier()
Removes the 'abstract' modifier when necessary. |
void |
removeFinalModifier()
Removes the 'final' modifier when necessary. |
void |
removePrivateModifier()
Removes the 'private' modifier when necessary. |
void |
removeStaticModifier()
Removes the 'static' modifier when necessary. |
void |
setModifiers(long modifiers)
Sets the modifiers of this member |
protected void |
setOwner(CClass owner)
Sets the owner of this member. |
| Methods inherited from class org.multijava.util.Utils |
assertTrue, assertTrue, combineArrays, escapeString, escapeString, fail, fail, getFilePath, hasFlag, hasOtherFlags, parsePathParts, relativePathTo, splitQualifiedName, splitQualifiedName, stripJavaModifiers, stripNonJavaModifiers, stripPrivateModifier, unescapeString, vectorToArray, vectorToIntArray |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
protected CClass owner
protected final CMemberHost host
owner. For top-level
declarations it is the compilation unit in which the member is
declared.
protected long modifiers
protected CCompilationUnit hostCompilationUnit
getCCompilationUnit()protected static final long invalidClassModifiers
protected static final long invalidFieldModifiers
protected static final long invalidMethodModifiers
protected static final long invalidAbstractMethodModifiers
protected static final long interfaceFieldModifiers
protected static final long interfaceMethodModifiers
| Constructor Detail |
public MemberAccess(CClass owner,
long modifiers)
owner - the owner of this membermodifiers - the modifiers on this member
public MemberAccess(CClass owner,
CMemberHost host,
long modifiers)
owner - the owner of this memberhost - the host of this member's declarationmodifiers - the modifiers on this member| Method Detail |
public CClass owner()
protected void setOwner(CClass owner)
ownerpublic CMemberHost host()
owner() unless this is a
top-level declaration.
public String getOwnerName()
public long modifiers()
public void setModifiers(long modifiers)
public boolean isStatic()
static modifier.
public boolean isPure()
pure modifier.
By WMD.
public boolean isAbstract()
abstract modifier.
public boolean isPublic()
public modifier.
public boolean isProtected()
protected modifier.
public boolean isPrivate()
private modifier.
public boolean hasDefaultAccess()
public boolean isFinal()
final modifier.
public boolean isSynchronized()
synchronized modifier.
public boolean isTransient()
transient modifier.
public boolean isVolatile()
volatile modifier.
public boolean isNative()
native modifier.
public boolean isStrictFP()
strictfp modifier.
public boolean isInterface()
public boolean isMemberVisibleIn(CMember member,
CMemberHost from)
member - the member that needs to be accessedfrom - the host that wants to access member
public CCompilationUnit getCCompilationUnit()
public boolean isExternalMethod()
public void removePrivateModifier()
public void removeStaticModifier()
public void removeFinalModifier()
public void removeAbstractModifier()
public void checkAccessModifiers(CContextType context,
JMemberDeclaration member)
throws PositionedError
PositionedError
public void checkClassModifiers(CContextType context,
JTypeDeclaration member)
throws PositionedError
PositionedError
public void checkFieldModifiers(CContextType context,
JFieldDeclaration member)
throws PositionedError
PositionedError
public long checkInterfaceFieldModifiers(CContextType context,
JFieldDeclaration member)
throws PositionedError
PositionedError
public void checkMethodModifiers(CContextType context,
JMethodDeclaration member)
throws PositionedError
PositionedError
public void checkExternalMethodModifiers(CContextType context,
JMethodDeclaration member)
throws PositionedError
PositionedError
public long checkInterfaceMethodModifiers(CContextType context,
JMethodDeclaration member)
throws PositionedError
PositionedError
|
JML | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||