From 9825192b0f54682faa39b7467b55372b679db544 Mon Sep 17 00:00:00 2001 From: acolyer Date: Wed, 14 Dec 2005 00:53:28 +0000 Subject: fixes inefficient ordering of tests in SignaturePattern (that I inadvertantly introduced earlier), and corrects @DeclareParents impl in AJTypeSystem :- fields should NOT be shown, and nor should non-interface members. --- .../aspectj/internal/lang/reflect/AjTypeImpl.java | 36 +++------------------- .../reflect/InterTypeMethodDeclarationImpl.java | 4 +-- 2 files changed, 7 insertions(+), 33 deletions(-) (limited to 'aspectj5rt') diff --git a/aspectj5rt/java5-src/org/aspectj/internal/lang/reflect/AjTypeImpl.java b/aspectj5rt/java5-src/org/aspectj/internal/lang/reflect/AjTypeImpl.java index 54c500801..482ccebb9 100644 --- a/aspectj5rt/java5-src/org/aspectj/internal/lang/reflect/AjTypeImpl.java +++ b/aspectj5rt/java5-src/org/aspectj/internal/lang/reflect/AjTypeImpl.java @@ -662,17 +662,12 @@ public class AjTypeImpl implements AjType { for (Field f : clazz.getDeclaredFields()) { if (!f.getType().isInterface()) continue; if (!Modifier.isPublic(f.getModifiers()) || !Modifier.isStatic(f.getModifiers())) continue; - if (f.isAnnotationPresent(org.aspectj.lang.annotation.DeclareParents.class)) { - Class itdSource = f.getType(); - try { - itdSource = f.get(null).getClass(); - } catch (IllegalAccessException ex) { - // - } - for (Method itdM : itdSource.getDeclaredMethods()) { + if (f.isAnnotationPresent(org.aspectj.lang.annotation.DeclareParents.class)) { + for (Method itdM : f.getType().getDeclaredMethods()) { if (!Modifier.isPublic(itdM.getModifiers()) && publicOnly) continue; InterTypeMethodDeclaration itdm = new InterTypeMethodDeclarationImpl( - this, AjTypeSystem.getAjType(f.getType()), itdM + this, AjTypeSystem.getAjType(f.getType()), itdM, + Modifier.PUBLIC ); toList.add(itdm); } @@ -684,28 +679,7 @@ public class AjTypeImpl implements AjType { private void addAnnotationStyleITDFields(List toList, boolean publicOnly) { //AV: I think it is meaningless //@AJ decp is interface driven ie no field - // AMC: private fields in the mixin type should show as ITDs private to the aspect... - if (isAspect()) { - for (Field f : clazz.getDeclaredFields()) { - if (!f.getType().isInterface()) continue; - if (!Modifier.isPublic(f.getModifiers()) || !Modifier.isStatic(f.getModifiers())) continue; - if (f.isAnnotationPresent(org.aspectj.lang.annotation.DeclareParents.class)) { - Class itdSource = f.getType(); - try { - itdSource = f.get(null).getClass(); - } catch (IllegalAccessException ex) { - // - } - for (Field itdF : itdSource.getDeclaredFields()) { - if (!Modifier.isPublic(itdF.getModifiers()) && publicOnly) continue; - InterTypeFieldDeclaration itdf = new InterTypeFieldDeclarationImpl( - this, AjTypeSystem.getAjType(f.getType()), itdF - ); - toList.add(itdf); - } - } - } - } + return; } /* (non-Javadoc) diff --git a/aspectj5rt/java5-src/org/aspectj/internal/lang/reflect/InterTypeMethodDeclarationImpl.java b/aspectj5rt/java5-src/org/aspectj/internal/lang/reflect/InterTypeMethodDeclarationImpl.java index 2ed2f89cf..eb085a055 100644 --- a/aspectj5rt/java5-src/org/aspectj/internal/lang/reflect/InterTypeMethodDeclarationImpl.java +++ b/aspectj5rt/java5-src/org/aspectj/internal/lang/reflect/InterTypeMethodDeclarationImpl.java @@ -47,8 +47,8 @@ public class InterTypeMethodDeclarationImpl extends InterTypeDeclarationImpl this.baseMethod = itdInterMethod; } - public InterTypeMethodDeclarationImpl(AjType decType, AjType targetType, Method base) { - super(decType,targetType,base.getModifiers()); + public InterTypeMethodDeclarationImpl(AjType decType, AjType targetType, Method base, int modifiers) { + super(decType,targetType,modifiers); this.parameterAdjustmentFactor = 0; this.name = base.getName(); this.baseMethod = base; -- cgit v1.2.3