boolean debugOn = !messageHandler.isIgnoring(Message.DEBUG);
+ name = name.replace('/', '.');
+ byte[] wovenBytes = wovenWithGeneratedClass(name);
+ if (wovenBytes != null) {
+ if (debugOn) {
+ debug("returning woven bytes for '" + name + "' that were generated by a previous weaving process");
+ }
+ return wovenBytes;
+ }
+
try {
delegateForCurrentClass = null;
- name = name.replace('/', '.');
if (couldWeave(name, bytes)) {
if (accept(name, bytes)) {
return !generatedClasses.containsKey(name) && shouldWeaveName(name);
}
+ /**
+ * Return the bytes from a (parallel?) weaving process that generated an inner class, e.g. to support Around closures.
+ * This is done instead of weaving again, as weaving would generate another inner class.
+ * @param name
+ * @return the cached bytes of a previously woven class, or null if not found
+ */
+ private byte[] wovenWithGeneratedClass(String name) {
+ IUnwovenClassFile woven = generatedClasses.get(name);
+ if (woven == null) {
+ return null;
+ }
+
+ return woven.getBytes();
+ }
+
// ATAJ
protected boolean accept(String name, byte[] bytes) {
return true;