aboutsummaryrefslogtreecommitdiffstats
path: root/weaver
diff options
context:
space:
mode:
authoraclement <aclement>2006-06-08 09:46:47 +0000
committeraclement <aclement>2006-06-08 09:46:47 +0000
commit65ff490a29f85cf4f3fc910e08ab5da8b7065040 (patch)
tree4b53d85e68cd3d8ea88efd78eca0247f2e4afa69 /weaver
parent6f1419826c990e919ff88e48d6a417fd973da06a (diff)
downloadaspectj-65ff490a29f85cf4f3fc910e08ab5da8b7065040.tar.gz
aspectj-65ff490a29f85cf4f3fc910e08ab5da8b7065040.zip
synchronization joinpoints: code dump...
Diffstat (limited to 'weaver')
-rw-r--r--weaver/src/org/aspectj/weaver/MemberImpl.java25
-rw-r--r--weaver/src/org/aspectj/weaver/bcel/BcelAdvice.java12
2 files changed, 36 insertions, 1 deletions
diff --git a/weaver/src/org/aspectj/weaver/MemberImpl.java b/weaver/src/org/aspectj/weaver/MemberImpl.java
index 14b7fde02..ca70434d8 100644
--- a/weaver/src/org/aspectj/weaver/MemberImpl.java
+++ b/weaver/src/org/aspectj/weaver/MemberImpl.java
@@ -702,6 +702,10 @@ public class MemberImpl implements Comparable, AnnotatedElement,Member {
return "makeInitializerSig";
} else if (kind == ADVICE) {
return "makeAdviceSig";
+ } else if (kind == MONITORENTER) {
+ return "makeLockSig";
+ } else if (kind == MONITOREXIT) {
+ return "makeUnlockSig";
} else {
throw new RuntimeException("unimplemented");
}
@@ -729,6 +733,10 @@ public class MemberImpl implements Comparable, AnnotatedElement,Member {
return "org.aspectj.lang.reflect.InitializerSignature";
} else if (kind == ADVICE) {
return "org.aspectj.lang.reflect.AdviceSignature";
+ } else if (kind == MONITORENTER) {
+ return "org.aspectj.lang.reflect.LockSignature";
+ } else if (kind == MONITOREXIT) {
+ return "org.aspectj.lang.reflect.UnlockSignature";
} else {
throw new RuntimeException("unimplemented");
}
@@ -753,6 +761,8 @@ public class MemberImpl implements Comparable, AnnotatedElement,Member {
return getStaticInitializationSignatureString(world);
} else if (kind == ADVICE) {
return getAdviceSignatureString(world);
+ } else if (kind == MONITORENTER || kind == MONITOREXIT) {
+ return getMonitorSignatureString(world);
} else {
throw new RuntimeException("unimplemented");
}
@@ -828,6 +838,21 @@ public class MemberImpl implements Comparable, AnnotatedElement,Member {
return buf.toString();
}
+ protected String getMonitorSignatureString(World world) {
+ StringBuffer buf = new StringBuffer();
+ buf.append(makeString(Modifier.STATIC)); // modifiers
+ buf.append('-');
+ buf.append(getName()); // name
+ buf.append('-');
+ buf.append(makeString(getDeclaringType())); // Declaring Type
+ buf.append('-');
+ buf.append(makeString(getParameterTypes()[0])); // Parameter Types
+ buf.append('-');
+ buf.append(""); // Parameter names
+ buf.append('-');
+ return buf.toString();
+ }
+
protected String getConstructorSignatureString(World world) {
diff --git a/weaver/src/org/aspectj/weaver/bcel/BcelAdvice.java b/weaver/src/org/aspectj/weaver/bcel/BcelAdvice.java
index 7da631707..64d439671 100644
--- a/weaver/src/org/aspectj/weaver/bcel/BcelAdvice.java
+++ b/weaver/src/org/aspectj/weaver/bcel/BcelAdvice.java
@@ -14,6 +14,7 @@
package org.aspectj.weaver.bcel;
+import java.lang.reflect.Modifier;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
@@ -23,6 +24,7 @@ import org.aspectj.apache.bcel.generic.InstructionConstants;
import org.aspectj.apache.bcel.generic.InstructionFactory;
import org.aspectj.apache.bcel.generic.InstructionHandle;
import org.aspectj.apache.bcel.generic.InstructionList;
+import org.aspectj.bridge.ISourceLocation;
import org.aspectj.bridge.Message;
import org.aspectj.weaver.Advice;
import org.aspectj.weaver.AdviceKind;
@@ -216,6 +218,14 @@ public class BcelAdvice extends Advice {
}
}
+ if (shadow.getIWorld().isJoinpointSynchronizationEnabled() &&
+ shadow.getKind()==Shadow.MethodExecution &&
+ (s.getSignature().getModifiers() & Modifier.SYNCHRONIZED)!=0) {
+ Message m = new Message("advice matching the synchronized method shadow '"+shadow.toString()+
+ "' will be executed outside the lock rather than inside (compiler limitation)",shadow.getSourceLocation(),false,new ISourceLocation[]{getSourceLocation()});
+ shadow.getIWorld().getMessageHandler().handleMessage(m);
+ }
+
//FIXME AV - see #75442, this logic is not enough so for now comment it out until we fix the bug
// // callback for perObject AJC MightHaveAspect postMunge (#75442)
// if (getConcreteAspect() != null
@@ -674,4 +684,4 @@ public class BcelAdvice extends Advice {
protected void clearLintSuppressions(World inWorld,Collection toClear) {
inWorld.getLint().clearSuppressions(toClear);
}
-}
+} \ No newline at end of file