aboutsummaryrefslogtreecommitdiffstats
path: root/weaver/src
diff options
context:
space:
mode:
authoracolyer <acolyer>2004-08-18 08:25:46 +0000
committeracolyer <acolyer>2004-08-18 08:25:46 +0000
commit7fd50c75ae779195b87922c5ffd839ac7a6910bf (patch)
treeef161539e5d9ad7154c3a2ae97db270ab16e73c4 /weaver/src
parent5d2c29e5769f11763514a173690c290f3111e64b (diff)
downloadaspectj-7fd50c75ae779195b87922c5ffd839ac7a6910bf.tar.gz
aspectj-7fd50c75ae779195b87922c5ffd839ac7a6910bf.zip
test for Bugzilla Bug 64069
ITD name clashes with private members
Diffstat (limited to 'weaver/src')
-rw-r--r--weaver/src/org/aspectj/weaver/ResolvedTypeX.java25
1 files changed, 23 insertions, 2 deletions
diff --git a/weaver/src/org/aspectj/weaver/ResolvedTypeX.java b/weaver/src/org/aspectj/weaver/ResolvedTypeX.java
index c21a5db91..3fbf7d588 100644
--- a/weaver/src/org/aspectj/weaver/ResolvedTypeX.java
+++ b/weaver/src/org/aspectj/weaver/ResolvedTypeX.java
@@ -1140,8 +1140,12 @@ public abstract class ResolvedTypeX extends TypeX {
munger.getSourceLocation())
);
}
- } else {
- //interTypeMungers.add(munger);
+ } else if (isDuplicateMemberWithinTargetType(existingMember,this,sig)) {
+ getWorld().getMessageHandler().handleMessage(
+ MessageUtil.error(WeaverMessages.format(WeaverMessages.ITD_MEMBER_CONFLICT,munger.getAspectType().getName(),
+ existingMember),
+ munger.getSourceLocation())
+ );;
}
//return;
}
@@ -1149,6 +1153,23 @@ public abstract class ResolvedTypeX extends TypeX {
return true;
}
+ // we know that the member signature matches, but that the member in the target type is not visible to the aspect.
+ // this may still be disallowed if it would result in two members within the same declaring type with the same
+ // signature AND more than one of them is concrete AND they are both visible within the target type.
+ private boolean isDuplicateMemberWithinTargetType(ResolvedMember existingMember, ResolvedTypeX targetType,ResolvedMember itdMember) {
+ if ( (existingMember.isAbstract() || itdMember.isAbstract())) return false;
+ TypeX declaringType = existingMember.getDeclaringType();
+ if (!targetType.equals(declaringType)) return false;
+ // now have to test that itdMember is visible from targetType
+ if (itdMember.isPrivate()) return false;
+ if (itdMember.isPublic()) return true;
+ // must be in same package to be visible then...
+ if (!targetType.getPackageName().equals(itdMember.getDeclaringType().getPackageName())) return false;
+
+ // trying to put two members with the same signature into the exact same type..., and both visible in that type.
+ return true;
+ }
+
public boolean checkLegalOverride(ResolvedMember parent, ResolvedMember child) {
//System.err.println("check: " + child.getDeclaringType() + " overrides " + parent.getDeclaringType());
if (!parent.getReturnType().equals(child.getReturnType())) {