public class ConstructorNormalformBuilder extends RecoderModelTransformer
<init>. The visibility of
the normalform is the same as for the original constructor.
RecoderModelTransformer.FinalOuterVarsCollector, RecoderModelTransformer.TransformerCache
Modifier and Type | Field and Description |
---|---|
private java.util.HashMap<ClassDeclaration,java.util.List<Constructor>> |
class2constructors |
private java.util.HashMap<ClassDeclaration,ClassDeclaration> |
class2enclosingClass |
private java.util.HashMap<ClassDeclaration,Field> |
class2enclosingThis |
private java.util.HashMap<ClassDeclaration,Identifier> |
class2identifier |
private java.util.HashMap<ClassDeclaration,ASTList<Statement>> |
class2initializers |
private java.util.HashMap<ClassDeclaration,ASTList<MethodDeclaration>> |
class2methodDeclaration |
private java.util.HashMap<ClassDeclaration,ClassType> |
class2superContainer |
static java.lang.String |
CONSTRUCTOR_NORMALFORM_IDENTIFIER |
private ClassType |
javaLangObject |
static java.lang.String |
OBJECT_INITIALIZER_IDENTIFIER |
private java.util.HashMap<Variable,Type> |
v2t |
cache, services
EQUIVALENCE, IDENTITY, NO_PROBLEM
Constructor and Description |
---|
ConstructorNormalformBuilder(CrossReferenceServiceConfiguration services,
RecoderModelTransformer.TransformerCache cache)
creates the constructor normalform builder
|
Modifier and Type | Method and Description |
---|---|
ProblemReport |
analyze()
Two-pass transformation have to be strictly divided up into two
parts. the first part analyzes the model and collects all
necessary information.
|
private ConstructorDeclaration |
attachConstructorDecl(TypeDeclaration td) |
private void |
attachDefaultConstructor(ClassDeclaration cd) |
private ASTList<Statement> |
collectInitializers(ClassDeclaration cd)
The list of statements is the smallest list that contains a copy
assignment for each instance field initializer of class cd,
e.g.
|
protected Field |
getImplicitEnclosingThis(ClassDeclaration cd) |
protected void |
makeExplicit(TypeDeclaration td)
entry method for the constructor normalform builder
|
private MethodDeclaration |
normalform(ClassDeclaration cd,
Constructor cons)
Creates the normalform of the given constructor, that is declared
in class cd.
|
assign, attach, attribute, classDeclarations, containingClass, containingMethod, declare, declare, getAllSupertypes, getDefaultValue, getId, getLocalClass2FinalVar, getUnits, isVisible, makeExplicit, transform
execute
attach, attach, attach, attach, attach, attach, attach, attach, attach, attach, attach, attach, attach, attach, attach, attach, attach, attach, attach, attach, attach, attach, attach, attach, attach, attach, attach, attach, attach, attach, attach, attach, attach, attach, attach, attach, attach, attach, attach, attach, attach, attach, attach, attach, attach, attach, attach, attach, attach, attach, attachAsArgument, attachAsArgument, attachAsArgument, attachAsArgument, attachAsArgument, attachAsArgument, attachAsArgument, attachAsArgument, attachAsBody, attachAsCondition, attachAsGuard, attachAsInitializer, attachAsLabel, attachAsMessage, attachAsPrefix, attachAsPrefix, attachAsPrefix, attachAsPrefix, attachAsUpdate, detach, doAttach, doAttach, doAttach, doAttach, doAttach, doAttach, doAttach, doAttach, doAttach, doAttach, doAttach, doAttach, doAttach, doAttach, doAttach, doAttach, doAttach, doAttach, doAttach, doAttach, doAttach, doAttach, doAttach, doAttach, doAttach, doAttach, doAttach, doAttach, doAttach, doAttach, doAttach, doAttach, doAttach, doAttach, doAttach, doAttach, doAttach, doAttach, doAttach, doAttach, doAttach, doAttach, doAttach, doAttach, doAttach, doAttach, doAttach, doAttach, doAttach, doAttach, doAttach, doAttach, doAttach, doAttach, doAttach, doAttach, doAttachAsArgument, doAttachAsArgument, doAttachAsArgument, doAttachAsArgument, doAttachAsArgument, doAttachAsArgument, doAttachAsArgument, doAttachAsArgument, doAttachAsArgument, doAttachAsBody, doAttachAsCondition, doAttachAsGuard, doAttachAsInitializer, doAttachAsLabel, doAttachAsMessage, doAttachAsPrefix, doAttachAsPrefix, doAttachAsPrefix, doAttachAsPrefix, doAttachAsUpdate, doDetach, doReplace, getChangeHistory, getCrossReferenceSourceInfo, getNameInfo, getProblemReport, getProgramFactory, getServiceConfiguration, getSourceFileRepository, getSourceInfo, replace, rollback, setProblemReport, setServiceConfiguration, toString
public static final java.lang.String CONSTRUCTOR_NORMALFORM_IDENTIFIER
public static final java.lang.String OBJECT_INITIALIZER_IDENTIFIER
private java.util.HashMap<ClassDeclaration,java.util.List<Constructor>> class2constructors
private java.util.HashMap<ClassDeclaration,Field> class2enclosingThis
private java.util.HashMap<ClassDeclaration,ClassDeclaration> class2enclosingClass
private java.util.HashMap<ClassDeclaration,ASTList<Statement>> class2initializers
private java.util.HashMap<ClassDeclaration,Identifier> class2identifier
private java.util.HashMap<ClassDeclaration,ASTList<MethodDeclaration>> class2methodDeclaration
private java.util.HashMap<ClassDeclaration,ClassType> class2superContainer
private ClassType javaLangObject
public ConstructorNormalformBuilder(CrossReferenceServiceConfiguration services, RecoderModelTransformer.TransformerCache cache)
private ASTList<Statement> collectInitializers(ClassDeclaration cd)
i = 0;
for public int i = 0;
or
a reference to the private method
<objectInitializer>i refering to the i-th object
initializer of cd. These private declared methods are created on
the fly. Example for
class C {
int i = 0;
{
int j = 3;
i = j + 5;
}
public C () {} ...
}
the following list of size two is returned
[ i = 0;, <objectInitializer>0(); ]
where
private <objectInitializer>0() {
int j = 3;
i = j + 5;
}
cd
- the ClassDeclaration of which the initilizers have to
be collectedpublic ProblemReport analyze()
analyze
in class TwoPassTransformation
protected Field getImplicitEnclosingThis(ClassDeclaration cd)
private void attachDefaultConstructor(ClassDeclaration cd)
private MethodDeclaration normalform(ClassDeclaration cd, Constructor cons)
cd
- the ClassDeclaration where the cons is declaredcons
- the Constructor to be transformedprivate ConstructorDeclaration attachConstructorDecl(TypeDeclaration td)
protected void makeExplicit(TypeDeclaration td)
makeExplicit
in class RecoderModelTransformer
td
- the TypeDeclaration