Klasse WeaverStateInfo

java.lang.Object
org.aspectj.weaver.WeaverStateInfo

public class WeaverStateInfo extends Object
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.
Autor:
Andy Clement
  • Konstruktordetails

    • WeaverStateInfo

      public WeaverStateInfo(boolean reweavable)
  • Methodendetails

    • 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()
      Löst aus:
      IOException
    • write

      public void write(CompressingDataOutputStream s) throws IOException
      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.
      Löst aus:
      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

      public void addConcreteMunger(ConcreteTypeMunger munger)
    • toString

      public String toString()
      Setzt außer Kraft:
      toString in Klasse Object
    • getTypeMungers

      public List<ConcreteTypeMunger> getTypeMungers(ResolvedType onType)
    • 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

      public void addAspectsAffectingType(Collection<String> aspects)
    • addAspectAffectingType

      public void addAspectAffectingType(String aspectSignature)
    • getAspectsAffectingType

      public Set<String> 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

      public boolean isAspectAlreadyApplied(ResolvedType someAspect)
      Gibt zurück:
      true if the supplied aspect is already in the list of those affecting this type