From 65ff490a29f85cf4f3fc910e08ab5da8b7065040 Mon Sep 17 00:00:00 2001 From: aclement Date: Thu, 8 Jun 2006 09:46:47 +0000 Subject: [PATCH] synchronization joinpoints: code dump... --- weaver/src/org/aspectj/weaver/MemberImpl.java | 25 +++++++++++++++++++ .../org/aspectj/weaver/bcel/BcelAdvice.java | 12 ++++++++- 2 files changed, 36 insertions(+), 1 deletion(-) 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 -- 2.39.5