|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectkorat.instrumentation.AbstractInstrumenter
korat.instrumentation.SpecialConstructorInstrumenter
class SpecialConstructorInstrumenter
This instrumenter equips the given class with a special field
of ITester
type and a special constructor that takes
one parameter of type ITester
to initialize that
special field. Classes under test need this field since it holds
an instance to be notified about field accesses.
AbstractInstrumenter
,
FieldInstrumenter
,
ArrayFieldInstrumenter
Field Summary |
---|
Fields inherited from class korat.instrumentation.AbstractInstrumenter |
---|
cp |
Constructor Summary | |
---|---|
SpecialConstructorInstrumenter()
|
Method Summary | |
---|---|
protected void |
addConstructors(CtClass clz)
Adds needed constructors to class under test First, if doesn't exist, no-arg constructor is added with empty body. |
protected void |
addITesterField(CtClass clz)
Adds ITester field that holds an instance of the ITester
class that should be notified about field accesses. |
private void |
addKoratConstructor(CtClass clz)
Adds a special constructor that Korat will call to initialize object under test. |
protected void |
addNoArgConstr(CtClass clz)
Adds no-arg constructor with empty body. |
protected void |
instrument(CtClass clz)
|
Methods inherited from class korat.instrumentation.AbstractInstrumenter |
---|
getBytecode, shouldProcessField, shouldProcessMethod |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
SpecialConstructorInstrumenter()
Method Detail |
---|
protected void instrument(CtClass clz) throws CannotCompileException, NotFoundException, IOException
instrument
in class AbstractInstrumenter
CannotCompileException
NotFoundException
IOException
protected void addITesterField(CtClass clz) throws NotFoundException, CannotCompileException
ITester
field that holds an instance of the ITester
class that should be notified about field accesses. This field gets initialized
in the korat-special constructor.
clz
-
NotFoundException
CannotCompileException
protected void addConstructors(CtClass clz) throws NotFoundException, CannotCompileException
Adds needed constructors to class under test
First, if doesn't exist, no-arg constructor is added with empty body.
Then, special constructor with one parameter of ITester
type is added. That constructor is used by Korat to initialize class
under test passing it the instance of the ITester
interface. Class under test will store that instance in its own field
because that instance will be notified about every field access later on
(calling the notifyFieldAccess
method).
clz
-
NotFoundException
CannotCompileException
protected void addNoArgConstr(CtClass clz) throws CannotCompileException
clz
-
CannotCompileException
private void addKoratConstructor(CtClass clz) throws NotFoundException, CannotCompileException
ITester
field.
clz
-
NotFoundException
CannotCompileException
addITesterField(CtClass)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |