You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

WeaverStateInfo.java 20KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558
  1. /* *******************************************************************
  2. * Copyright (c) 2002 Palo Alto Research Center, Incorporated (PARC).
  3. * All rights reserved.
  4. * This program and the accompanying materials are made available
  5. * under the terms of the Eclipse Public License v1.0
  6. * which accompanies this distribution and is available at
  7. * http://www.eclipse.org/legal/epl-v10.html
  8. *
  9. * Contributors:
  10. * PARC initial implementation
  11. * ******************************************************************/
  12. package org.aspectj.weaver;
  13. import java.io.ByteArrayInputStream;
  14. import java.io.ByteArrayOutputStream;
  15. import java.io.DataInputStream;
  16. import java.io.DataOutputStream;
  17. import java.io.IOException;
  18. import java.util.ArrayList;
  19. import java.util.Collection;
  20. import java.util.Collections;
  21. import java.util.HashSet;
  22. import java.util.List;
  23. import java.util.Set;
  24. import java.util.zip.ZipEntry;
  25. import java.util.zip.ZipInputStream;
  26. import org.aspectj.bridge.IMessage;
  27. import org.aspectj.weaver.AjAttribute.WeaverVersionInfo;
  28. /**
  29. * WeaverStateInfo represents how a type was processed. It is used by the weaver to determine how a type was previously treated and
  30. * whether reweaving is allowed. The format in the data stream is:
  31. *
  32. * Byte: Kind. UNTOUCHED|WOVEN|EXTENDED - If extended it can have two extra bits set 'REWEAVABLE' and 'REWEAVABLE_COMPRESSION_BIT'
  33. * Short: typeMungerCount - how many type mungers have affected this type <UnresolvedType & ResolvedTypeMunger>: The type mungers
  34. * themselves If we are reweavable then we also have: Short: Number of aspects that touched this type in some way when it was
  35. * previously woven <String> The fully qualified name of each type Int: Length of class file data (i.e. the unwovenclassfile)
  36. * Byte[]: The class file data, compressed if REWEAVABLE_COMPRESSION_BIT set.
  37. */
  38. public class WeaverStateInfo {
  39. private List<Entry> typeMungers;
  40. private boolean oldStyle;
  41. private boolean reweavable;
  42. private boolean reweavableCompressedMode; // If true, unwovenClassFile is uncompressed on read
  43. private boolean reweavableDiffMode; // if true, unwovenClassFile is written and read as a diff
  44. // These must exist in the world for reweaving to be valid.
  45. // It is a set of signatures 'La/b/c/D;'
  46. private Set<String> aspectsAffectingType;
  47. private byte[] unwovenClassFile; // Original 'untouched' class file
  48. private static boolean reweavableDefault = true; // ajh02: changed from false;
  49. private static boolean reweavableCompressedModeDefault = false;
  50. private static boolean reweavableDiffModeDefault = true;
  51. // when serializing the WeaverStateInfo we come to adding the reweavable data,
  52. // we'd like to add a diff of the unwovenClassFile and the wovenClassFile,
  53. // but we don't have the wovenClassFile yet as we're still in the process of making it.
  54. // so we put this key there instead as a stub.
  55. // Then when the wovenClassFile has been made, replaceKeyWithDiff is called.
  56. private static byte[] key = { -51, 34, 105, 56, -34, 65, 45, 78, -26, 125, 114, 97, 98, 1, -1, -42 };
  57. private boolean unwovenClassFileIsADiff = false;
  58. int compressionEnabled = 0; // 0=dont know, 1=no, 2=yes
  59. private void checkCompressionEnabled() {
  60. if (compressionEnabled == 0) {
  61. // work it out!
  62. compressionEnabled = 1;
  63. try {
  64. String value = System.getProperty("aspectj.compression.weaverstateinfo", "false");
  65. if (value.equalsIgnoreCase("true")) {
  66. System.out.println("ASPECTJ: aspectj.compression.weaverstateinfo=true: compressing weaverstateinfo");
  67. compressionEnabled = 2;
  68. }
  69. } catch (Throwable t) {
  70. // nop
  71. }
  72. }
  73. }
  74. private WeaverStateInfo() {
  75. // this(new ArrayList(), false,reweavableDefault,reweavableCompressedModeDefault,reweavableDiffModeDefault);
  76. }
  77. public WeaverStateInfo(boolean reweavable) {
  78. this(new ArrayList<Entry>(), false, reweavable, reweavableCompressedModeDefault, reweavableDiffModeDefault);
  79. }
  80. private WeaverStateInfo(List<Entry> typeMungers, boolean oldStyle, boolean reweavableMode, boolean reweavableCompressedMode,
  81. boolean reweavableDiffMode) {
  82. this.typeMungers = typeMungers;
  83. this.oldStyle = oldStyle;
  84. this.reweavable = reweavableMode;
  85. this.reweavableCompressedMode = reweavableCompressedMode;
  86. this.reweavableDiffMode = reweavableMode ? reweavableDiffMode : false;
  87. this.aspectsAffectingType = new HashSet<String>();
  88. this.unwovenClassFile = null;
  89. }
  90. public static void setReweavableModeDefaults(boolean mode, boolean compress, boolean diff) {
  91. reweavableDefault = mode;
  92. reweavableCompressedModeDefault = compress;
  93. reweavableDiffModeDefault = diff;
  94. }
  95. private static final int UNTOUCHED = 0, WOVEN = 2, EXTENDED = 3;
  96. // Use 'bits' for these capabilities - only valid in EXTENDED mode
  97. private static final byte REWEAVABLE_BIT = 1 << 4;
  98. private static final byte REWEAVABLE_COMPRESSION_BIT = 1 << 5;
  99. private static final byte REWEAVABLE_DIFF_BIT = 1 << 6;
  100. /** See comments on write() */
  101. public static final WeaverStateInfo read(VersionedDataInputStream s, ISourceContext context) throws IOException {
  102. byte b = s.readByte();
  103. boolean isReweavable = ((b & REWEAVABLE_BIT) != 0);
  104. if (isReweavable) {
  105. b = (byte) (b - REWEAVABLE_BIT);
  106. }
  107. boolean isReweavableCompressed = ((b & REWEAVABLE_COMPRESSION_BIT) != 0);
  108. if (isReweavableCompressed) {
  109. b = (byte) (b - REWEAVABLE_COMPRESSION_BIT);
  110. }
  111. boolean isReweavableDiff = ((b & REWEAVABLE_DIFF_BIT) != 0);
  112. if (isReweavableDiff) {
  113. b = (byte) (b - REWEAVABLE_DIFF_BIT);
  114. }
  115. switch (b) {
  116. case UNTOUCHED:
  117. throw new RuntimeException("unexpected UNWOVEN");
  118. case WOVEN:
  119. return new WeaverStateInfo(Collections.<Entry>emptyList(), true, isReweavable, isReweavableCompressed, isReweavableDiff);
  120. case EXTENDED:
  121. boolean isCompressed = false;
  122. if (s.isAtLeast169()) {
  123. isCompressed = s.readBoolean();
  124. }
  125. int n = s.readShort();
  126. List<Entry> l = new ArrayList<Entry>();
  127. for (int i = 0; i < n; i++) {
  128. // conditional on version
  129. UnresolvedType aspectType = null;
  130. if (isCompressed) {
  131. int cpIndex = s.readShort();
  132. String signature = s.readUtf8(cpIndex);
  133. if (signature.charAt(0) == '@') { // '@missing@'
  134. aspectType = ResolvedType.MISSING;
  135. } else {
  136. aspectType = UnresolvedType.forSignature(signature);
  137. }
  138. } else {
  139. aspectType = UnresolvedType.read(s);
  140. }
  141. ResolvedTypeMunger typeMunger = ResolvedTypeMunger.read(s, context);
  142. l.add(new Entry(aspectType, typeMunger));
  143. }
  144. WeaverStateInfo wsi = new WeaverStateInfo(l, false, isReweavable, isReweavableCompressed, isReweavableDiff);
  145. readAnyReweavableData(wsi, s, isCompressed);
  146. return wsi;
  147. }
  148. throw new RuntimeException("bad WeaverState.Kind: " + b + ". File was :"
  149. + (context == null ? "unknown" : context.makeSourceLocation(0, 0).toString()));
  150. }
  151. private static class Entry {
  152. public UnresolvedType aspectType;
  153. public ResolvedTypeMunger typeMunger;
  154. public Entry(UnresolvedType aspectType, ResolvedTypeMunger typeMunger) {
  155. this.aspectType = aspectType;
  156. this.typeMunger = typeMunger;
  157. }
  158. public String toString() {
  159. return "<" + aspectType + ", " + typeMunger + ">";
  160. }
  161. }
  162. /**
  163. * Serialize the WeaverStateInfo. Various bits are set within the 'kind' flag to indicate the structure of the attribute. In
  164. * reweavable diff mode a 'marker' is inserted at the start of the attribute to indicate where the final calculated diff should
  165. * be inserted. When the key is replaced with the diff, the 'kind' byte moves to the front of the attribute - thats why in the
  166. * read logic you'll see it expecting the kind as the first byte.
  167. */
  168. public void write(CompressingDataOutputStream s) throws IOException {
  169. checkCompressionEnabled();
  170. if (oldStyle || reweavableCompressedMode) {
  171. throw new RuntimeException("shouldn't be writing this");
  172. }
  173. byte weaverStateInfoKind = EXTENDED;
  174. if (reweavable) {
  175. weaverStateInfoKind |= REWEAVABLE_BIT;
  176. }
  177. if (reweavableDiffMode) {
  178. s.write(key); // put key in so we can replace it with the diff later
  179. weaverStateInfoKind |= REWEAVABLE_DIFF_BIT;
  180. }
  181. s.writeByte(weaverStateInfoKind);
  182. // Tag whether the remainder of the data is subject to cp compression
  183. try {
  184. s.compressionEnabled = compressionEnabled == 2;
  185. s.writeBoolean(s.canCompress());
  186. int n = typeMungers.size();
  187. s.writeShort(n);
  188. for (Entry e : typeMungers) {
  189. if (s.canCompress()) {
  190. s.writeCompressedSignature(e.aspectType.getSignature());
  191. } else {
  192. e.aspectType.write(s);
  193. }
  194. e.typeMunger.write(s);
  195. }
  196. writeAnyReweavableData(this, s, s.canCompress());
  197. } finally {
  198. s.compressionEnabled = true;
  199. }
  200. }
  201. public void addConcreteMunger(ConcreteTypeMunger munger) {
  202. typeMungers.add(new Entry(munger.getAspectType(), munger.getMunger()));
  203. }
  204. public String toString() {
  205. return "WeaverStateInfo(aspectsAffectingType=" + aspectsAffectingType + "," + typeMungers + ", " + oldStyle + ")";
  206. }
  207. public List<ConcreteTypeMunger> getTypeMungers(ResolvedType onType) {
  208. World world = onType.getWorld();
  209. List<ConcreteTypeMunger> ret = new ArrayList<ConcreteTypeMunger>();
  210. for (Entry entry : typeMungers) {
  211. ResolvedType aspectType = world.resolve(entry.aspectType, true);
  212. if (aspectType.isMissing()) {
  213. world.showMessage(IMessage.ERROR, WeaverMessages.format(WeaverMessages.ASPECT_NEEDED, entry.aspectType, onType),
  214. onType.getSourceLocation(), null);
  215. continue;
  216. }
  217. ret.add(new TemporaryTypeMunger(entry.typeMunger, aspectType));
  218. }
  219. return ret;
  220. }
  221. public boolean isOldStyle() {
  222. return oldStyle;
  223. }
  224. public byte[] getUnwovenClassFileData(byte wovenClassFile[]) {
  225. if (unwovenClassFileIsADiff) {
  226. unwovenClassFile = applyDiff(wovenClassFile, unwovenClassFile);
  227. unwovenClassFileIsADiff = false;
  228. }
  229. return unwovenClassFile;
  230. }
  231. public void setUnwovenClassFileData(byte[] data) {
  232. unwovenClassFile = data;
  233. }
  234. public boolean isReweavable() {
  235. return reweavable;
  236. }
  237. public void setReweavable(boolean rw) {
  238. reweavable = rw;
  239. }
  240. public void addAspectsAffectingType(Collection<String> aspects) {
  241. aspectsAffectingType.addAll(aspects);
  242. }
  243. public void addAspectAffectingType(String aspectSignature) {
  244. aspectsAffectingType.add(aspectSignature);
  245. }
  246. public Set<String> getAspectsAffectingType() {
  247. return this.aspectsAffectingType;
  248. }
  249. private static void readAnyReweavableData(WeaverStateInfo wsi, VersionedDataInputStream s, boolean compressed)
  250. throws IOException {
  251. if (wsi.isReweavable()) {
  252. // Load list of aspects that need to exist in the world for reweaving to be 'legal'
  253. int numberAspectsAffectingType = s.readShort();
  254. for (int i = 0; i < numberAspectsAffectingType; i++) {
  255. String str = null;
  256. if (compressed) {
  257. str = s.readSignature();
  258. } else {
  259. str = s.readUTF();
  260. // Prior to 1.6.9 we were writing out names (com.foo.Bar) rather than signatures (Lcom/foo/Bar;)
  261. // From 1.6.9 onwards we write out signatures (pr319431)
  262. if (s.getMajorVersion() < WeaverVersionInfo.WEAVER_VERSION_AJ169) {
  263. // It is a name, make it a signature
  264. StringBuilder sb = new StringBuilder();
  265. sb.append("L").append(str.replace('.', '/')).append(";");
  266. str = sb.toString();
  267. }
  268. }
  269. wsi.addAspectAffectingType(str);
  270. }
  271. int unwovenClassFileSize = s.readInt();
  272. byte[] classData = null;
  273. // the unwovenClassFile may have been compressed:
  274. if (wsi.reweavableCompressedMode) {
  275. classData = new byte[unwovenClassFileSize];
  276. ZipInputStream zis = new ZipInputStream(s);
  277. ZipEntry zen = zis.getNextEntry();
  278. int current = 0;
  279. int bytesToGo = unwovenClassFileSize;
  280. while (bytesToGo > 0) {
  281. int amount = zis.read(classData, current, bytesToGo);
  282. current += amount;
  283. bytesToGo -= amount;
  284. }
  285. zis.closeEntry();
  286. if (bytesToGo != 0) {
  287. throw new IOException("ERROR whilst reading compressed reweavable data, expected " + unwovenClassFileSize
  288. + " bytes, only found " + current);
  289. }
  290. } else {
  291. classData = new byte[unwovenClassFileSize];
  292. int bytesread = s.read(classData);
  293. if (bytesread != unwovenClassFileSize) {
  294. throw new IOException("ERROR whilst reading reweavable data, expected " + unwovenClassFileSize
  295. + " bytes, only found " + bytesread);
  296. }
  297. }
  298. // if it was diffMode we'll have to remember to apply the diff if someone
  299. // asks for the unwovenClassFile
  300. wsi.unwovenClassFileIsADiff = wsi.reweavableDiffMode;
  301. wsi.setUnwovenClassFileData(classData);
  302. }
  303. }
  304. /**
  305. * Here is the cleverness for reweavable diff mode. The class file on disk contains, inside the weaverstateinfo attribute, a
  306. * diff that can be applied to 'itself' to recover the original class - which can then be rewoven.
  307. */
  308. public byte[] replaceKeyWithDiff(byte wovenClassFile[]) {
  309. // we couldn't have made the diff earlier
  310. // as we didn't have the wovenClassFile
  311. // so we left a key there as a marker to come back to
  312. if (reweavableDiffMode) {
  313. ByteArrayOutputStream arrayStream = new ByteArrayOutputStream();
  314. DataOutputStream s = new DataOutputStream(arrayStream);
  315. int endOfKey = findEndOfKey(wovenClassFile);
  316. int startOfKey = endOfKey - key.length;
  317. // the length of the wsi attribute is written infront of it in the classFile,
  318. // swapping the diff for the key will probably change the length of the wsi,
  319. // so we'll have to fiddle with the four 'int length' bytes
  320. int oldLengthLocation = startOfKey - 4;
  321. int oldLength = readInt(wovenClassFile, oldLengthLocation);
  322. wovenClassFile = deleteInArray(wovenClassFile, startOfKey, endOfKey); // delete the key
  323. byte[] wovenClassFileUpToWSI = new byte[oldLengthLocation];
  324. System.arraycopy(wovenClassFile, 0, wovenClassFileUpToWSI, 0, oldLengthLocation);
  325. byte[] diff = generateDiff(wovenClassFileUpToWSI, unwovenClassFile);
  326. try { // put the length of the diff infront of the diff
  327. s.writeInt(diff.length);
  328. s.write(diff);
  329. } catch (IOException e) {
  330. }
  331. diff = arrayStream.toByteArray();
  332. // we have to swap the oldLength for the new one,
  333. // and add the diff, using the oldLength to work out where it should go :)
  334. int newLength = oldLength - key.length + diff.length;
  335. byte newLengthBytes[] = serializeInt(newLength);
  336. // swap in the serialized newLength for the oldOne:
  337. wovenClassFile[oldLengthLocation] = newLengthBytes[0];
  338. wovenClassFile[oldLengthLocation + 1] = newLengthBytes[1];
  339. wovenClassFile[oldLengthLocation + 2] = newLengthBytes[2];
  340. wovenClassFile[oldLengthLocation + 3] = newLengthBytes[3];
  341. // add the diff
  342. wovenClassFile = insertArray(diff, wovenClassFile, oldLengthLocation + 4 + oldLength - key.length);
  343. }
  344. return wovenClassFile;
  345. }
  346. private static final int findEndOfKey(byte[] wovenClassFile) {
  347. // looks through the classfile backwards (as the attributes are all near the end)
  348. for (int i = wovenClassFile.length - 1; i > 0; i--) {
  349. if (endOfKeyHere(wovenClassFile, i)) {
  350. return i + 1;
  351. }
  352. }
  353. throw new RuntimeException("key not found in wovenClassFile"); // should never happen
  354. }
  355. private static final boolean endOfKeyHere(byte lookIn[], int i) {
  356. for (int j = 0; j < key.length; j++) {
  357. if (key[key.length - 1 - j] != lookIn[i - j]) {
  358. return false;
  359. }
  360. }
  361. return true;
  362. }
  363. private static final byte[] insertArray(byte toInsert[], byte original[], int offset) {
  364. byte result[] = new byte[original.length + toInsert.length];
  365. System.arraycopy(original, 0, result, 0, offset);
  366. System.arraycopy(toInsert, 0, result, offset, toInsert.length);
  367. System.arraycopy(original, offset, result, offset + toInsert.length, original.length - offset);
  368. return result;
  369. }
  370. private static final int readInt(byte[] a, int offset) {
  371. ByteArrayInputStream b = new ByteArrayInputStream(a, offset, 4);
  372. DataInputStream d = new DataInputStream(b);
  373. int length = -1;
  374. try {
  375. length = d.readInt();
  376. } catch (IOException e) {
  377. throw (new RuntimeException("readInt called with a bad array or offset")); // should never happen
  378. }
  379. return length;
  380. }
  381. private static final byte[] deleteInArray(byte a[], int start, int end) {
  382. int lengthToDelete = end - start;
  383. byte result[] = new byte[a.length - lengthToDelete]; // make a new array
  384. System.arraycopy(a, 0, result, 0, start); // copy in the bit before the deleted bit
  385. System.arraycopy(a, end, result, start, a.length - end); // copy in the bit after the deleted bit
  386. return result;
  387. }
  388. // ajh02: a quick note about the diff format...
  389. //
  390. // classfiles consist of:
  391. // 8 bytes: magic number and minor and major versions,
  392. // 2 bytes: its constant pool count
  393. // n bytes: the rest of the class file
  394. //
  395. // weaving a classfile never changes the classfile's first 8 bytes,
  396. // and after the constant pool count there's usually a run of bytes that weaving didn't change
  397. // hereafter referred to as the run
  398. //
  399. // so the diff consists of:
  400. // 2 bytes: its constant pool count
  401. // 4 bytes: length of the run
  402. // n bytes: the rest of the unwovenClassFile
  403. byte[] generateDiff(byte[] wovenClassFile, byte[] unWovenClassFile) {
  404. // find how long the run is
  405. int lookingAt = 10;
  406. int shorterLength = (wovenClassFile.length < unWovenClassFile.length) ? wovenClassFile.length : unWovenClassFile.length;
  407. while (lookingAt < shorterLength && (wovenClassFile[lookingAt] == unWovenClassFile[lookingAt])) {
  408. lookingAt++;
  409. }
  410. int lengthInCommon = lookingAt - 10;
  411. byte[] diff = new byte[unWovenClassFile.length - 4 - lengthInCommon];
  412. // first 2 bytes of the diff are the constant pool count
  413. diff[0] = unWovenClassFile[8];
  414. diff[1] = unWovenClassFile[9];
  415. // then 4 bytes saying how long the run is
  416. byte[] lengthInCommonBytes = serializeInt(lengthInCommon);
  417. diff[2] = lengthInCommonBytes[0];
  418. diff[3] = lengthInCommonBytes[1];
  419. diff[4] = lengthInCommonBytes[2];
  420. diff[5] = lengthInCommonBytes[3];
  421. // then we just dump the rest of the unWovenClassFile verbatim
  422. System.arraycopy(unWovenClassFile, 10 + lengthInCommon, diff, 6, diff.length - 6);
  423. return diff;
  424. }
  425. byte[] applyDiff(byte[] wovenClassFile, byte[] diff) {
  426. int lengthInCommon = readInt(diff, 2);
  427. byte[] unWovenClassFile = new byte[4 + diff.length + lengthInCommon];
  428. // copy the first 8 bytes from the wovenClassFile
  429. System.arraycopy(wovenClassFile, 0, unWovenClassFile, 0, 8);
  430. // copy the constant pool count from the diff
  431. unWovenClassFile[8] = diff[0];
  432. unWovenClassFile[9] = diff[1];
  433. // copy the run from the wovenClassFile
  434. System.arraycopy(wovenClassFile, 10, unWovenClassFile, 10, lengthInCommon);
  435. // copy the stuff after the run from the diff
  436. System.arraycopy(diff, 6, unWovenClassFile, 10 + lengthInCommon, diff.length - 6);
  437. return unWovenClassFile;
  438. }
  439. private byte[] serializeInt(int i) {
  440. ByteArrayOutputStream bos = new ByteArrayOutputStream(4);
  441. DataOutputStream dos = new DataOutputStream(bos);
  442. try {
  443. dos.writeInt(i);
  444. } catch (IOException e) {
  445. }
  446. return bos.toByteArray();
  447. }
  448. private static void writeAnyReweavableData(WeaverStateInfo wsi, CompressingDataOutputStream s, boolean compress)
  449. throws IOException {
  450. if (wsi.isReweavable()) {
  451. // Write out list of aspects that must exist next time we try and weave this class
  452. s.writeShort(wsi.aspectsAffectingType.size());
  453. for (String type : wsi.aspectsAffectingType) {
  454. if (compress) {
  455. s.writeCompressedSignature(type);
  456. } else {
  457. s.writeUTF(type);
  458. }
  459. }
  460. byte[] data = wsi.unwovenClassFile;
  461. // if we're not in diffMode, write the unwovenClassFile now,
  462. // otherwise we'll insert it as a diff later
  463. if (!wsi.reweavableDiffMode) {
  464. s.writeInt(data.length);
  465. s.write(wsi.unwovenClassFile);
  466. }
  467. }
  468. }
  469. /**
  470. * @return true if the supplied aspect is already in the list of those affecting this type
  471. */
  472. public boolean isAspectAlreadyApplied(ResolvedType someAspect) {
  473. String someAspectSignature = someAspect.getSignature();
  474. for (String aspectSignature : aspectsAffectingType) {
  475. if (aspectSignature.equals(someAspectSignature)) {
  476. return true;
  477. }
  478. }
  479. return false;
  480. }
  481. }