public class ConstructorCall extends ProgramTransformer
new Class(...)
. Thereby it replaces the allocation
expression by a method reference to an implict method called
<init>
that is mainly the constructor but in its
normalform.Modifier and Type | Field and Description |
---|---|
private static String |
CONSTRUCTOR_CALL |
private SchemaVariable |
newObjectSV |
private ProgramVariable |
newObjectVar |
private static String |
NORMALFORM_IDENTIFIER |
Modifier | Constructor and Description |
---|---|
protected |
ConstructorCall(Name name,
SchemaVariable newObjectSV,
ProgramElement consRef)
creates the metaconstruct
|
|
ConstructorCall(ProgramVariable pv,
New n)
Used to programmatically produce this statement.
|
|
ConstructorCall(SchemaVariable newObjectSV,
ProgramElement consRef)
creates the metaconstruct
|
Modifier and Type | Method and Description |
---|---|
protected List<Statement> |
constructorCallSequence(New constructorReference,
KeYJavaType classType,
SVInstantiations svInst,
Services services)
returns a sequence of statements modelling the Java constructor call semantics explicitly
|
ProgramElement |
transform(ProgramElement pe,
Services services,
SVInstantiations svInst)
transforms the constructor's body into its normalform and
returns the result.
|
body, getChildAt, getChildCount, getDimensions, getExpressionAt, getExpressionCount, getKeYJavaType, getKeYJavaType, getKeYJavaType, getLastElement, getName, getPackageReference, getProgramElementName, getReferencePrefix, getStatementAt, getStatementCount, getTypeReferenceAt, getTypeReferenceCount, name, neededInstantiations, needs, prettyPrint, setReferencePrefix, toString, visit
compatibleBlockSize, equals, equalsModRenaming, getArrayPos, hashCode, match, matchChildren
getComments, prettyPrintMain, reuseSignature
getEndPosition, getFirstElement, getFirstElementIncludingBlocks, getParentClass, getPositionInfo, getRelativePosition, getStartPosition, setParentClass, toSource, toString
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
getComments, match
private static final String CONSTRUCTOR_CALL
private static final String NORMALFORM_IDENTIFIER
private final SchemaVariable newObjectSV
private final ProgramVariable newObjectVar
protected ConstructorCall(Name name, SchemaVariable newObjectSV, ProgramElement consRef)
public ConstructorCall(SchemaVariable newObjectSV, ProgramElement consRef)
public ConstructorCall(ProgramVariable pv, New n)
public ProgramElement transform(ProgramElement pe, Services services, SVInstantiations svInst)
newObject.(args);
a statementblock is returned which evaluates the constructor's arguments
and inserts a method body statement rather than the method call which avoids
unneccessary proof branches. As newObject
can never be
null
no null pointer check is necessary.transform
in class ProgramTransformer
pe
- the ProgramElement on which the execution is performedservices
- the Services with all necessary information
about the java programssvInst
- the instantiations of the schemavariablesprotected List<Statement> constructorCallSequence(New constructorReference, KeYJavaType classType, SVInstantiations svInst, Services services)