Bug 274410 - [aspects] introduce a new header to avoid weaver creation
diff --git a/bundles/org.eclipse.equinox.weaving.aspectj/src/org/eclipse/equinox/weaving/aspectj/AspectAdmin.java b/bundles/org.eclipse.equinox.weaving.aspectj/src/org/eclipse/equinox/weaving/aspectj/AspectAdmin.java
index 8830016..bcc1d2f 100644
--- a/bundles/org.eclipse.equinox.weaving.aspectj/src/org/eclipse/equinox/weaving/aspectj/AspectAdmin.java
+++ b/bundles/org.eclipse.equinox.weaving.aspectj/src/org/eclipse/equinox/weaving/aspectj/AspectAdmin.java
@@ -28,6 +28,20 @@
public interface AspectAdmin {
/**
+ * Header for aspect bundle manifest files to indicate whether a bundle is
+ * readily compiled with AJDT, for example. This tells Equinox Aspects that
+ * the bundle does not need to be woven if it refers to just its own
+ * aspects.
+ */
+ public static final String AOP_BUNDLE_FINISHED_HEADER = "Eclipse-AspectBundle"; //$NON-NLS-1$
+
+ /**
+ * The value for the aspect bundle header to indicate that there is no
+ * weaving necessary to finish the aspects of the bundle itself
+ */
+ public static final String AOP_BUNDLE_FINISHED_VALUE = "finished"; //$NON-NLS-1$
+
+ /**
* This is the default value for the location of the aop.xml file inside a
* bundle
*/
@@ -141,7 +155,8 @@
*
* @param bundle The bundle from which the given package is imported
* @param packageName The name of the package that is imported
- * @param applyAspects the policy for applying visible aspects for weaving
+ * @param applyAspectsPolicy the policy for applying visible aspects for
+ * weaving
* @return The set of aspects that should be woven from the given imported
* package
*/
@@ -154,7 +169,8 @@
*
* @param bundle The bundle which is required and might export aspects that
* should be woven
- * @param applyAspects the policy for applying visible aspects for weaving
+ * @param applyAspectsPolicy the policy for applying visible aspects for
+ * weaving
* @return The set of aspects that should be woven from the given required
* bundle
*/
diff --git a/bundles/org.eclipse.equinox.weaving.aspectj/src/org/eclipse/equinox/weaving/aspectj/loadtime/AspectResolver.java b/bundles/org.eclipse.equinox.weaving.aspectj/src/org/eclipse/equinox/weaving/aspectj/loadtime/AspectResolver.java
index ba221cd..f6df097 100644
--- a/bundles/org.eclipse.equinox.weaving.aspectj/src/org/eclipse/equinox/weaving/aspectj/loadtime/AspectResolver.java
+++ b/bundles/org.eclipse.equinox.weaving.aspectj/src/org/eclipse/equinox/weaving/aspectj/loadtime/AspectResolver.java
@@ -239,15 +239,18 @@
}
// this bundle
- if (result.size() > 0) {
- aspects = aspectAdmin.getAspectDefinition(bundle);
- if (aspects != null) {
+ aspects = aspectAdmin.getAspectDefinition(bundle);
+ if (aspects != null) {
+ final String finishedValue = (String) bundle.getHeaders().get(
+ AspectAdmin.AOP_BUNDLE_FINISHED_HEADER);
+ if (finishedValue == null
+ || !AspectAdmin.AOP_BUNDLE_FINISHED_VALUE
+ .equals(finishedValue)) {
result.add(aspects);
fingerprintElements.add(bundle.getSymbolicName() + ":" //$NON-NLS-1$
+ bundleDescription.getVersion().toString());
}
}
-
}
return result;