aboutsummaryrefslogtreecommitdiffstats
path: root/weaver
diff options
context:
space:
mode:
authoracolyer <acolyer>2004-01-13 17:04:31 +0000
committeracolyer <acolyer>2004-01-13 17:04:31 +0000
commitb8d42c06d69f44e8c87a9b7d3ea290de0d18ed37 (patch)
tree2644257d1fac639585398ed3c9f356490f642181 /weaver
parent87db1e79f6b882af30d382233589ebb1fc732be9 (diff)
downloadaspectj-b8d42c06d69f44e8c87a9b7d3ea290de0d18ed37.tar.gz
aspectj-b8d42c06d69f44e8c87a9b7d3ea290de0d18ed37.zip
Fix for Bugzilla Bug 49784
declaring interface methods should work as it does in interface and Bugzilla Bug 45676 AspectJ enhanced code can not be used with plain old java anymo and Bugzilla Bug 43972 Static crosscutting makes interfaces unusable for javac
Diffstat (limited to 'weaver')
-rw-r--r--weaver/src/org/aspectj/weaver/ResolvedTypeX.java66
-rw-r--r--weaver/src/org/aspectj/weaver/bcel/BcelTypeMunger.java10
-rw-r--r--weaver/src/org/aspectj/weaver/bcel/BcelWeaver.java2
3 files changed, 72 insertions, 6 deletions
diff --git a/weaver/src/org/aspectj/weaver/ResolvedTypeX.java b/weaver/src/org/aspectj/weaver/ResolvedTypeX.java
index 7307dce25..58b88dbca 100644
--- a/weaver/src/org/aspectj/weaver/ResolvedTypeX.java
+++ b/weaver/src/org/aspectj/weaver/ResolvedTypeX.java
@@ -23,6 +23,7 @@ import java.util.List;
import org.aspectj.bridge.IMessage;
import org.aspectj.bridge.ISourceLocation;
+import org.aspectj.bridge.Message;
import org.aspectj.bridge.MessageUtil;
import org.aspectj.weaver.patterns.Declare;
import org.aspectj.weaver.patterns.PerClause;
@@ -928,6 +929,70 @@ public abstract class ResolvedTypeX extends TypeX {
public List getInterTypeMungers() {
return interTypeMungers;
}
+
+ private List getInterTypeMungersIncludingSupers() {
+ ArrayList ret = new ArrayList();
+ collectInterTypeMungers(ret);
+ return ret;
+ }
+
+
+ /**
+ * ??? This method is O(N*M) where N = number of methods and M is number of
+ * inter-type declarations in my super
+ */
+ private void collectInterTypeMungers(List collector) {
+ for (Iterator iter = getDirectSupertypes(); iter.hasNext();) {
+ ResolvedTypeX superType = (ResolvedTypeX) iter.next();
+ superType.collectInterTypeMungers(collector);
+ }
+
+ outer: for (Iterator iter1 = collector.iterator(); iter1.hasNext(); ) {
+ ConcreteTypeMunger superMunger = (ConcreteTypeMunger) iter1.next();
+ if ( superMunger.getSignature() == null) continue;
+
+ if ( !superMunger.getSignature().isAbstract()) continue;
+
+ for (Iterator iter = getInterTypeMungers().iterator(); iter.hasNext();) {
+ ConcreteTypeMunger myMunger = (ConcreteTypeMunger) iter.next();
+ if (conflictingSignature(myMunger.getSignature(), superMunger.getSignature())) {
+ iter1.remove();
+ continue outer;
+ }
+ }
+
+ if (!superMunger.getSignature().isPublic()) continue;
+
+ for (Iterator iter = getMethods(); iter.hasNext(); ) {
+ ResolvedMember method = (ResolvedMember)iter.next();
+ if (conflictingSignature(method, superMunger.getSignature())) {
+ iter1.remove();
+ continue outer;
+ }
+ }
+ }
+
+ collector.addAll(getInterTypeMungers());
+ }
+
+
+ /**
+ * Check that we don't have any abstract type mungers unless this
+ * type is abstract.
+ */
+ public void checkInterTypeMungers() {
+ if (isAbstract()) return;
+
+ for (Iterator iter = getInterTypeMungersIncludingSupers().iterator(); iter.hasNext();) {
+ ConcreteTypeMunger element = (ConcreteTypeMunger) iter.next();
+ if (element.getSignature() != null && element.getSignature().isAbstract()) {
+ world.getMessageHandler().handleMessage(
+ new Message("must implement abstract inter-type declaration: " + element.getSignature(),
+ "", IMessage.ERROR, getSourceLocation(), null,
+ new ISourceLocation[] { element.getSourceLocation() }));
+ }
+ }
+ }
/**
* Returns a ResolvedTypeX object representing the declaring type of this type, or
@@ -1277,4 +1342,5 @@ public abstract class ResolvedTypeX extends TypeX {
public WeaverStateInfo getWeaverState() {
return null;
}
+
}
diff --git a/weaver/src/org/aspectj/weaver/bcel/BcelTypeMunger.java b/weaver/src/org/aspectj/weaver/bcel/BcelTypeMunger.java
index 4b844428e..36ad5acb1 100644
--- a/weaver/src/org/aspectj/weaver/bcel/BcelTypeMunger.java
+++ b/weaver/src/org/aspectj/weaver/bcel/BcelTypeMunger.java
@@ -232,7 +232,9 @@ public class BcelTypeMunger extends ConcreteTypeMunger {
BcelWorld.makeBcelTypes(member.getParameterTypes()),
TypeX.getNames(member.getExceptions()),
gen);
- ret.makeSynthetic();
+
+ // 43972 : Static crosscutting makes interfaces unusable for javac
+ // ret.makeSynthetic();
return ret;
}
@@ -325,7 +327,7 @@ public class BcelTypeMunger extends ConcreteTypeMunger {
if (onType.equals(gen.getType())) {
ResolvedMember introMethod =
AjcMemberMaker.interMethod(signature, aspectType, onInterface);
-
+
LazyMethodGen mg = makeMethodGen(gen, introMethod);
if (!onInterface && !Modifier.isAbstract(introMethod.getModifiers())) {
@@ -366,8 +368,6 @@ public class BcelTypeMunger extends ConcreteTypeMunger {
AjcMemberMaker.interMethod(signature, aspectType, false);
LazyMethodGen mg = makeMethodGen(gen, introMethod);
-
- //
Type[] paramTypes = BcelWorld.makeBcelTypes(introMethod.getParameterTypes());
Type returnType = BcelWorld.makeBcelType(introMethod.getReturnType());
@@ -444,7 +444,6 @@ public class BcelTypeMunger extends ConcreteTypeMunger {
ResolvedMember newConstructorMember = newConstructorTypeMunger.getSyntheticConstructor();
TypeX onType = newConstructorMember.getDeclaringType();
-
if (! onType.equals(currentClass.getType())) return false;
ResolvedMember explicitConstructor = newConstructorTypeMunger.getExplicitConstructor();
@@ -519,7 +518,6 @@ public class BcelTypeMunger extends ConcreteTypeMunger {
body.append(Utility.createInvoke(fact, null, postMethod));
// don't forget to return!!
-
body.append(InstructionConstants.RETURN);
return true;
diff --git a/weaver/src/org/aspectj/weaver/bcel/BcelWeaver.java b/weaver/src/org/aspectj/weaver/bcel/BcelWeaver.java
index 97f26c916..0d8dff563 100644
--- a/weaver/src/org/aspectj/weaver/bcel/BcelWeaver.java
+++ b/weaver/src/org/aspectj/weaver/bcel/BcelWeaver.java
@@ -471,6 +471,8 @@ public class BcelWeaver implements IWeaver {
JavaClass javaClass = classType.getJavaClass();
List shadowMungers = fastMatch(shadowMungerList, classType.getResolvedTypeX());
List typeMungers = classType.getResolvedTypeX().getInterTypeMungers();
+
+ classType.getResolvedTypeX().checkInterTypeMungers();
LazyClassGen clazz = null;