Jode 1.90-CVS
Build Aug 6, 2004

net.sf.jode.flow
Class TransformConstructors

java.lang.Object
  extended bynet.sf.jode.flow.TransformConstructors

public class TransformConstructors
extends java.lang.Object

This class will transform the constructors. We differ three types of constructors:

type0
are constructors, that call no constructors or whose default super call was already removed. java.lang.Object.<init> and static constructors are examples for the first kind.
type1
are constructors, that call the constructor of super class
type2
are constructors, that call another constructor of the same class
The transformation involves several steps: The first step is done by removeSynthInitializers, which does the following:
In the last analyze phase (makeDeclaration) the rest is done: It will make use of the outerValues expression, that tell which parameters (this and final method variables) are always given to the constructor. You can debug this class with the --debug=constructors switch.

Author:
Jochen Hoenicke
See Also:
FieldAnalyzer.setInitializer(net.sf.jode.expr.Expression), ClassAnalyzer.getOuterValues()

Constructor Summary
TransformConstructors(ClassAnalyzer clazzAnalyzer, boolean isStatic, MethodAnalyzer[] cons)
           
 
Method Summary
static boolean isThis(Expression thisExpr, ClassInfo clazz)
           
 void removeSynthInitializers()
          Remove initializers of synthetic fields and This is called for non static constructors in the analyze pass, after the constructors are analyzed.
 void transform()
          This does the normal constructor transformations.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TransformConstructors

public TransformConstructors(ClassAnalyzer clazzAnalyzer,
                             boolean isStatic,
                             MethodAnalyzer[] cons)
Method Detail

isThis

public static boolean isThis(Expression thisExpr,
                             ClassInfo clazz)

removeSynthInitializers

public void removeSynthInitializers()
Remove initializers of synthetic fields and This is called for non static constructors in the analyze pass, after the constructors are analyzed.


transform

public void transform()
This does the normal constructor transformations. javac copies the field initializers to each constructor. This will undo the transformation: it will tell the fields about the initial value and removes the initialization from all constructors. There are of course many checks necessary: All field initializers must be equal in all constructors, and there mustn't be locals that used in field initialization (except outerValue - locals).


Jode 1.90-CVS
Build Aug 6, 2004

Copyright © 1998-2004 by Jochen Hoenicke.