From 40cbd9f1d42610e95e533cc920e4fb74fb8749d6 Mon Sep 17 00:00:00 2001 From: aclement Date: Wed, 24 May 2006 07:18:16 +0000 Subject: [PATCH] synchronization joinpoints: aspectjrt changes --- runtime/src/org/aspectj/lang/JoinPoint.java | 2 + .../aspectj/lang/reflect/LockSignature.java | 18 ++++++++ .../aspectj/lang/reflect/UnlockSignature.java | 19 +++++++++ .../org/aspectj/runtime/reflect/Factory.java | 34 +++++++++++++++ .../runtime/reflect/LockSignatureImpl.java | 41 +++++++++++++++++++ .../runtime/reflect/UnlockSignatureImpl.java | 40 ++++++++++++++++++ 6 files changed, 154 insertions(+) create mode 100644 runtime/src/org/aspectj/lang/reflect/LockSignature.java create mode 100644 runtime/src/org/aspectj/lang/reflect/UnlockSignature.java create mode 100644 runtime/src/org/aspectj/runtime/reflect/LockSignatureImpl.java create mode 100644 runtime/src/org/aspectj/runtime/reflect/UnlockSignatureImpl.java diff --git a/runtime/src/org/aspectj/lang/JoinPoint.java b/runtime/src/org/aspectj/lang/JoinPoint.java index e6f3b5092..105d8698d 100644 --- a/runtime/src/org/aspectj/lang/JoinPoint.java +++ b/runtime/src/org/aspectj/lang/JoinPoint.java @@ -176,6 +176,8 @@ public interface JoinPoint { static String PREINITIALIZATION = "preinitialization"; static String INITIALIZATION = "initialization"; static String EXCEPTION_HANDLER = "exception-handler"; + static String SYNCHRONIZATION_LOCK = "lock"; + static String SYNCHRONIZATION_UNLOCK = "unlock"; static String ADVICE_EXECUTION = "adviceexecution"; diff --git a/runtime/src/org/aspectj/lang/reflect/LockSignature.java b/runtime/src/org/aspectj/lang/reflect/LockSignature.java new file mode 100644 index 000000000..9ef5034ce --- /dev/null +++ b/runtime/src/org/aspectj/lang/reflect/LockSignature.java @@ -0,0 +1,18 @@ +/******************************************************************************* + * Copyright (c) 2006 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Andy Clement - initial implementation + *******************************************************************************/ + +package org.aspectj.lang.reflect; + +import org.aspectj.lang.Signature; + +public interface LockSignature extends Signature { + +} diff --git a/runtime/src/org/aspectj/lang/reflect/UnlockSignature.java b/runtime/src/org/aspectj/lang/reflect/UnlockSignature.java new file mode 100644 index 000000000..ba0ce9ffa --- /dev/null +++ b/runtime/src/org/aspectj/lang/reflect/UnlockSignature.java @@ -0,0 +1,19 @@ +/******************************************************************************* + * Copyright (c) 2006 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Andy Clement - initial implementation + *******************************************************************************/ + + +package org.aspectj.lang.reflect; + +import org.aspectj.lang.Signature; + +public interface UnlockSignature extends Signature { + +} diff --git a/runtime/src/org/aspectj/runtime/reflect/Factory.java b/runtime/src/org/aspectj/runtime/reflect/Factory.java index 95c9de068..c81060230 100644 --- a/runtime/src/org/aspectj/runtime/reflect/Factory.java +++ b/runtime/src/org/aspectj/runtime/reflect/Factory.java @@ -341,6 +341,40 @@ public final class Factory { return ret; } + public LockSignature makeLockSig(String stringRep) { + LockSignatureImpl ret = new LockSignatureImpl(stringRep); + ret.setLookupClassLoader(lookupClassLoader); + return ret; + } + public LockSignature makeLockSig() { + Class declaringTypeClass = makeClass("Ljava/lang/Object;",lookupClassLoader); + LockSignatureImpl ret = new LockSignatureImpl(declaringTypeClass); + ret.setLookupClassLoader(lookupClassLoader); + return ret; + } + public LockSignature makeLockSig(Class declaringType) { + LockSignatureImpl ret = new LockSignatureImpl(declaringType); + ret.setLookupClassLoader(lookupClassLoader); + return ret; + } + + public UnlockSignature makeUnlockSig(String stringRep) { + UnlockSignatureImpl ret = new UnlockSignatureImpl(stringRep); + ret.setLookupClassLoader(lookupClassLoader); + return ret; + } + public UnlockSignature makeUnlockSig() { + Class declaringTypeClass = makeClass("Ljava/lang/Object;",lookupClassLoader); + UnlockSignatureImpl ret = new UnlockSignatureImpl(declaringTypeClass); + ret.setLookupClassLoader(lookupClassLoader); + return ret; + } + public UnlockSignature makeUnlockSig(Class declaringType) { + UnlockSignatureImpl ret = new UnlockSignatureImpl(declaringType); + ret.setLookupClassLoader(lookupClassLoader); + return ret; + } + public SourceLocation makeSourceLoc(int line, int col) { diff --git a/runtime/src/org/aspectj/runtime/reflect/LockSignatureImpl.java b/runtime/src/org/aspectj/runtime/reflect/LockSignatureImpl.java new file mode 100644 index 000000000..605966db1 --- /dev/null +++ b/runtime/src/org/aspectj/runtime/reflect/LockSignatureImpl.java @@ -0,0 +1,41 @@ +/******************************************************************************* + * Copyright (c) 2006 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Andy Clement - initial implementation + *******************************************************************************/ + + +package org.aspectj.runtime.reflect; + +import java.lang.reflect.Modifier; + +import org.aspectj.lang.reflect.LockSignature; + +class LockSignatureImpl extends SignatureImpl implements LockSignature { + private Class parameterType; + + LockSignatureImpl(Class c) { + super(Modifier.STATIC, "lock", c); + parameterType = c; + } + + LockSignatureImpl(String stringRep) { + super(stringRep); + } + + protected String createToString(StringMaker sm) { + if (parameterType == null) parameterType = extractType(3); + return "lock("+sm.makeTypeName(parameterType)+")"; + } + + public Class getParameterType() { + if (parameterType == null) parameterType = extractType(3); + return parameterType; + } + +} diff --git a/runtime/src/org/aspectj/runtime/reflect/UnlockSignatureImpl.java b/runtime/src/org/aspectj/runtime/reflect/UnlockSignatureImpl.java new file mode 100644 index 000000000..afc02f660 --- /dev/null +++ b/runtime/src/org/aspectj/runtime/reflect/UnlockSignatureImpl.java @@ -0,0 +1,40 @@ +/******************************************************************************* + * Copyright (c) 2006 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Andy Clement - initial implementation + *******************************************************************************/ + + +package org.aspectj.runtime.reflect; + +import java.lang.reflect.Modifier; + +import org.aspectj.lang.reflect.UnlockSignature; + +class UnlockSignatureImpl extends SignatureImpl implements UnlockSignature { + private Class parameterType; + + UnlockSignatureImpl(Class c) { + super(Modifier.STATIC, "unlock", c); + parameterType = c; + } + + UnlockSignatureImpl(String stringRep) { + super(stringRep); + } + + protected String createToString(StringMaker sm) { + if (parameterType == null) parameterType = extractType(3); + return "unlock("+sm.makeTypeName(parameterType)+")"; + } + + public Class getParameterType() { + if (parameterType == null) parameterType = extractType(3); + return parameterType; + } +} -- 2.39.5