Package org.aspectj.weaver
Class WeaverStateInfo
java.lang.Object
org.aspectj.weaver.WeaverStateInfo
WeaverStateInfo represents how a type was processed. It is used by the weaver to determine how a type was previously treated and
whether reweaving is allowed. The format in the data stream is:
Byte: Kind. UNTOUCHED|WOVEN|EXTENDED - If extended it can have two extra bits set 'REWEAVABLE' and 'REWEAVABLE_COMPRESSION_BIT'
Short: typeMungerCount - how many type mungers have affected this type <UnresolvedType & ResolvedTypeMunger>: The type mungers
themselves If we are reweavable then we also have: Short: Number of aspects that touched this type in some way when it was
previously woven <String> The fully qualified name of each type Int: Length of class file data (i.e. the unwovenclassfile)
Byte[]: The class file data, compressed if REWEAVABLE_COMPRESSION_BIT set.
- Author:
- Andy Clement
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addAspectAffectingType
(String aspectSignature) void
addAspectsAffectingType
(Collection<String> aspects) void
addConcreteMunger
(ConcreteTypeMunger munger) getTypeMungers
(ResolvedType onType) byte[]
byte[]
getUnwovenClassFileData
(byte[] wovenClassFile) boolean
isAspectAlreadyApplied
(ResolvedType someAspect) boolean
boolean
void
If the weaver is ever invoked in over weaving mode, we should not include the key when writing out, it won't be replaced later.static final WeaverStateInfo
read
(VersionedDataInputStream s, ISourceContext context) See comments on write()byte[]
replaceKeyWithDiff
(byte[] wovenClassFile) Here is the cleverness for reweavable diff mode.void
setReweavable
(boolean rw) static void
setReweavableModeDefaults
(boolean mode, boolean compress, boolean diff) void
setUnwovenClassFileData
(byte[] data) toString()
void
Serialize the WeaverStateInfo.
-
Constructor Details
-
WeaverStateInfo
public WeaverStateInfo(boolean reweavable)
-
-
Method Details
-
setReweavableModeDefaults
public static void setReweavableModeDefaults(boolean mode, boolean compress, boolean diff) -
read
public static final WeaverStateInfo read(VersionedDataInputStream s, ISourceContext context) throws IOException See comments on write()- Throws:
IOException
-
write
Serialize the WeaverStateInfo. Various bits are set within the 'kind' flag to indicate the structure of the attribute. In reweavable diff mode a 'marker' is inserted at the start of the attribute to indicate where the final calculated diff should be inserted. When the key is replaced with the diff, the 'kind' byte moves to the front of the attribute - thats why in the read logic you'll see it expecting the kind as the first byte.- Throws:
IOException
-
markOverweavingInUse
public void markOverweavingInUse()If the weaver is ever invoked in over weaving mode, we should not include the key when writing out, it won't be replaced later. If we turn off the reweaving flag that unfortunately removes the 'what aspects have been woven into this type' list which we want to keep as it helps overweaving avoid weaving an aspect in twice. -
addConcreteMunger
-
toString
-
getTypeMungers
-
isOldStyle
public boolean isOldStyle() -
getUnwovenClassFileData
public byte[] getUnwovenClassFileData() -
getUnwovenClassFileData
public byte[] getUnwovenClassFileData(byte[] wovenClassFile) -
setUnwovenClassFileData
public void setUnwovenClassFileData(byte[] data) -
isReweavable
public boolean isReweavable() -
setReweavable
public void setReweavable(boolean rw) -
addAspectsAffectingType
-
addAspectAffectingType
-
getAspectsAffectingType
-
replaceKeyWithDiff
public byte[] replaceKeyWithDiff(byte[] wovenClassFile) Here is the cleverness for reweavable diff mode. The class file on disk contains, inside the weaverstateinfo attribute, a diff that can be applied to 'itself' to recover the original class - which can then be rewoven. -
isAspectAlreadyApplied
- Returns:
- true if the supplied aspect is already in the list of those affecting this type
-