|
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.util.compiler.Phylum
org.multijava.mjc.JPhylum
org.multijava.mjc.JExpression
org.multijava.mjc.JNewObjectExpression
This class represents an object instantiation expression 'new type(...)'
| Nested Class Summary | |
protected static class |
JNewObjectExpression.ArgTypes
This nested class is used to track the argument types of the actual constructor call. |
| Field Summary | |
protected CMethod |
constructor
The specific constructor that is called in this object instantiation expression. |
protected JExpression |
explicitThis
The primary expression qualifying this class instance creation expression, or null if this is an unqualified class instance creation expression. |
protected CClass |
hostClass
A reference to the host class of this expression. |
private String |
originalTypeName
Stores the actual text following the new and
preceding the parameters. |
protected JExpression |
outerThisParam
Stores the expression to generate a possible synthetic outer this parameter to the constructor call. |
protected CClass |
owner
A reference to the logical owner of this expression. |
protected JExpression[] |
params
The expressions that, when evaluated, yield the actual parameters for the constructor invocation. |
private JMethodCallExpression |
setAnonymousOwner
|
private JMethodCallExpression |
setConstructorData
|
private JMethodCallExpression |
setOwner
|
private JLocalVariable |
tmpLocalVar
|
protected CClassType |
type
The type of object instantiated by this expression. |
| Fields inherited from class org.multijava.mjc.JExpression |
EMPTY |
| Fields inherited from class org.multijava.util.compiler.Phylum |
|
| Fields inherited from class org.multijava.util.Utils |
DBG_LEVEL_HIGH, DBG_LEVEL_LOW, DBG_LEVEL_NO |
| Constructor Summary | |
JNewObjectExpression(TokenReference where,
CClassType objectType,
JExpression explicitThis,
JExpression[] params)
Construct a node in the parsing tree. |
|
| Method Summary | |
void |
accept(MjcVisitor p)
Accepts the specified visitor |
private static JMethodCallExpression[] |
buildNewObjectUniverseDynChecks(CExpressionContextType context,
CClassType type,
JExpression var)
Creates the expressions for the dynamic universe typechecks. |
void |
buildUniverseDynChecks(CExpressionContextType context,
JExpression var)
Creates the expressions for the dynamic universe typechecks. |
protected JExpression |
checkCall(CExpressionContextType context,
JNewObjectExpression.ArgTypes argTypes)
Typechecks the invocation of the actual constructor of the object instantiated. |
private void |
checkForUncheckedWarnings(JNewObjectExpression.ArgTypes argTypes,
CExpressionContextType context)
Issues unchecked warnings for the actual parameters which need unchecked conversion (JLS3 5.1.9) to conform to their corresponding formal parameters. |
protected JNewObjectExpression.ArgTypes |
checkTypes(CExpressionContextType context)
Resolves and checks the types of the actual parameters to the constructor. |
CMethod |
constructor()
Returns the specific constructor by this object nstantiation expression. |
void |
genCode(CodeSequence code)
Generates a sequence of bytecodes |
void |
genUniverseDynCheckCode(CodeSequence code)
Generate the code for the dynamic universe typechecks. |
CType |
getType()
Returns the type of this expression (called after parsing). |
boolean |
isStatementExpression()
Returns true iff this expression can be used as a statement (JLS 14.7) |
String |
originalTypeName()
Returns the actual text following the "new" and preceding the parameters. |
JExpression[] |
params()
|
JExpression |
thisExpr()
Returns the JExpression that is the explicit-this portion of the new Object construct. |
JExpression |
typecheck(CExpressionContextType context)
Typechecks the expression and mutates the context to record information gathered during typechecking. |
| Methods inherited from class org.multijava.mjc.JExpression |
clone, convertType, dumpArray, fail, genBranch, getApparentType, getBooleanLiteral, getFANonNulls, getFANulls, getLiteral, getNumberLiteral, getOrdinalLiteral, getRealLiteral, getStringLiteral, isAssignableTo, isBooleanLiteral, isConstant, isDeclaredNonNull, isLiteral, isMaybeInitializable, isNonNull, isOrdinalLiteral, isRealLiteral, isStringLiteral, typecheck, unParenthesize |
| Methods inherited from class org.multijava.mjc.JPhylum |
check, check, check, check, fail, fail, warn, warn, warn, warn |
| Methods inherited from class org.multijava.util.compiler.Phylum |
getTokenReference, setTokenReference |
| 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 |
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
protected JExpression explicitThis
protected JExpression[] params
protected CClassType type
explicitThis is considered and when the
declaration AST for an anonymous classes is defined.
explicitThis,
JNewAnonymousClassExpressionprotected CClass hostClass
protected CClass owner
protected CMethod constructor
private final String originalTypeName
new and
preceding the parameters.
protected JExpression outerThisParam
private JMethodCallExpression setOwner
private JMethodCallExpression setConstructorData
private JLocalVariable tmpLocalVar
private JMethodCallExpression setAnonymousOwner
| Constructor Detail |
public JNewObjectExpression(TokenReference where,
CClassType objectType,
JExpression explicitThis,
JExpression[] params)
ensures typeState == IS_PARSER_GUESS;
where - the line of this node in the source codeobjectType - the type of this object to be instantiated,
initially just the parser's best guessexplicitThis - a Primary expression (i.e., an explicit
outer class for the instantiation of an
inner class)params - parameters to be passed to constructor| Method Detail |
public JExpression[] params()
public CType getType()
public boolean isStatementExpression()
isStatementExpression in class JExpressionpublic JExpression thisExpr()
public String originalTypeName()
public CMethod constructor()
public JExpression typecheck(CExpressionContextType context)
throws PositionedError
also requires typeState == IS_PARSER_GUESS; ensures typeState == IS_ACTUAL;
context - the context in which this expression appears
JExpression.typecheck())
PositionedError - if the check fails JExpression.typecheck(CExpressionContextType)
protected JNewObjectExpression.ArgTypes checkTypes(CExpressionContextType context)
throws PositionedError
requires typeState == IS_NON_ANON_TYPE;
context - the context in which this expression occurs
PositionedError - if the checks fail
protected JExpression checkCall(CExpressionContextType context,
JNewObjectExpression.ArgTypes argTypes)
throws PositionedError
requires typeState == IS_ACTUAL;
context - the context in which this expression appearsargTypes - the types of the arguments to the constructor of
type, including any synthetic outer
this parameters
PositionedError
private void checkForUncheckedWarnings(JNewObjectExpression.ArgTypes argTypes,
CExpressionContextType context)
throws PositionedError
argTypes - The actual arguments of this constructor call.context - The type checking context.
PositionedError - if some error occurs during type checking.public void accept(MjcVisitor p)
p - the visitorpublic void genCode(CodeSequence code)
code - the code list
public void buildUniverseDynChecks(CExpressionContextType context,
JExpression var)
throws PositionedError
buildUniverseDynChecks in class JExpressioncontext - context used to typecheck the expressions createdvar - the variable where the new object is found
PositionedError - By scdaniel.
private static JMethodCallExpression[] buildNewObjectUniverseDynChecks(CExpressionContextType context,
CClassType type,
JExpression var)
throws PositionedError
context - context used to typecheck the expressions createdvar - the variable where the new object is found
PositionedError - By scdaniel.public void genUniverseDynCheckCode(CodeSequence code)
genUniverseDynCheckCode in class JExpressioncode - the CodeSequence for the codegeneration
By scdaniel.
|
JML | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||