From 4b93b6867d84279faf29b63bb53f3ea48bcc55c7 Mon Sep 17 00:00:00 2001 From: Alexander Kriegisch Date: Fri, 23 Feb 2024 17:43:47 +0700 Subject: [PATCH] Rephrase docs for WeavingXmlConfig::excludesType and turn into javadoc. Signed-off-by: Alexander Kriegisch --- docs/devguide/ltw.adoc | 2 +- .../org/aspectj/weaver/bcel/BcelWorld.java | 24 +++++++++++++------ 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/docs/devguide/ltw.adoc b/docs/devguide/ltw.adoc index 1d1831c92..922ac8a07 100644 --- a/docs/devguide/ltw.adoc +++ b/docs/devguide/ltw.adoc @@ -233,7 +233,7 @@ matched by any exclude statements. If there are no include statements then all non-excluded aspects are included. * The set of types to be woven are those types matched by at least one weaver `include` element and not matched by any weaver `exclude` -element. If there are no weaver include statements then all non-excluded +element. If there are no weaver include statements, then all non-excluded types are included. * The weaver options are derived by taking the union of the options specified in each of the weaver options attribute specifications. Where diff --git a/weaver/src/main/java/org/aspectj/weaver/bcel/BcelWorld.java b/weaver/src/main/java/org/aspectj/weaver/bcel/BcelWorld.java index f498c37c5..745bd02b2 100644 --- a/weaver/src/main/java/org/aspectj/weaver/bcel/BcelWorld.java +++ b/weaver/src/main/java/org/aspectj/weaver/bcel/BcelWorld.java @@ -1171,7 +1171,7 @@ public class BcelWorld extends World implements Repository { if (!world.getMessageHandler().isIgnoring(IMessage.INFO)) { world.getMessageHandler().handleMessage( MessageUtil.info("Aspect '" + aspectName + "' is scoped to apply against types matching pattern '" - + scopePattern.toString() + "'")); + + scopePattern + "'")); } } catch (Exception e) { world.getMessageHandler().handleMessage( @@ -1267,12 +1267,22 @@ public class BcelWorld extends World implements Repository { return scopes.get(name); } - // Can't quite follow the same rules for exclusion as used for loadtime weaving: - // "The set of types to be woven are those types matched by at least one weaver include element and not matched by any - // weaver - // exclude element. If there are no weaver include statements then all non-excluded types are included." - // Since if the weaver is seeing it during this kind of build, the type is implicitly included. So all we should check - // for is exclusion + /** + * Checks if a given type is to be excluded from weaving. + *

+ * For LTW, the development guide (docs/devguide/ltw.adoc) says: + *

+ * "The set of types to be woven are those types matched by at least one weaver {@code include} element and not + * matched by any weaver {@code exclude} element. If there are no weaver include statements, then all non-excluded + * types are included." + *

+ * In CTW mode, we cannot quite follow the same rules for exclusion as used for LTW: If the weaver is seeing it + * during this kind of build, the type is implicitly included. So all we should check for is exclusion. + * + * @param type resolved type to be checked + * + * @return Always false in LTW mode. In CTW mode true for excluded types, false otherwise. + */ public boolean excludesType(ResolvedType type) { if (mode == MODE_LTW) { return false; -- 2.39.5