From be8377c9526eadafbc10a11306580451ee799452 Mon Sep 17 00:00:00 2001 From: Martin Lippert Date: Thu, 26 Apr 2012 12:12:07 +0200 Subject: added some missing doc for OSGiWeavingAdaptor --- .../aspectj/loadtime/OSGiWeavingAdaptor.java | 30 +++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/bundles/org.eclipse.equinox.weaving.aspectj/src/org/eclipse/equinox/weaving/aspectj/loadtime/OSGiWeavingAdaptor.java b/bundles/org.eclipse.equinox.weaving.aspectj/src/org/eclipse/equinox/weaving/aspectj/loadtime/OSGiWeavingAdaptor.java index 03c013636..6dcff7fc8 100644 --- a/bundles/org.eclipse.equinox.weaving.aspectj/src/org/eclipse/equinox/weaving/aspectj/loadtime/OSGiWeavingAdaptor.java +++ b/bundles/org.eclipse.equinox.weaving.aspectj/src/org/eclipse/equinox/weaving/aspectj/loadtime/OSGiWeavingAdaptor.java @@ -41,6 +41,16 @@ public class OSGiWeavingAdaptor extends ClassLoaderWeavingAdaptor { private final OSGiWeavingContext weavingContext; + /** + * The OSGi weaving adaptor provides a bridge to the AspectJ weaving adaptor + * implementation for general classloaders. This weaving adaptor exists per + * bundle that should be woven. + * + * @param loader The classloader of the bundle to be woven + * @param context The bridge to the weaving context + * @param namespace The namespace of this adaptor, some kind of unique ID + * for this weaver + */ public OSGiWeavingAdaptor(final ClassLoader loader, final OSGiWeavingContext context, final String namespace) { super(); @@ -49,6 +59,19 @@ public class OSGiWeavingAdaptor extends ClassLoaderWeavingAdaptor { this.namespace = namespace; } + /** + * In some situations the weaving creates new classes on the fly that are + * not part of the original bundle. This is the case when the weaver needs + * to create closure-like constructs for the woven code. + * + * This method returns a map of the generated classes (name -> bytecode) and + * flushes the internal cache afterwards to avoid memory damage over time. + * + * @param className The name of the class for which additional classes might + * got generated + * @return the map of generated class names and bytecodes for those + * generated classes + */ public Map getGeneratedClassesFor(final String className) { final Map generated = this.generatedClasses; final Map result = new HashMap(); @@ -76,6 +99,9 @@ public class OSGiWeavingAdaptor extends ClassLoaderWeavingAdaptor { return namespace; } + /** + * initialize the weaving adaptor + */ public void initialize() { if (!initializing) { if (!initialized) { @@ -100,7 +126,6 @@ public class OSGiWeavingAdaptor extends ClassLoaderWeavingAdaptor { } } - // Bug 215177: Adapt to updated (AJ 1.5.4) super class signature: /** * @see org.aspectj.weaver.tools.WeavingAdaptor#weaveClass(java.lang.String, * byte[], boolean) @@ -113,11 +138,10 @@ public class OSGiWeavingAdaptor extends ClassLoaderWeavingAdaptor { if (!initializing) { if (!initialized) { initializing = true; - initialize(classLoader, weavingContext); + super.initialize(classLoader, weavingContext); initialized = true; initializing = false; } - // Bug 215177: Adapt to updated (AJ 1.5.4) super class signature: bytes = super.weaveClass(name, bytes, mustWeave); } return bytes; -- cgit v1.2.3