Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Lippert2012-04-26 10:12:07 +0000
committerMartin Lippert2012-04-26 10:12:07 +0000
commitbe8377c9526eadafbc10a11306580451ee799452 (patch)
tree45a2ff82f297b55d4805d6931335de8dd6c680db /bundles/org.eclipse.equinox.weaving.aspectj
parentf3110a4c2281782a42a9da31a51185de3d760b76 (diff)
downloadrt.equinox.bundles-be8377c9526eadafbc10a11306580451ee799452.tar.gz
rt.equinox.bundles-be8377c9526eadafbc10a11306580451ee799452.tar.xz
rt.equinox.bundles-be8377c9526eadafbc10a11306580451ee799452.zip
added some missing doc for OSGiWeavingAdaptorv20120426-1012
Diffstat (limited to 'bundles/org.eclipse.equinox.weaving.aspectj')
-rw-r--r--bundles/org.eclipse.equinox.weaving.aspectj/src/org/eclipse/equinox/weaving/aspectj/loadtime/OSGiWeavingAdaptor.java30
1 files 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<String, byte[]> getGeneratedClassesFor(final String className) {
final Map<?, ?> generated = this.generatedClasses;
final Map<String, byte[]> result = new HashMap<String, byte[]>();
@@ -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;

Back to the top