From 414026dbcb3d7fbf1b8909d0fa384ae3f9e2de3f Mon Sep 17 00:00:00 2001 From: aclement Date: Tue, 21 Oct 2008 18:55:04 +0000 Subject: [PATCH] 246125: c15 --- weaver/src/org/aspectj/weaver/Shadow.java | 41 ++++++++++++------- .../aspectj/weaver/TemporaryTypeMunger.java | 35 ++++++++++++++++ .../org/aspectj/weaver/WeaverStateInfo.java | 3 +- .../org/aspectj/weaver/patterns/PerCflow.java | 1 - 4 files changed, 63 insertions(+), 17 deletions(-) create mode 100644 weaver/src/org/aspectj/weaver/TemporaryTypeMunger.java diff --git a/weaver/src/org/aspectj/weaver/Shadow.java b/weaver/src/org/aspectj/weaver/Shadow.java index 778631d63..edc8fd121 100644 --- a/weaver/src/org/aspectj/weaver/Shadow.java +++ b/weaver/src/org/aspectj/weaver/Shadow.java @@ -24,7 +24,6 @@ import java.util.Set; import org.aspectj.bridge.IMessage; import org.aspectj.bridge.ISourceLocation; import org.aspectj.bridge.MessageUtil; -import org.aspectj.lang.JoinPoint; import org.aspectj.util.PartialOrder; import org.aspectj.util.TypeSafeEnum; import org.aspectj.weaver.ast.Var; @@ -272,22 +271,36 @@ public abstract class Shadow { return getResolvedSignature().getGenericReturnType(); } + public static String METHOD_EXECUTION = "method-execution"; + public static String METHOD_CALL = "method-call"; + public static String CONSTRUCTOR_EXECUTION = "constructor-execution"; + public static String CONSTRUCTOR_CALL = "constructor-call"; + public static String FIELD_GET = "field-get"; + public static String FIELD_SET = "field-set"; + public static String STATICINITIALIZATION = "staticinitialization"; + public static String PREINITIALIZATION = "preinitialization"; + public static String INITIALIZATION = "initialization"; + public static String EXCEPTION_HANDLER = "exception-handler"; + public static String SYNCHRONIZATION_LOCK = "lock"; + public static String SYNCHRONIZATION_UNLOCK = "unlock"; + public static String ADVICE_EXECUTION = "adviceexecution"; + /** * These names are the ones that will be returned by thisJoinPoint.getKind() Those need to be documented somewhere */ - public static final Kind MethodCall = new Kind(JoinPoint.METHOD_CALL, 1, true); - public static final Kind ConstructorCall = new Kind(JoinPoint.CONSTRUCTOR_CALL, 2, true); - public static final Kind MethodExecution = new Kind(JoinPoint.METHOD_EXECUTION, 3, false); - public static final Kind ConstructorExecution = new Kind(JoinPoint.CONSTRUCTOR_EXECUTION, 4, false); - public static final Kind FieldGet = new Kind(JoinPoint.FIELD_GET, 5, true); - public static final Kind FieldSet = new Kind(JoinPoint.FIELD_SET, 6, true); - public static final Kind StaticInitialization = new Kind(JoinPoint.STATICINITIALIZATION, 7, false); - public static final Kind PreInitialization = new Kind(JoinPoint.PREINITIALIZATION, 8, false); - public static final Kind AdviceExecution = new Kind(JoinPoint.ADVICE_EXECUTION, 9, false); - public static final Kind Initialization = new Kind(JoinPoint.INITIALIZATION, 10, false); - public static final Kind ExceptionHandler = new Kind(JoinPoint.EXCEPTION_HANDLER, 11, true); - public static final Kind SynchronizationLock = new Kind(JoinPoint.SYNCHRONIZATION_LOCK, 12, true); - public static final Kind SynchronizationUnlock = new Kind(JoinPoint.SYNCHRONIZATION_UNLOCK, 13, true); + public static final Kind MethodCall = new Kind(METHOD_CALL, 1, true); + public static final Kind ConstructorCall = new Kind(CONSTRUCTOR_CALL, 2, true); + public static final Kind MethodExecution = new Kind(METHOD_EXECUTION, 3, false); + public static final Kind ConstructorExecution = new Kind(CONSTRUCTOR_EXECUTION, 4, false); + public static final Kind FieldGet = new Kind(FIELD_GET, 5, true); + public static final Kind FieldSet = new Kind(FIELD_SET, 6, true); + public static final Kind StaticInitialization = new Kind(STATICINITIALIZATION, 7, false); + public static final Kind PreInitialization = new Kind(PREINITIALIZATION, 8, false); + public static final Kind AdviceExecution = new Kind(ADVICE_EXECUTION, 9, false); + public static final Kind Initialization = new Kind(INITIALIZATION, 10, false); + public static final Kind ExceptionHandler = new Kind(EXCEPTION_HANDLER, 11, true); + public static final Kind SynchronizationLock = new Kind(SYNCHRONIZATION_LOCK, 12, true); + public static final Kind SynchronizationUnlock = new Kind(SYNCHRONIZATION_UNLOCK, 13, true); // Bits here are 1<<(Kind.getKey()) - and unfortunately keys didn't start at zero so bits here start at 2 public static final int MethodCallBit = 0x002; diff --git a/weaver/src/org/aspectj/weaver/TemporaryTypeMunger.java b/weaver/src/org/aspectj/weaver/TemporaryTypeMunger.java new file mode 100644 index 000000000..2d31b597a --- /dev/null +++ b/weaver/src/org/aspectj/weaver/TemporaryTypeMunger.java @@ -0,0 +1,35 @@ +/* ******************************************************************* + * Copyright (c) 2008 Contributors + * All rights reserved. + * This program and the accompanying materials are made available + * under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * ******************************************************************/ +package org.aspectj.weaver; + +import java.util.Map; + +/** + * Some methods need a temporary type munger (because ConcreteTypeMunger is abstract - dont ask...). + * + * TODO ought to remove the need for this or at least sort out the two methods that are in it, they look wierd... + * + * @author AndyClement + */ +public class TemporaryTypeMunger extends ConcreteTypeMunger { + + public TemporaryTypeMunger(ResolvedTypeMunger munger, ResolvedType aspectType) { + super(munger, aspectType); + } + + public ConcreteTypeMunger parameterizeWith(Map parameterizationMap, World world) { + throw new UnsupportedOperationException("Cannot be called on a TemporaryTypeMunger"); + } + + public ConcreteTypeMunger parameterizedFor(ResolvedType targetType) { + throw new UnsupportedOperationException("Cannot be called on a TemporaryTypeMunger"); + } + +} \ No newline at end of file diff --git a/weaver/src/org/aspectj/weaver/WeaverStateInfo.java b/weaver/src/org/aspectj/weaver/WeaverStateInfo.java index 08fa79004..c1cca4567 100644 --- a/weaver/src/org/aspectj/weaver/WeaverStateInfo.java +++ b/weaver/src/org/aspectj/weaver/WeaverStateInfo.java @@ -28,7 +28,6 @@ import java.util.zip.ZipEntry; import java.util.zip.ZipInputStream; import org.aspectj.bridge.IMessage; -import org.aspectj.weaver.bcel.BcelTypeMunger; /** * WeaverStateInfo represents how a type was processed. It is used by the weaver to determine how a type was previously treated and @@ -201,7 +200,7 @@ public class WeaverStateInfo { continue; } - ret.add(new BcelTypeMunger(entry.typeMunger, aspectType)); + ret.add(new TemporaryTypeMunger(entry.typeMunger, aspectType)); } return ret; } diff --git a/weaver/src/org/aspectj/weaver/patterns/PerCflow.java b/weaver/src/org/aspectj/weaver/patterns/PerCflow.java index eae943afc..7cc0a242b 100644 --- a/weaver/src/org/aspectj/weaver/patterns/PerCflow.java +++ b/weaver/src/org/aspectj/weaver/patterns/PerCflow.java @@ -35,7 +35,6 @@ import org.aspectj.weaver.VersionedDataInputStream; import org.aspectj.weaver.World; import org.aspectj.weaver.ast.Expr; import org.aspectj.weaver.ast.Test; -import org.aspectj.weaver.bcel.BcelAccessForInlineMunger; public class PerCflow extends PerClause { private final boolean isBelow; -- 2.39.5