summaryrefslogtreecommitdiffstats
path: root/org.aspectj.matcher
diff options
context:
space:
mode:
authoraclement <aclement>2009-10-31 19:29:19 +0000
committeraclement <aclement>2009-10-31 19:29:19 +0000
commit1d69efda32f5a9d353ad07a6afe253be82e2cac7 (patch)
treed08df30072241b0f03f6e294a2cfaff6b8f03138 /org.aspectj.matcher
parent3f6882c0d42293848506722b2fe9d2f4d046f9e9 (diff)
downloadaspectj-1d69efda32f5a9d353ad07a6afe253be82e2cac7.tar.gz
aspectj-1d69efda32f5a9d353ad07a6afe253be82e2cac7.zip
bitflags for optimized checks
Diffstat (limited to 'org.aspectj.matcher')
-rw-r--r--org.aspectj.matcher/src/org/aspectj/weaver/ResolvedType.java42
1 files changed, 42 insertions, 0 deletions
diff --git a/org.aspectj.matcher/src/org/aspectj/weaver/ResolvedType.java b/org.aspectj.matcher/src/org/aspectj/weaver/ResolvedType.java
index fd4b4aeac..9635692e5 100644
--- a/org.aspectj.matcher/src/org/aspectj/weaver/ResolvedType.java
+++ b/org.aspectj.matcher/src/org/aspectj/weaver/ResolvedType.java
@@ -46,6 +46,13 @@ public abstract class ResolvedType extends UnresolvedType implements AnnotatedEl
protected World world;
+ private int bits;
+
+ private static int AnnotationBitsInitialized = 0x0001;
+ private static int AnnotationMarkedInherited = 0x0002;
+ private static int MungersAnalyzed = 0x0004;
+ private static int HasParentMunger = 0x0008;
+
protected ResolvedType(String signature, World world) {
super(signature);
this.world = world;
@@ -1508,6 +1515,7 @@ public abstract class ResolvedType extends UnresolvedType implements AnnotatedEl
public void addInterTypeMunger(ConcreteTypeMunger munger) {
ResolvedMember sig = munger.getSignature();
+ bits = (bits & ~MungersAnalyzed); // clear the bit - as the mungers have changed
if (sig == null || munger.getMunger() == null || munger.getMunger().getKind() == ResolvedTypeMunger.PrivilegedAccess) {
interTypeMungers.add(munger);
return;
@@ -2394,4 +2402,38 @@ public abstract class ResolvedType extends UnresolvedType implements AnnotatedEl
// Nothing to do for anything except a ReferenceType
}
+ /**
+ * For an annotation type, this will return if it is marked with @Inherited
+ */
+ public boolean isInheritedAnnotation() {
+ ensureAnnotationBitsInitialized();
+ return (bits & AnnotationMarkedInherited) != 0;
+ }
+
+ /*
+ * Setup the bitflags if they have not already been done.
+ */
+ private void ensureAnnotationBitsInitialized() {
+ if ((bits & AnnotationBitsInitialized) == 0) {
+ bits |= AnnotationBitsInitialized;
+ // Is it marked @Inherited?
+ if (hasAnnotation(UnresolvedType.AT_INHERITED)) {
+ bits |= AnnotationMarkedInherited;
+ }
+ }
+ }
+
+ private boolean hasNewParentMungers() {
+ if ((bits & MungersAnalyzed) == 0) {
+ bits |= MungersAnalyzed;
+ for (ConcreteTypeMunger munger : interTypeMungers) {
+ ResolvedTypeMunger resolvedTypeMunger = munger.getMunger();
+ if (resolvedTypeMunger != null && resolvedTypeMunger.getKind() == ResolvedTypeMunger.Parent) {
+ bits |= HasParentMunger;
+ }
+ }
+ }
+ return (bits & HasParentMunger) != 0;
+ }
+
}