Browse Source

Remove WeavingAdaptor.couldWeave()

WeavingAdaptor.couldWeave() tested two things: whether this specific
class (by its name) should be excluded from weaving, and whether the
class has generated classes associated with it (in which case we avoid
weaving to avoid re-creating those generated classes). However, if the
class has generated classes associated, couldWeave() is not called at
all because of the new wovenWithGeneratedClass() test, so we have
only the name test which is now called directly.

Relates to #279.
pull/278/head
Uri Simchoni 4 months ago
parent
commit
ae96aff028

+ 1
- 9
weaver/src/main/java/org/aspectj/weaver/tools/WeavingAdaptor.java View File



try { try {
delegateForCurrentClass = null; delegateForCurrentClass = null;
if (couldWeave(name, bytes)) {
if (shouldWeaveName(name)) {
if (accept(name, bytes)) { if (accept(name, bytes)) {


// Determine if we have the weaved class cached // Determine if we have the weaved class cached
} }
} }


/**
* @param name
* @return true if even valid to weave: either with an accept check or to munge it for @AspectJ aspectof support
*/
private boolean couldWeave(String name, byte[] 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. * 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. * This is done instead of weaving again, as weaving would generate another inner class.

Loading…
Cancel
Save