[jboss-cvs] JBossAS SVN: r71184 - in projects/aop/branches/joinpoint_graph/aop: docs/examples/beforeafter/resources and 29 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Sun Mar 23 23:41:25 EDT 2008


Author: flavia.rainone at jboss.com
Date: 2008-03-23 23:41:24 -0400 (Sun, 23 Mar 2008)
New Revision: 71184

Added:
   projects/aop/branches/joinpoint_graph/aop/docs/examples/beforeafter/resources/
   projects/aop/branches/joinpoint_graph/aop/docs/examples/beforeafter/resources/input.txt
   projects/aop/branches/joinpoint_graph/aop/docs/examples/finally/resources/
   projects/aop/branches/joinpoint_graph/aop/docs/examples/finally/resources/input.txt
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/proxy/container/MarshalledAdvice.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/proxy/container/MarshalledContainerProxy.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/proxy/container/MarshalledProxyAdvisor.java
Removed:
   projects/aop/branches/joinpoint_graph/aop/docs/examples/beforeafter/resources/input.txt
   projects/aop/branches/joinpoint_graph/aop/docs/examples/finally/resources/input.txt
   projects/aop/branches/joinpoint_graph/aop/src/main/TestAnnotation.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/proxy/container/MarshalledProxy.java
Modified:
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/advice/AbstractAdvice.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/advice/AdviceBinding.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/advice/AdviceMethodProperties.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/advice/AdviceStack.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/advice/AspectDefinition.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/advice/AspectFactoryDelegator.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/advice/AspectFactoryWithClassLoaderSupport.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/advice/DynamicCFlowDefinition.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/advice/GenericAspectFactory.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/advice/GenericInterceptorFactory.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/advice/NoMatchingAdviceException.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/advice/PerInstanceAdvice.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/advice/PerInstanceInterceptor.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/advice/PerJoinpointAdvice.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/advice/PerJoinpointInterceptor.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/advice/PerVmAdvice.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/advice/PrecedenceSorter.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/advice/SecurityActions.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/advice/annotation/AdviceInfo.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/advice/annotation/AdviceMethodFactory.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/advice/annotation/ParameterAnnotationRule.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/advice/annotation/assignability/ArgumentContextualizer.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/advice/annotation/assignability/AssignabilityAlgorithm.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/advice/annotation/assignability/ChoiceBound.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/advice/annotation/assignability/DegreeAlgorithm.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/advice/annotation/assignability/VariableHierarchy.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/advice/annotation/assignability/VariableNode.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/annotation/AnnotationElement.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/annotation/AnnotationRepository.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/annotation/PortableAnnotationElement.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/annotation/compiler/AnnotationDocletTag.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/annotation/compiler/AnnotationInfoCreator.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/annotation/compiler/ByteCodeAnnotationCompiler.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/annotation/util/FindAnnotations.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/ant/AnnotationC.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/ant/AopC.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/array/ArrayBinding.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/array/ArrayElementInvocation.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/array/ArrayRegistry.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/array/ArrayRegistryEntry.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/array/ArrayReplacement.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/array/ElementArrayRegistryEntry.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/array/FieldArrayRegistryEntry.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/classpool/AOPClassPool.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/classpool/AOPClassPoolRepository.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/contrib/IDEClassPoolFactory.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/eclipsesupport/EclipseTestTransformer.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/expressions/ConstructorExpression.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/expressions/ParameterExpression.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/hook/GenerateInstrumentedClassLoader.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/hook/JDK14TransformerManager.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/instrument/CallerTransformer.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/instrument/GeneratedAdvisorMethodExecutionTransformer.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/instrument/Instrumentor.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/instrument/JoinPointGenerator.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/instrument/JoinpointStatusUpdate.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/instrument/OptimizedCallerInvocations.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/instrument/OptimizedConstructionInvocations.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/instrument/OptimizedConstructorInvocations.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/introduction/AnnotationIntroduction.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/introduction/InterfaceIntroduction.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/Construction.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/ConstructionInvocation.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/ConstructionInvocationWrapper.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/ConstructorCall.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/ConstructorCallByConstructor.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/ConstructorCalledByConstructorInvocation.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/ConstructorCalledByConstructorInvocationWrapper.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/ConstructorCalledByConstructorJoinpoint.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/ConstructorCalledByMethodInvocation.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/ConstructorCalledByMethodInvocationWrapper.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/ConstructorCalledByMethodJoinpoint.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/ConstructorExecution.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/ConstructorInvocation.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/ConstructorInvocationWrapper.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/ConstructorJoinpoint.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/FieldInvocation.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/FieldReadInvocationWrapper.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/FieldWriteInvocationWrapper.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/Invocation.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/InvocationBase.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/InvocationResponse.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/JoinPointBean.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/MethodCall.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/MethodCallByConstructor.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/MethodCalledByConstructorInvocation.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/MethodCalledByConstructorInvocationWrapper.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/MethodCalledByConstructorJoinpoint.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/MethodCalledByMethodInvocation.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/MethodCalledByMethodInvocationWrapper.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/MethodInvocation.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/MethodInvocationWrapper.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/metadata/ClassMetaDataBinding.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/metadata/ClassMetaDataLoader.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/metadata/ConstructorConfig.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/metadata/ConstructorMetaData.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/metadata/FieldMetaData.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/metadata/MethodConfig.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/metadata/MethodMetaData.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/metadata/SimpleClassMetaDataBinding.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/metadata/SimpleClassMetaDataLoader.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/metadata/SimpleMetaData.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/metadata/ThreadMetaData.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/microcontainer/lifecycle/LifecycleCallbackBinding.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/pointcut/AdvisorMatcherStrategy.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/pointcut/AnnotationMatcher.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/pointcut/CFlow.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/pointcut/CFlowStack.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/pointcut/CallMatcher.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/pointcut/ConstructionMatcher.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/pointcut/ConstructorCallMatcher.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/pointcut/ConstructorMatcher.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/pointcut/DeclareDef.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/pointcut/DeclareTypeMatcher.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/pointcut/ExecutionConstructorMatcher.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/pointcut/MatcherStrategy.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/pointcut/MethodMatcher.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/pointcut/Pointcut.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/pointcut/PointcutExpression.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/pointcut/PointcutMethodMatch.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/pointcut/ProxyMatcherStrategy.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/pointcut/SecurityActions.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/pointcut/SoftClassMatcher.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/pointcut/TypeMatcher.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/pointcut/Typedef.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/pointcut/TypedefExpression.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/pointcut/Util.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/pointcut/WithinMatcher.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/pointcut/ast/ASTConstructor.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/pointcut/ast/ASTField.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/pointcut/ast/ASTMethod.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/pointcut/ast/ClassExpression.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/pointcut/ast/JJTPointcutExpressionParserState.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/pointcut/ast/JJTTypeExpressionParserState.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/pointcut/ast/ParseException.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/pointcut/ast/PointcutExpressionParser.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/pointcut/ast/PointcutExpressionParserTokenManager.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/pointcut/ast/TokenMgrError.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/pointcut/ast/TypeExpressionParser.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/pointcut/ast/TypeExpressionParserTokenManager.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/proxy/ClassProxyFactory.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/proxy/container/AOPProxyFactoryMixin.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/proxy/container/AOPProxyFactoryParameters.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/proxy/container/AspectManaged.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/proxy/container/ClassProxyContainer.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/proxy/container/ContainerCache.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/proxy/container/ContainerCacheUtil.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/proxy/container/ContainerProxyCacheKey.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/proxy/container/ContainerProxyFactory.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/proxy/container/Delegate.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/proxy/container/GeneratedAOPProxyFactory.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/proxy/container/ProxyTemplate.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/proxy/container/SecurityActions.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/reflection/ReflectionAspect.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/standalone/AOPTransformer.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/standalone/Compiler.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/standalone/SystemClassLoader.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/util/JavassistMethodHashing.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/util/ReflectUtils.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/util/XmlHelper.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/util/reference/ArgumentPersistentReference.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/util/reference/ConstructorPersistentReference.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/util/reference/PersistentReference.java
Log:
Merging with trunk.

Copied: projects/aop/branches/joinpoint_graph/aop/docs/examples/beforeafter/resources (from rev 71182, projects/aop/trunk/aop/docs/examples/beforeafter/resources)

Deleted: projects/aop/branches/joinpoint_graph/aop/docs/examples/beforeafter/resources/input.txt
===================================================================
--- projects/aop/trunk/aop/docs/examples/beforeafter/resources/input.txt	2008-03-24 01:24:49 UTC (rev 71182)
+++ projects/aop/branches/joinpoint_graph/aop/docs/examples/beforeafter/resources/input.txt	2008-03-24 03:41:24 UTC (rev 71184)
@@ -1,12 +0,0 @@
-A $30.00
-B $50.00
-C $0.00
-
-A +$50.00
-A -$10.00
-B -$5.00
-B->C $100.00
-C->A $89.11
-C -$0.11
-B +$51.00
-

Copied: projects/aop/branches/joinpoint_graph/aop/docs/examples/beforeafter/resources/input.txt (from rev 71182, projects/aop/trunk/aop/docs/examples/beforeafter/resources/input.txt)
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/docs/examples/beforeafter/resources/input.txt	                        (rev 0)
+++ projects/aop/branches/joinpoint_graph/aop/docs/examples/beforeafter/resources/input.txt	2008-03-24 03:41:24 UTC (rev 71184)
@@ -0,0 +1,12 @@
+A $30.00
+B $50.00
+C $0.00
+
+A +$50.00
+A -$10.00
+B -$5.00
+B->C $100.00
+C->A $89.11
+C -$0.11
+B +$51.00
+

Copied: projects/aop/branches/joinpoint_graph/aop/docs/examples/finally/resources (from rev 71182, projects/aop/trunk/aop/docs/examples/finally/resources)

Deleted: projects/aop/branches/joinpoint_graph/aop/docs/examples/finally/resources/input.txt
===================================================================
--- projects/aop/trunk/aop/docs/examples/finally/resources/input.txt	2008-03-24 01:24:49 UTC (rev 71182)
+++ projects/aop/branches/joinpoint_graph/aop/docs/examples/finally/resources/input.txt	2008-03-24 03:41:24 UTC (rev 71184)
@@ -1,13 +0,0 @@
-A $30.00
-B $50.00
-C $0.00
-
-A +$50.00
-A -$10.00
-D +$1.00
-B -$5.00
-B->C $100.00
-C->A $89.11
-C -$0.11
-B +$51.00
-

Copied: projects/aop/branches/joinpoint_graph/aop/docs/examples/finally/resources/input.txt (from rev 71182, projects/aop/trunk/aop/docs/examples/finally/resources/input.txt)
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/docs/examples/finally/resources/input.txt	                        (rev 0)
+++ projects/aop/branches/joinpoint_graph/aop/docs/examples/finally/resources/input.txt	2008-03-24 03:41:24 UTC (rev 71184)
@@ -0,0 +1,13 @@
+A $30.00
+B $50.00
+C $0.00
+
+A +$50.00
+A -$10.00
+D +$1.00
+B -$5.00
+B->C $100.00
+C->A $89.11
+C -$0.11
+B +$51.00
+


Property changes on: projects/aop/branches/joinpoint_graph/aop/docs/examples/finally/resources/input.txt
___________________________________________________________________
Name: svn:executable
   + *

Deleted: projects/aop/branches/joinpoint_graph/aop/src/main/TestAnnotation.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/TestAnnotation.java	2008-03-24 03:08:33 UTC (rev 71183)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/TestAnnotation.java	2008-03-24 03:41:24 UTC (rev 71184)
@@ -1,41 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors. 
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-/**
- * 
- * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
- * @version $Revision: 1.1 $
- */
-public class TestAnnotation<T>
-{
-   T x;
-   
-   void setX(T x)
-   {
-      this.x = x;
-   }
-   
-   T getX()
-   {
-     return x; 
-   }
-}

Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/advice/AbstractAdvice.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/advice/AbstractAdvice.java	2008-03-24 03:08:33 UTC (rev 71183)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/advice/AbstractAdvice.java	2008-03-24 03:41:24 UTC (rev 71184)
@@ -44,17 +44,17 @@
  */
 public abstract class AbstractAdvice implements Interceptor, Untransformable
 {
-   private static final Class[] INVOCATION_SIGNATURE = {Invocation.class};
-   private static final Class[] METHOD_SIGNATURE = {MethodInvocation.class};
-   private static final Class[] CONSTRUCTOR_SIGNATURE = {ConstructorInvocation.class};
-   private static final Class[] CONSTRUCTION_SIGNATURE = {ConstructionInvocation.class};
-   private static final Class[] FIELD_SIGNATURE = {FieldInvocation.class};
-   private static final Class[] FIELD_READ_SIGNATURE = {FieldReadInvocation.class};
-   private static final Class[] FIELD_WRITE_SIGNATURE = {FieldWriteInvocation.class};
-   private static final Class[] METHOD_CALLED_BY_METHOD_SIGNATURE = {MethodCalledByMethodInvocation.class};
-   private static final Class[] METHOD_CALLED_BY_CONSTRUCTOR_SIGNATURE = {MethodCalledByConstructorInvocation.class};
-   private static final Class[] CON_CALLED_BY_METHOD_SIGNATURE = {ConstructorCalledByMethodInvocation.class};
-   private static final Class[] CON_CALLED_BY_CONSTRUCTOR_SIGNATURE = {ConstructorCalledByConstructorInvocation.class};
+   private static final Class<?>[] INVOCATION_SIGNATURE = {Invocation.class};
+   private static final Class<?>[] METHOD_SIGNATURE = {MethodInvocation.class};
+   private static final Class<?>[] CONSTRUCTOR_SIGNATURE = {ConstructorInvocation.class};
+   private static final Class<?>[] CONSTRUCTION_SIGNATURE = {ConstructionInvocation.class};
+   private static final Class<?>[] FIELD_SIGNATURE = {FieldInvocation.class};
+   private static final Class<?>[] FIELD_READ_SIGNATURE = {FieldReadInvocation.class};
+   private static final Class<?>[] FIELD_WRITE_SIGNATURE = {FieldWriteInvocation.class};
+   private static final Class<?>[] METHOD_CALLED_BY_METHOD_SIGNATURE = {MethodCalledByMethodInvocation.class};
+   private static final Class<?>[] METHOD_CALLED_BY_CONSTRUCTOR_SIGNATURE = {MethodCalledByConstructorInvocation.class};
+   private static final Class<?>[] CON_CALLED_BY_METHOD_SIGNATURE = {ConstructorCalledByMethodInvocation.class};
+   private static final Class<?>[] CON_CALLED_BY_CONSTRUCTOR_SIGNATURE = {ConstructorCalledByConstructorInvocation.class};
    protected Method invocationAdvice;
    protected Method methodAdvice;
    protected Method constructorAdvice;
@@ -66,13 +66,19 @@
    protected Method methodCalledByConstructorAdvice;
    protected Method conCalledByMethodAdvice;
    protected Method conCalledByConstructorAdvice;
-   protected Class aspectClass;
+   protected Class<?> aspectClass;
    protected String adviceName;
 
-   protected void init(String advice, Class aspectClass)
+   protected void init(String advice, Class<?> aspectClass)
    {
-      this.aspectClass = aspectClass;
-      this.adviceName = advice;
+      if (aspectClass == null)
+      {
+         this.aspectClass = aspectClass;
+      }
+      if (adviceName == null)
+      {
+         this.adviceName = advice;
+      }
       invocationAdvice = findByInvocation(adviceName, aspectClass);
       if (invocationAdvice == null)
       {
@@ -92,7 +98,7 @@
       }
    }
 
-   protected static Method findByInvocation(String adviceName, Class clazz)
+   protected static Method findByInvocation(String adviceName, Class<?> clazz)
    {
       try
       {
@@ -105,7 +111,7 @@
       return null;
    }
 
-   protected static Method findByMethodInvocation(String adviceName, Class clazz)
+   protected static Method findByMethodInvocation(String adviceName, Class<?> clazz)
    {
       try
       {
@@ -118,7 +124,7 @@
       return null;
    }
 
-   protected static Method findByFieldInvocation(String adviceName, Class clazz)
+   protected static Method findByFieldInvocation(String adviceName, Class<?> clazz)
    {
       try
       {
@@ -131,7 +137,7 @@
       return null;
    }
 
-   protected static Method findByFieldReadInvocation(String adviceName, Class clazz)
+   protected static Method findByFieldReadInvocation(String adviceName, Class<?> clazz)
    {
       try
       {
@@ -144,7 +150,7 @@
       return null;
    }
 
-   protected static Method findByFieldWriteInvocation(String adviceName, Class clazz)
+   protected static Method findByFieldWriteInvocation(String adviceName, Class<?> clazz)
    {
       try
       {
@@ -157,7 +163,7 @@
       return null;
    }
 
-   protected static Method findByConstructorInvocation(String adviceName, Class clazz)
+   protected static Method findByConstructorInvocation(String adviceName, Class<?> clazz)
    {
       try
       {
@@ -170,7 +176,7 @@
       return null;
    }
 
-   protected static Method findByConstructionInvocation(String adviceName, Class clazz)
+   protected static Method findByConstructionInvocation(String adviceName, Class<?> clazz)
    {
       try
       {
@@ -183,7 +189,7 @@
       return null;
    }
 
-   protected static Method findByMethodCalledByMethodInvocation(String adviceName, Class clazz)
+   protected static Method findByMethodCalledByMethodInvocation(String adviceName, Class<?> clazz)
    {
       try
       {
@@ -196,7 +202,7 @@
       return null;
    }
 
-   protected static Method findByMethodCalledByConstructorInvocation(String adviceName, Class clazz)
+   protected static Method findByMethodCalledByConstructorInvocation(String adviceName, Class<?> clazz)
    {
       try
       {
@@ -209,7 +215,7 @@
       return null;
    }
 
-   protected static Method findByConstructorCalledByMethodInvocation(String adviceName, Class clazz)
+   protected static Method findByConstructorCalledByMethodInvocation(String adviceName, Class<?> clazz)
    {
       try
       {
@@ -222,7 +228,7 @@
       return null;
    }
 
-   protected static Method findByConstructorCalledByConstructorInvocation(String adviceName, Class clazz)
+   protected static Method findByConstructorCalledByConstructorInvocation(String adviceName, Class<?> clazz)
    {
       try
       {
@@ -317,4 +323,11 @@
       throw new RuntimeException("Should Be Unreachable, but unable to discover Advice");
 
    }
+   
+   public String getAdviceName()
+   {
+      return adviceName;
+   }
+   
+   public abstract Object getAspectInstance();
 }

Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/advice/AdviceBinding.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/advice/AdviceBinding.java	2008-03-24 03:08:33 UTC (rev 71183)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/advice/AdviceBinding.java	2008-03-24 03:41:24 UTC (rev 71184)
@@ -24,7 +24,6 @@
 import java.io.StringReader;
 import java.util.ArrayList;
 import java.util.Arrays;
-import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 import java.util.WeakHashMap;
@@ -240,7 +239,7 @@
     *              interceptor instances.
     * @see GenericInterceptorFactory
     */
-   public void addInterceptor(Class clazz)
+   public void addInterceptor(Class<?> clazz)
    {
       addInterceptorFactory(new GenericInterceptorFactory(clazz));
    }
@@ -376,6 +375,13 @@
    {
       synchronized (advisors)
       {
+//         for (Advisor advisor : advisors.keySet())
+//         {
+//            if (advisor.getManager().isAdvisorRegistered(advisor))
+//            {
+//               advisor.removeAdviceBinding(this);
+//            }
+//         }
          advisors.clear();
       }
    }

Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/advice/AdviceMethodProperties.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/advice/AdviceMethodProperties.java	2008-03-24 03:08:33 UTC (rev 71183)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/advice/AdviceMethodProperties.java	2008-03-24 03:41:24 UTC (rev 71184)
@@ -54,11 +54,11 @@
    private JoinPointBean joinPoint;
    
    //find properties
-   private Class aspectClass;
+   private Class<?> aspectClass;
    private String adviceName;
-   private Class thrownType;
-   private Class joinPointBeanType;
-   private Class invocationType;
+   private Class<?> thrownType;
+   private Class<?> joinPointBeanType;
+   private Class<?> invocationType;
    private Type target;
    private Type caller;
    private Type joinpointReturnType;
@@ -77,13 +77,13 @@
    // TODO remove
    public AdviceMethodProperties(
          JoinPointBean joinPoint,
-         Class aspectClass,
+         Class<?> aspectClass,
          String adviceName,
-         Class joinPointBeanType,
-         Class invocationType,
+         Class<?> joinPointBeanType,
+         Class<?> invocationType,
          Type joinpointReturnType,
          Type[] joinpointParameters,
-         Class[] joinpointParameterClassTypes,
+         Class<?>[] joinpointParameterClassTypes,
          Type[] joinpointExceptions,
          Type target,
          boolean targetAvailable)
@@ -95,14 +95,14 @@
    
    public AdviceMethodProperties(
          JoinPointBean joinPoint,
-         Class aspectClass,
+         Class<?> aspectClass,
          String adviceName,
-         Class thrownType,
-         Class joinPointBeanType,
-         Class invocationType,
+         Class<?> thrownType,
+         Class<?> joinPointBeanType,
+         Class<?> invocationType,
          Type joinpointReturnType,
          Type[] joinpointParameters,
-         Class[] joinpointParameterClassTypes,
+         Class<?>[] joinpointParameterClassTypes,
          Type[] joinpointExceptions,
          Type target,
          boolean targetAvailable)
@@ -123,10 +123,10 @@
    // TODO remove
    public AdviceMethodProperties(
          JoinPointBean joinPoint,
-         Class aspectClass,
+         Class<?> aspectClass,
          String adviceName,
-         Class joinPointBeanType,
-         Class invocationType,
+         Class<?> joinPointBeanType,
+         Class<?> invocationType,
          Type joinpointReturnType,
          Type[] joinpointParameters,
          Class<?>[] joinpointParameterClassTypes,
@@ -144,11 +144,11 @@
    
    public AdviceMethodProperties(
          JoinPointBean joinPoint,
-         Class aspectClass,
+         Class<?> aspectClass,
          String adviceName,
-         Class thrownType,
-         Class joinPointBeanType,
-         Class invocationType,
+         Class<?> thrownType,
+         Class<?> joinPointBeanType,
+         Class<?> invocationType,
          Type joinpointReturnType,
          Type[] joinpointParameters,
          Class<?>[] joinpointParameterClassTypes,
@@ -183,23 +183,23 @@
    }
 
 
-   public Class getAspectClass()
+   public Class<?> getAspectClass()
    {
       return aspectClass;
    }
 
-   public Class getThrownType()
+   public Class<?> getThrownType()
    {
       return this.thrownType;
    }
 
-   public Class getJoinPointBeanType()
+   public Class<?> getJoinPointBeanType()
    {
       return joinPointBeanType;
    }
 
 
-   public Class getInvocationType()
+   public Class<?> getInvocationType()
    {
       return invocationType;
    }

Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/advice/AdviceStack.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/advice/AdviceStack.java	2008-03-24 03:08:33 UTC (rev 71183)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/advice/AdviceStack.java	2008-03-24 03:41:24 UTC (rev 71184)
@@ -51,7 +51,7 @@
       ArrayList<Interceptor> interceptors = new ArrayList<Interceptor>();
       for (int i = 0; i < interceptorFactories.size(); i++)
       {
-         InterceptorFactory factory = (InterceptorFactory) interceptorFactories.get(i);
+         InterceptorFactory factory = interceptorFactories.get(i);
          if (factory.isDeployed()) interceptors.add(factory.create(advisor, jp));
       }
       return interceptors.toArray(new Interceptor[interceptors.size()]);

Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/advice/AspectDefinition.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/advice/AspectDefinition.java	2008-03-24 03:08:33 UTC (rev 71183)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/advice/AspectDefinition.java	2008-03-24 03:41:24 UTC (rev 71184)
@@ -104,9 +104,9 @@
    {
       if (advisors.size() > 0)
       {
-         for (Iterator it = advisors.keySet().iterator() ; it.hasNext() ; )
+         for (Iterator<Advisor> it = advisors.keySet().iterator() ; it.hasNext() ; )
          {
-            Advisor advisor = (Advisor)it.next();
+            Advisor advisor = it.next();
             if (advisor != null)
             {
                it.remove();

Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/advice/AspectFactoryDelegator.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/advice/AspectFactoryDelegator.java	2008-03-24 03:08:33 UTC (rev 71183)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/advice/AspectFactoryDelegator.java	2008-03-24 03:41:24 UTC (rev 71184)
@@ -66,7 +66,7 @@
       {
          try
          {
-            Class clazz = super.loadClass(factoryClass);
+            Class<?> clazz = super.loadClass(factoryClass);
             factory = (AspectFactory) clazz.newInstance();
             if (XmlLoadable.class.isAssignableFrom(factory.getClass()))
             {

Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/advice/AspectFactoryWithClassLoaderSupport.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/advice/AspectFactoryWithClassLoaderSupport.java	2008-03-24 03:08:33 UTC (rev 71183)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/advice/AspectFactoryWithClassLoaderSupport.java	2008-03-24 03:41:24 UTC (rev 71184)
@@ -35,10 +35,10 @@
 public abstract class AspectFactoryWithClassLoaderSupport implements AspectFactory, AspectFactoryWithClassLoader
 {
    private static final Logger logger = AOPLogger.getLogger(AspectFactoryWithClassLoaderSupport.class);
-   private WeakReference loader;
+   private WeakReference<ClassLoader> loader;
    
    /** If a scoped classloader with no parent delegation redefines the class, we need to make sure that that class is pushed on the stack */
-   private ThreadLocal scopedClassLoader = new ThreadLocal();
+   private ThreadLocal<ClassLoader> scopedClassLoader = new ThreadLocal<ClassLoader>();
    
    protected AspectFactoryWithClassLoaderSupport()
    {
@@ -46,7 +46,7 @@
 
    public void setClassLoader(ClassLoader cl)
    {
-      this.loader = new WeakReference(cl);
+      this.loader = new WeakReference<ClassLoader>(cl);
    }
    
    protected ClassLoader getLoader()
@@ -58,7 +58,7 @@
       }
       if (loader != null)
       {
-         return (ClassLoader)loader.get();
+         return loader.get();
       }
       return null;
    }
@@ -75,10 +75,10 @@
    
    public ClassLoader peekScopedClassLoader()
    {
-      return (ClassLoader)scopedClassLoader.get();
+      return scopedClassLoader.get();
    }
 
-   protected Class loadClass(String name) throws ClassNotFoundException
+   protected Class<?> loadClass(String name) throws ClassNotFoundException
    {
       ClassLoader cl = getLoader();
       if (cl == null)

Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/advice/DynamicCFlowDefinition.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/advice/DynamicCFlowDefinition.java	2008-03-24 03:08:33 UTC (rev 71183)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/advice/DynamicCFlowDefinition.java	2008-03-24 03:41:24 UTC (rev 71184)
@@ -36,7 +36,7 @@
    private String name;
    private String className;
    private Element element;
-   private Class pClass;
+   private Class<?> pClass;
 
    public DynamicCFlowDefinition(Element element, String className, String name)
    {

Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/advice/GenericAspectFactory.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/advice/GenericAspectFactory.java	2008-03-24 03:08:33 UTC (rev 71183)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/advice/GenericAspectFactory.java	2008-03-24 03:41:24 UTC (rev 71184)
@@ -48,9 +48,9 @@
 {
    private static final Logger logger = AOPLogger.getLogger(GenericAspectFactory.class);
    
-   final static Class[] ADVISOR_INJECTOR_SIGNATURE = new Class[]{Advisor.class};
-   final static Class[] INSTANCE_ADVISOR_INJECTOR_SIGNATURE = new Class[]{InstanceAdvisor.class};
-   final static Class[] JOINPOINT_INJECTOR_SIGNATURE = new Class[]{Joinpoint.class};
+   final static Class<?>[] ADVISOR_INJECTOR_SIGNATURE = new Class[]{Advisor.class};
+   final static Class<?>[] INSTANCE_ADVISOR_INJECTOR_SIGNATURE = new Class[]{InstanceAdvisor.class};
+   final static Class<?>[] JOINPOINT_INJECTOR_SIGNATURE = new Class[]{Joinpoint.class};
 
    private String classname;
    private Element element;
@@ -100,7 +100,7 @@
    /**
     * @deprecated Not public API
     */
-   public Class getClazz()
+   public Class<?> getClazz()
    {
       try
       {
@@ -112,7 +112,7 @@
       }
    }
    
-   private Class getClazz(Advisor advisor)
+   private Class<?> getClazz(Advisor advisor)
    {
       try
       {
@@ -120,7 +120,7 @@
          if (advisor != null)
          {
             //Get the correct classloader based on the class of the advisor
-            Class clazz = advisor.getClazz();
+            Class<?> clazz = advisor.getClazz();
             cl = (clazz != null) ? clazz.getClassLoader() : advisor.getClass().getClassLoader(); 
          }
          if (cl != null)
@@ -273,7 +273,7 @@
          if (attributeName.equalsIgnoreCase(descriptors[i].getName()))
          {
             foundProperty = true;
-            Class typeClass = descriptors[i].getPropertyType();
+            Class<?> typeClass = descriptors[i].getPropertyType();
 
             Object value;
             PropertyEditor editor = PropertyEditorManager.findEditor(typeClass);

Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/advice/GenericInterceptorFactory.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/advice/GenericInterceptorFactory.java	2008-03-24 03:08:33 UTC (rev 71183)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/advice/GenericInterceptorFactory.java	2008-03-24 03:41:24 UTC (rev 71184)
@@ -30,7 +30,7 @@
 
 public class GenericInterceptorFactory implements InterceptorFactory
 {
-   private WeakReference<Class> classRef = null;
+   private WeakReference<Class<?>> classRef = null;
    private String classname;
    private Element element;
    private boolean deployed = true;
@@ -45,9 +45,9 @@
       this.element = element;
    }
 
-   public GenericInterceptorFactory(Class clazz)
+   public GenericInterceptorFactory(Class<?> clazz)
    {
-      this.classRef = new WeakReference<Class>(clazz);
+      this.classRef = new WeakReference<Class<?>>(clazz);
       this.classname = clazz.getName();
    }
 
@@ -78,7 +78,7 @@
    {
       try
       {
-         Class clazz = null;
+         Class<?> clazz = null;
          synchronized (this)
          {
             if (classRef != null)
@@ -89,7 +89,7 @@
             {
                // FIXME ClassLoader - why should the class be visible from the context classloader?
                clazz = SecurityActions.getContextClassLoader().loadClass(classname);
-               classRef = new WeakReference<Class>(clazz);
+               classRef = new WeakReference<Class<?>>(clazz);
             }
          }
          Interceptor interceptor = (Interceptor)clazz.newInstance();

Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/advice/NoMatchingAdviceException.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/advice/NoMatchingAdviceException.java	2008-03-24 03:08:33 UTC (rev 71183)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/advice/NoMatchingAdviceException.java	2008-03-24 03:41:24 UTC (rev 71184)
@@ -67,7 +67,7 @@
     * @param adviceType       the type of the queried advice
     * @param message          message explaining why no matching advice was found
     */
-   public NoMatchingAdviceException(Class aspectClass, String adviceName)
+   public NoMatchingAdviceException(Class<?> aspectClass, String adviceName)
    {
       super("No matching advice called '" + adviceName + "' could be found in " +
             aspectClass.getName() + ": method was not found");

Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/advice/PerInstanceAdvice.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/advice/PerInstanceAdvice.java	2008-03-24 03:08:33 UTC (rev 71183)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/advice/PerInstanceAdvice.java	2008-03-24 03:41:24 UTC (rev 71184)
@@ -124,4 +124,14 @@
       }
    }
 
+   @Override
+   public Object getAspectInstance()
+   {
+      throw new RuntimeException("Use getAspectInstance(InstanceAdvisor instanceAdvisor) instead");
+   }
+   
+   public Object getAspectInstance(InstanceAdvisor instanceAdvisor)
+   {
+      return instanceAdvisor.getPerInstanceAspect(aspectDefinition);
+   }
 }

Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/advice/PerInstanceInterceptor.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/advice/PerInstanceInterceptor.java	2008-03-24 03:08:33 UTC (rev 71183)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/advice/PerInstanceInterceptor.java	2008-03-24 03:41:24 UTC (rev 71184)
@@ -102,9 +102,14 @@
                }
             }
          }
-         Interceptor interceptor = (Interceptor) instanceAdvisor.getPerInstanceAspect(aspectDefinition);
+         Interceptor interceptor = getAspectInstance(instanceAdvisor);
          return interceptor.invoke(invocation);
       }
    }
+   
+   public Interceptor getAspectInstance(InstanceAdvisor ia)
+   {
+      return (Interceptor) ia.getPerInstanceAspect(aspectDefinition);
+   }
 
 }

Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/advice/PerJoinpointAdvice.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/advice/PerJoinpointAdvice.java	2008-03-24 03:08:33 UTC (rev 71183)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/advice/PerJoinpointAdvice.java	2008-03-24 03:41:24 UTC (rev 71184)
@@ -176,5 +176,14 @@
       }
    }
 
-
+   @Override
+   public Object getAspectInstance()
+   {
+      throw new RuntimeException("Use getAspectInstance(InstanceAdvisor instanceAdvisor) instead");
+   }
+   
+   public Object getAspectInstance(InstanceAdvisor instanceAdvisor)
+   {
+      return instanceAdvisor.getPerInstanceJoinpointAspect(joinpoint, aspectDefinition);
+   }
 }

Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/advice/PerJoinpointInterceptor.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/advice/PerJoinpointInterceptor.java	2008-03-24 03:08:33 UTC (rev 71183)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/advice/PerJoinpointInterceptor.java	2008-03-24 03:41:24 UTC (rev 71184)
@@ -35,6 +35,8 @@
 import org.jboss.aop.joinpoint.Joinpoint;
 import org.jboss.aop.joinpoint.MethodCalledByMethodJoinpoint;
 import org.jboss.aop.joinpoint.MethodJoinpoint;
+import org.jboss.aop.proxy.container.ClassProxyContainer;
+import org.jboss.aop.proxy.container.ContainerProxyMethodInvocation;
 
 /**
  * Comment
@@ -123,10 +125,41 @@
          Object targetObject = invocation.getTargetObject();
          if (targetObject == null) return invocation.invokeNext(); // static method call or static field call
 
-         Advised advised = (Advised) targetObject;
-         InstanceAdvisor advisor = advised._getInstanceAdvisor();
-         Interceptor interceptor = (Interceptor) advisor.getPerInstanceJoinpointAspect(joinpoint, aspectDefinition);
+         InstanceAdvisor instanceAdvisor = null;
+         if (targetObject instanceof Advised)
+         {
+            Advised advised = (Advised) targetObject;
+            instanceAdvisor = advised._getInstanceAdvisor();
+         }
+         else
+         {
+            Advisor advisor = invocation.getAdvisor();
+            if (advisor == null)
+            {
+               return invocation.invokeNext();
+            }
+            else if (advisor instanceof InstanceAdvisor)
+            {
+               instanceAdvisor = (InstanceAdvisor) advisor;
+            }
+            else if (advisor instanceof ClassProxyContainer && invocation instanceof ContainerProxyMethodInvocation)
+            {
+               ContainerProxyMethodInvocation pi = (ContainerProxyMethodInvocation)invocation;
+               instanceAdvisor = pi.getProxy().getInstanceAdvisor();
+            }
+            else
+            {
+               return invocation.invokeNext();
+            }
+         }
+         Interceptor interceptor = getAspectInstance(instanceAdvisor);
          return interceptor.invoke(invocation);         
       }
    }
+   
+   public Interceptor getAspectInstance(InstanceAdvisor ia)
+   {
+      return (Interceptor) ia.getPerInstanceJoinpointAspect(joinpoint, aspectDefinition);
+   }
+   
 }
\ No newline at end of file

Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/advice/PerVmAdvice.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/advice/PerVmAdvice.java	2008-03-24 03:08:33 UTC (rev 71183)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/advice/PerVmAdvice.java	2008-03-24 03:41:24 UTC (rev 71184)
@@ -28,8 +28,10 @@
 
 import javassist.ClassPool;
 import javassist.CtClass;
+import javassist.CtConstructor;
 import javassist.CtField;
 import javassist.CtMethod;
+import javassist.CtNewConstructor;
 import javassist.CtNewMethod;
 
 import org.jboss.aop.AspectManager;
@@ -55,7 +57,7 @@
    {
       ClassLoader cl = aspect.getClass().getClassLoader();
       String name = "org.jboss.aop.advice." + aspect.getClass().getName() + "_z_" + adviceName + "_" + System.identityHashCode(cl);
-      Class iclass = null;
+      Class<?> iclass = null;
 
       if (cl == null)
       {
@@ -91,7 +93,7 @@
          if (iclass == null)
          {
             Method[] methods = aspect.getClass().getMethods();
-            ArrayList matches = new ArrayList();
+            ArrayList<Method> matches = new ArrayList<Method>();
             for (int i = 0; i < methods.length; i++)
             {
                if (methods[i].getName().equals(adviceName)) matches.add(methods[i]);
@@ -101,7 +103,7 @@
 
             for(int i=0; i < matches.size(); i++)
             {
-               Method method = (Method) matches.get(i);
+               Method method = matches.get(i);
                if(method.getParameterTypes().length != 1)
                {
                   throw new InvalidAdviceException(
@@ -111,14 +113,14 @@
                }
                
                // we only support params that implements org.jboss.aop.joinpoint.Invocation
-               Class paramClass = method.getParameterTypes()[0];
+               Class<?> paramClass = method.getParameterTypes()[0];
                boolean foundInterface = false;
                if(paramClass.isInterface() && paramClass.getName().equals("org.jboss.aop.joinpoint.Invocation"))
                   foundInterface = true;
                else
                {
-                  Class superParamClass = findSuperClass(paramClass);
-                  for(Class iClass : superParamClass.getInterfaces())
+                  Class<?> superParamClass = findSuperClass(paramClass);
+                  for(Class<?> iClass : superParamClass.getInterfaces())
                   {
                      if(iClass.getName().equals("org.jboss.aop.joinpoint.Invocation"))
                         foundInterface = true;
@@ -144,6 +146,11 @@
             CtField field = new CtField(aspectClass, "aspectField", clazz);
             field.setModifiers(javassist.Modifier.PUBLIC);
             clazz.addField(field);
+            
+            CtMethod getAspectFld = CtNewMethod.make(pool.get(Object.class.getName()), "getAspectInstance", new CtClass[0], new CtClass[0], "{return aspectField;}", clazz);
+            getAspectFld.setModifiers(javassist.Modifier.PUBLIC);
+            clazz.addMethod(getAspectFld);
+            
             // getName()
             CtMethod getNameTemplate = interceptorInterface.getDeclaredMethod("getName");
             String getNameBody =
@@ -163,7 +170,7 @@
                boolean noArg = false;
                for (int i = 0; i < matches.size(); i++)
                {
-                  Method advice = (Method) matches.get(i);
+                  Method advice = matches.get(i);
                   if (advice.getParameterTypes().length > 0)
                   {
                      String param = advice.getParameterTypes()[0].getName();
@@ -181,7 +188,7 @@
             }
             else
             {
-               Method advice = (Method) matches.get(0);
+               Method advice = matches.get(0);
                String param = advice.getParameterTypes()[0].getName();
                invokeBody.append("return aspectField." + adviceName + "((" + param + ")$1); ");
             }
@@ -190,6 +197,10 @@
             invoke.setModifiers(javassist.Modifier.PUBLIC);
             clazz.addMethod(invoke);
 
+            CtConstructor ctor = CtNewConstructor.defaultConstructor(clazz);
+            ctor.setBody("{super.adviceName = \"" + adviceName + "\";}");
+            clazz.addConstructor(ctor);
+            
             ProtectionDomain pd = aspect.getClass().getProtectionDomain();
             iclass = TransformerCommon.toClass(clazz, cl, pd);
          }
@@ -200,7 +211,7 @@
       return rtn;
    }
    
-   private static Class findSuperClass(Class clazz)
+   private static Class<?> findSuperClass(Class<?> clazz)
    {
       if(clazz.getSuperclass() == null || clazz.getSuperclass().getName().equals("java.lang.Object"))
          return clazz;

Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/advice/PrecedenceSorter.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/advice/PrecedenceSorter.java	2008-03-24 03:08:33 UTC (rev 71183)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/advice/PrecedenceSorter.java	2008-03-24 03:41:24 UTC (rev 71184)
@@ -24,7 +24,6 @@
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.Comparator;
-import java.util.Iterator;
 import java.util.LinkedHashMap;
 
 import org.jboss.aop.AspectManager;
@@ -36,17 +35,17 @@
  */
 public class PrecedenceSorter
 {
-   static Comparator interceptorComparator = new Comparator()
+   static Comparator<InterceptorEntry> interceptorComparator = new Comparator<InterceptorEntry>()
    {
-      public int compare(Object objA, Object objB)
+      public int compare(InterceptorEntry objA, InterceptorEntry objB)
       {
-         InterceptorEntry entryA = (InterceptorEntry)objA;
-         InterceptorEntry entryB = (InterceptorEntry)objB;
-         
+         InterceptorEntry entryA = objA;
+         InterceptorEntry entryB = objB;
+
          return entryA.precedenceOrder - entryB.precedenceOrder;
       }
    };
-   
+
    static class InterceptorEntry
    {
       Interceptor interceptor;
@@ -55,32 +54,32 @@
       int precedenceOrder = -1;
       String classname;
       String method;
-      
+
       InterceptorEntry(GeneratedAdvisorInterceptor factoryWrapper)
       {
          this.factoryWrapper = factoryWrapper;
          classname = factoryWrapper.getName();
-         
+
          InterceptorFactory ifac = factoryWrapper.getDelegate();
-         
+
          if (ifac instanceof GenericInterceptorFactory)
          {
             //Dynamically added interceptors
             classname = ((GenericInterceptorFactory)ifac).getClassName();
          }
-         else 
+         else
          {
             AspectFactory af = factoryWrapper.getAspect().getFactory();
             classname = af.getName();
          }
-         
+
          if (ifac instanceof AdviceFactory)
          {
             method = ((AdviceFactory)ifac).getAdvice();
          }
       }
-      
-      
+
+
       InterceptorEntry(Interceptor interceptor)
       {
          this.interceptor = interceptor;
@@ -105,7 +104,7 @@
          {
             interceptorName = interceptor.getClass().getName();
          }
-         
+
          try
          {
             boolean isAdvice = interceptorName.startsWith("org.jboss.aop.advice.");
@@ -120,21 +119,21 @@
             {
                classname = interceptorName;
             }
-         } 
+         }
          catch (RuntimeException e)
          {
             System.err.print(interceptor.getName());
             throw e;
          }
       }
-      
+
       public String toString()
       {
          return "Entry: " + precedenceOrder + " (" + originalOrder + ")interceptorClass=" + classname + "; adviceMethod=" + method;
       }
-      
+
    }
-   
+
    private static boolean matches(InterceptorEntry ientry, PrecedenceDefEntry pentry)
    {
       if (ientry.classname.equals(pentry.interceptorClass))
@@ -155,17 +154,16 @@
       }
       return false;
    }
-   
-   
+
+
    public static PrecedenceDefEntry[] createOverallPrecedence(AspectManager manager)
    {
-      ArrayList overall = new ArrayList();
-      
-      LinkedHashMap precedenceDefs = manager.getPrecedenceDefs();
+      ArrayList<PrecedenceDefEntry> overall = new ArrayList<PrecedenceDefEntry>();
+
+      LinkedHashMap<String, PrecedenceDef> precedenceDefs = manager.getPrecedenceDefs();
       boolean first = true;
-      for (Iterator it = precedenceDefs.values().iterator() ; it.hasNext(); )
+      for (PrecedenceDef precedenceDef : precedenceDefs.values())
       {
-         PrecedenceDef precedenceDef = (PrecedenceDef)it.next();
          PrecedenceDefEntry[] entries = precedenceDef.getEntries();
 
          if (first)
@@ -178,14 +176,13 @@
             first = false;
             continue;
          }
-         
+
          overall = mergePrecedenceDef(overall, precedenceDef);
       }
-      //System.out.println("OVERALL PRECEDENCE: " + overall);
-      return (PrecedenceDefEntry[])overall.toArray(new PrecedenceDefEntry[overall.size()]);
+      return overall.toArray(new PrecedenceDefEntry[overall.size()]);
    }
-   
-   public static ArrayList mergePrecedenceDef(ArrayList overall, PrecedenceDef precedenceDef)
+
+   public static ArrayList<PrecedenceDefEntry> mergePrecedenceDef(ArrayList<PrecedenceDefEntry> overall, PrecedenceDef precedenceDef)
    {
       //TODO This can be improved. If you have the precedences
       //		1) A, D
@@ -195,21 +192,21 @@
       //    i) A, D, C, E
       //After adding 3) to i) you end up with an overall precedence of
       //    ii) A, C, D, C, E,
-      //In practice this should be fine, since the applyPrecedence() looks for the 
+      //In practice this should be fine, since the applyPrecedence() looks for the
       //first matching entry, so the second (duplicate) occurrence of C is ignored.
       PrecedenceDefEntry[] entries = precedenceDef.getEntries();
       int start = 0, end = 0;
-      int size = overall.size(); 
+      int size = overall.size();
       for (int i = 0 ; i < size ; i++)
       {
-         PrecedenceDefEntry global = (PrecedenceDefEntry)overall.get(i);
+         PrecedenceDefEntry global = overall.get(i);
          boolean found = false;
 
          //find current overall precedence entry in the new set of defs
          for (int j = start ; j < entries.length ; j++)
          {
             PrecedenceDefEntry cur = entries[j];
-            
+
             if (cur.equals(global))
             {
                found = true;
@@ -217,8 +214,8 @@
                break;
             }
          }
-         
-         //We found it. Now insert everything until this into global and 
+
+         //We found it. Now insert everything until this into global and
          //reset the counters
          if (found)
          {
@@ -236,19 +233,19 @@
       {
          overall.add(entries[j]);
       }
-      
+
       return overall;
    }
-   
+
    public static Interceptor[] applyPrecedence(Interceptor[] interceptors, AspectManager manager)
    {
       if (interceptors.length == 0)
          return interceptors;
-      
-      ArrayList all = new ArrayList(interceptors.length);
-      ArrayList precedence = new ArrayList(interceptors.length);
+
+      ArrayList<InterceptorEntry> all = new ArrayList<InterceptorEntry>(interceptors.length);
+      ArrayList<InterceptorEntry> precedence = new ArrayList<InterceptorEntry>(interceptors.length);
       PrecedenceDefEntry[] precedenceEntries = manager.getSortedPrecedenceDefEntries();
-      
+
       //Figure out what interceptors have precedence
       for (int i = 0 ; i < interceptors.length ; i++)
       {
@@ -266,36 +263,36 @@
             }
          }
       }
-      
+
       //Sort the interceptors having precedence
       Collections.sort(precedence, interceptorComparator);
       Interceptor[] sortedInterceptors = new Interceptor[interceptors.length];
-      
-      //Build up new array of interceptors depending on their precedence 
+
+      //Build up new array of interceptors depending on their precedence
       int prec = 0;
       int allSize = all.size();
       int precedenceSize = precedence.size();
-      
+
       for (int i = 0 ; i < allSize ; i++)
       {
-         InterceptorEntry entry = (InterceptorEntry)all.get(i);
-         
+         InterceptorEntry entry = all.get(i);
+
          if (entry.precedenceOrder >= 0 && prec < precedenceSize)
          {
-            entry = (InterceptorEntry)precedence.get(prec++);
+            entry = precedence.get(prec++);
          }
          sortedInterceptors[i] = entry.interceptor;
       }
-      
+
       return sortedInterceptors;
    }
-   
+
    public static GeneratedAdvisorInterceptor[] applyPrecedence(GeneratedAdvisorInterceptor[] interceptors, AspectManager manager)
    {
-      ArrayList all = new ArrayList(interceptors.length);
-      ArrayList precedence = new ArrayList(interceptors.length);
+      ArrayList<InterceptorEntry> all = new ArrayList<InterceptorEntry>(interceptors.length);
+      ArrayList<InterceptorEntry> precedence = new ArrayList<InterceptorEntry>(interceptors.length);
       PrecedenceDefEntry[] precedenceEntries = manager.getSortedPrecedenceDefEntries();
-      
+
       //Figure out what interceptors have precedence
       for (int i = 0 ; i < interceptors.length ; i++)
       {
@@ -313,33 +310,33 @@
             }
          }
       }
-      
+
       //Sort the interceptors having precedence
       Collections.sort(precedence, interceptorComparator);
       GeneratedAdvisorInterceptor[] sortedInterceptors = new GeneratedAdvisorInterceptor[interceptors.length];
-      
-      //Build up new array of interceptors depending on their precedence 
+
+      //Build up new array of interceptors depending on their precedence
       int prec = 0;
       int allSize = all.size();
       int precedenceSize = precedence.size();
-      
+
       for (int i = 0 ; i < allSize ; i++)
       {
-         InterceptorEntry entry = (InterceptorEntry)all.get(i);
-         
+         InterceptorEntry entry = all.get(i);
+
          if (entry.precedenceOrder >= 0 && prec < precedenceSize)
          {
-            entry = (InterceptorEntry)precedence.get(prec++);
+            entry = precedence.get(prec++);
          }
          sortedInterceptors[i] = entry.factoryWrapper;
       }
-      
+
       return sortedInterceptors;
    }
-   
+
 /*   public static void main(String[] args)
    {
-      System.out.println("Hello");
+//      System.out.println("Hello");
       AspectManager manager = new AspectManager();
       PrecedenceDef def = new PrecedenceDef("3",new PrecedenceDefEntry[]{
             new PrecedenceDefEntry("A", null),
@@ -360,15 +357,15 @@
       outputOverAll(manager);
 
    }
-   
+
    private static void outputOverAll(AspectManager manager)
    {
       PrecedenceDefEntry[] entries = manager.getSortedPrecedenceDefEntries();
       for (int i = 0 ; i < entries.length ; i++)
       {
-         System.out.println("\t" + entries[i]);
+//         System.out.println("\t" + entries[i]);
       }
-      System.out.println("==================================");
+//      System.out.println("==================================");
    }
-*/   
+*/
 }

Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/advice/SecurityActions.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/advice/SecurityActions.java	2008-03-24 03:08:33 UTC (rev 71183)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/advice/SecurityActions.java	2008-03-24 03:41:24 UTC (rev 71184)
@@ -48,7 +48,7 @@
          {
             try
             {
-               AccessController.doPrivileged(new PrivilegedExceptionAction()
+               AccessController.doPrivileged(new PrivilegedExceptionAction<Object>()
                {
                   public Object run() throws Exception
                   {
@@ -89,11 +89,14 @@
       class name to editor name algorithm. For example, the type String[] has
       a name '[Ljava.lang.String;' which does not map to a XXXEditor name.
       */
-      Class strArrayType = String[].class;
+      Class<String[]> strArrayType = String[].class;
       PropertyEditorManager.registerEditor(strArrayType, StringArrayEditor.class);
-      Class clsArrayType = Class[].class;
+      
+      @SuppressWarnings("unchecked")
+      Class<Class[]> clsArrayType = Class[].class;
       PropertyEditorManager.registerEditor(clsArrayType, ClassArrayEditor.class);
-      Class intArrayType = int[].class;
+      
+      Class<int[]> intArrayType = int[].class;
       PropertyEditorManager.registerEditor(intArrayType, IntArrayEditor.class);
    }
 

Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/advice/annotation/AdviceInfo.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/advice/annotation/AdviceInfo.java	2008-03-24 03:08:33 UTC (rev 71183)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/advice/annotation/AdviceInfo.java	2008-03-24 03:41:24 UTC (rev 71184)
@@ -47,7 +47,7 @@
     */
    public final short getReturnAssignabilityDegree(AdviceMethodProperties properties)
    {
-      Class returnType = this.method.getReturnType();
+      Class<?> returnType = this.method.getReturnType();
       if (returnType == void.class)
       {
          return DegreeAlgorithm.NOT_ASSIGNABLE_DEGREE;
@@ -78,7 +78,7 @@
     */
    public int compareTo(AdviceInfo o)
    {
-      return ((AdviceInfo)o).rank - rank;
+      return o.rank - rank;
    }
    
    public String toString()

Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/advice/annotation/AdviceMethodFactory.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/advice/annotation/AdviceMethodFactory.java	2008-03-24 03:08:33 UTC (rev 71183)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/advice/annotation/AdviceMethodFactory.java	2008-03-24 03:41:24 UTC (rev 71184)
@@ -115,7 +115,7 @@
                      + method.getReturnType() + " instead of java.lang.Object");
                }
                // throws Throwable
-               for (Class exceptionType: method.getExceptionTypes())
+               for (Class<?> exceptionType: method.getExceptionTypes())
                {
                   if (exceptionType == Throwable.class)
                   {

Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/advice/annotation/ParameterAnnotationRule.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/advice/annotation/ParameterAnnotationRule.java	2008-03-24 03:08:33 UTC (rev 71183)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/advice/annotation/ParameterAnnotationRule.java	2008-03-24 03:41:24 UTC (rev 71184)
@@ -1,5 +1,7 @@
 package org.jboss.aop.advice.annotation;
 
+import java.lang.annotation.Annotation;
+
 import org.jboss.aop.advice.AdviceMethodProperties;
 import org.jboss.aop.joinpoint.FieldReadInvocation;
 import org.jboss.aop.joinpoint.Invocation;
@@ -123,8 +125,8 @@
       } 
    };
    
-   private Class annotation;
-   private Class assignableFrom;
+   private Class<? extends Annotation> annotation;
+   private Class<?> assignableFrom;
    private int rankGrade;
    private boolean mandatory;
    private boolean singleEnforced;
@@ -146,7 +148,7 @@
     *                        annotation</code> in the advice method parameters is
     *                        forbidden
     */
-   private ParameterAnnotationRule(Class annotation, Class assignableFrom, int property,
+   private ParameterAnnotationRule(Class<? extends Annotation> annotation, Class<?> assignableFrom, int property,
          int rankGrade, boolean mandatory, boolean singleEnforced)
    {
       this.annotation = annotation;
@@ -161,7 +163,7 @@
     * Returns the annotation associated with this rule.
     * @return the annotation associated with this rule.
     */
-   public final Class getAnnotation()
+   public final Class<? extends Annotation> getAnnotation()
    {
       return annotation;
    }

Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/advice/annotation/assignability/ArgumentContextualizer.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/advice/annotation/assignability/ArgumentContextualizer.java	2008-03-24 03:08:33 UTC (rev 71183)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/advice/annotation/assignability/ArgumentContextualizer.java	2008-03-24 03:41:24 UTC (rev 71184)
@@ -36,7 +36,7 @@
 class ArgumentContextualizer
 {
    public static final Type[] getContextualizedArguments(ParameterizedType paramType,
-         Class rawType, Class desiredType)
+         Class<?> rawType, Class<?> desiredType)
    {
       ArgumentContextualizer contextualizedArguments = getContextualizedArgumentsInternal(
             desiredType, rawType);
@@ -151,7 +151,7 @@
     * @return <code>true</code> if the contextualization process was successfully
     *         performed; </code>false</code> otherwise.
     */
-   private boolean contextualizeVariables(Class subClass, Type superType)
+   private boolean contextualizeVariables(Class<?> subClass, Type superType)
    {
       if (!initialized || variableReplacements.isEmpty())
       {
@@ -227,9 +227,9 @@
       {
          return null;
       }
-      String paramName = ((TypeVariable) argument).getName();
+      String paramName = ((TypeVariable<?>) argument).getName();
       int index = 0;
-      TypeVariable[] typeVariables = declaringClass.getTypeParameters();
+      TypeVariable<?>[] typeVariables = declaringClass.getTypeParameters();
       for (index = 0; index < typeVariables.length; index ++)
       {
          if (typeVariables[index].getName().equals(paramName)){

Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/advice/annotation/assignability/AssignabilityAlgorithm.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/advice/annotation/assignability/AssignabilityAlgorithm.java	2008-03-24 03:08:33 UTC (rev 71183)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/advice/annotation/assignability/AssignabilityAlgorithm.java	2008-03-24 03:41:24 UTC (rev 71184)
@@ -49,14 +49,14 @@
       protected boolean assignValue(Type type, Type fromType,
             VariableHierarchy variableHierarchy)
       {
-         VariableNode node = variableHierarchy.getVariableNode((TypeVariable) type);
+         VariableNode node = variableHierarchy.getVariableNode((TypeVariable<?>) type);
          return node.assignValue(fromType);
       }
       
       protected boolean addBound(Type type, Type fromType,
             VariableHierarchy variableHierarchy)
       {
-         VariableNode node = variableHierarchy.getVariableNode((TypeVariable) type);
+         VariableNode node = variableHierarchy.getVariableNode((TypeVariable<?>) type);
          return node.addLowerBound(fromType);
       }
    },
@@ -75,14 +75,14 @@
       protected boolean assignValue(Type type, Type fromType,
             VariableHierarchy variableHierarchy)
       {
-         VariableNode fromNode = variableHierarchy.getVariableNode((TypeVariable) fromType);
+         VariableNode fromNode = variableHierarchy.getVariableNode((TypeVariable<?>) fromType);
          return fromNode.addMaximumUpperBound(type);
       }
       
       protected boolean addBound(Type type, Type fromType,
             VariableHierarchy variableHierarchy)
       {
-         VariableNode fromNode = variableHierarchy.getVariableNode((TypeVariable) fromType);
+         VariableNode fromNode = variableHierarchy.getVariableNode((TypeVariable<?>) fromType);
          return fromNode.addUpperBound(type);
       }
    };
@@ -216,11 +216,11 @@
     */
    public static Type[] getConcreteBounds(Type type)
    {
-      TypeVariable current = (TypeVariable) type;
+      TypeVariable<?> current = (TypeVariable<?>) type;
       Type[] bounds = current.getBounds();
       while (bounds.length == 1 && bounds[0] instanceof TypeVariable)
       {
-         current = (TypeVariable) bounds[0];
+         current = (TypeVariable<?>) bounds[0];
          bounds = current.getBounds();
       }
       return bounds;
@@ -231,7 +231,7 @@
    {
       if (fromType instanceof TypeVariable)
       {
-         Type[] concreteBounds = getConcreteBounds((TypeVariable) fromType);
+         Type[] concreteBounds = getConcreteBounds(fromType);
          try
          {
             variableHierarchy.startRealBoundComparation();

Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/advice/annotation/assignability/ChoiceBound.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/advice/annotation/assignability/ChoiceBound.java	2008-03-24 03:08:33 UTC (rev 71183)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/advice/annotation/assignability/ChoiceBound.java	2008-03-24 03:41:24 UTC (rev 71184)
@@ -33,12 +33,12 @@
  */
 class ChoiceBound implements Type
 {
-   public ChoiceBound(TypeVariable variable, Type[] bounds)
+   public ChoiceBound(TypeVariable<?> variable, Type[] bounds)
    {
       this.variable = variable;
       this.bounds = new LinkedList<Type>();
       Collections.addAll(this.bounds, bounds);
    }
-   TypeVariable variable;
+   TypeVariable<?> variable;
    Collection<Type> bounds;
 }
\ No newline at end of file

Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/advice/annotation/assignability/DegreeAlgorithm.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/advice/annotation/assignability/DegreeAlgorithm.java	2008-03-24 03:08:33 UTC (rev 71183)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/advice/annotation/assignability/DegreeAlgorithm.java	2008-03-24 03:41:24 UTC (rev 71184)
@@ -81,7 +81,7 @@
          return null;
       }
       Type componentType = ((GenericArrayType) type).getGenericComponentType();
-      Class componentClass = getClassType(componentType);
+      Class<?> componentClass = getClassType(componentType);
       try
       {
          return componentClass.getClassLoader().loadClass(
@@ -136,9 +136,9 @@
          // if is object, the degree is the size of this interface hierarchy + 1
          if (toType.getName() == "java.lang.Object")
          {
-            ArrayList<Class[]> list1 = new ArrayList<Class[]>();
-            ArrayList<Class[]> list2 = new ArrayList<Class[]>();
-            Class[] fromTypeInterfaces = fromType.getInterfaces();
+            ArrayList<Class<?>[]> list1 = new ArrayList<Class<?>[]>();
+            ArrayList<Class<?>[]> list2 = new ArrayList<Class<?>[]>();
+            Class<?>[] fromTypeInterfaces = fromType.getInterfaces();
             if (fromTypeInterfaces.length == 0)
             {
                return 1;
@@ -147,11 +147,11 @@
             short degree = 2;
             while (true)
             {
-               for (Class[] interfaces : list1)
+               for (Class<?>[] interfaces : list1)
                {
                   for (int i = 0; i < interfaces.length; i++)
                   {
-                     Class[] superInterfaces = interfaces[i].getInterfaces();
+                     Class<?>[] superInterfaces = interfaces[i].getInterfaces();
                      if (superInterfaces.length == 0)
                      {
                         return degree;
@@ -161,7 +161,7 @@
                }
                degree ++;
                list1.clear();
-               ArrayList<Class[]> temp = list1;
+               ArrayList<Class<?>[]> temp = list1;
                list1 = list2;
                list2 = temp;
             }
@@ -195,7 +195,7 @@
          return DegreeAlgorithm.NOT_ASSIGNABLE_DEGREE;
       }
       
-      Class[] interfaces = fromClassType.getInterfaces();
+      Class<?>[] interfaces = fromClassType.getInterfaces();
       for (int i = 0 ; i < interfaces.length ; i++)
       {
          if(interfaces[i] == toInterfaceType)
@@ -235,7 +235,7 @@
    private short getInterfaceInheritanceAD(Class<?> fromInterfaceType,
          Class<?> toInterfaceType, short currentDegree)
    {
-      Class[] interfaces = fromInterfaceType.getInterfaces();
+      Class<?>[] interfaces = fromInterfaceType.getInterfaces();
       currentDegree ++;
       for (int i = 0; i < interfaces.length; i++)
       {

Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/advice/annotation/assignability/VariableHierarchy.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/advice/annotation/assignability/VariableHierarchy.java	2008-03-24 03:08:33 UTC (rev 71183)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/advice/annotation/assignability/VariableHierarchy.java	2008-03-24 03:41:24 UTC (rev 71184)
@@ -49,7 +49,7 @@
       this.realBoundComparation = 0;
    }
    
-   VariableNode getVariableNode(TypeVariable typeVariable)
+   VariableNode getVariableNode(TypeVariable<?> typeVariable)
    {
       String key = typeVariable.getName();
       if (map.containsKey(key))

Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/advice/annotation/assignability/VariableNode.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/advice/annotation/assignability/VariableNode.java	2008-03-24 03:08:33 UTC (rev 71183)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/advice/annotation/assignability/VariableNode.java	2008-03-24 03:41:24 UTC (rev 71184)
@@ -43,10 +43,10 @@
    private VariableNode next;
    private Collection<Type> lowerBounds;
    private Collection<Type> upperBounds;
-   private TypeVariable variable;
+   private TypeVariable<?> variable;
    private Type assignedValue;
    
-   public VariableNode(TypeVariable content, VariableHierarchy hierarchy)
+   public VariableNode(TypeVariable<?> content, VariableHierarchy hierarchy)
    {
       this.hierarchy = hierarchy;
       this.variable = content;
@@ -55,7 +55,7 @@
       Type[] bounds = content.getBounds();
       if (bounds.length == 1 && bounds[0] instanceof TypeVariable)
       {
-         TypeVariable typeVariable = (TypeVariable) bounds[0];
+         TypeVariable<?> typeVariable = (TypeVariable<?>) bounds[0];
          next = hierarchy.getVariableNode(typeVariable);
          next.previous = this;
       }
@@ -90,8 +90,8 @@
       }
       if (lowerBound instanceof TypeVariable)
       {
-         Type[] bounds = ((TypeVariable) lowerBound).getBounds();
-         this.lowerBounds.add(new ChoiceBound((TypeVariable) lowerBound, bounds));
+         Type[] bounds = ((TypeVariable<?>) lowerBound).getBounds();
+         this.lowerBounds.add(new ChoiceBound((TypeVariable<?>) lowerBound, bounds));
       }
       else
       {
@@ -118,8 +118,8 @@
    {
       if (upperBound instanceof TypeVariable)
       {
-         Type[] bounds = ((TypeVariable) upperBound).getBounds();
-         this.upperBounds.add(new ChoiceBound((TypeVariable) upperBound, bounds));
+         Type[] bounds = ((TypeVariable<?>) upperBound).getBounds();
+         this.upperBounds.add(new ChoiceBound((TypeVariable<?>) upperBound, bounds));
       }
       else
       {
@@ -296,7 +296,7 @@
          }
          if(fromArgument instanceof TypeVariable)
          {
-            if (!isAssignable(upperBounds, ((TypeVariable) fromArgument).getBounds()))
+            if (!isAssignable(upperBounds, ((TypeVariable<?>) fromArgument).getBounds()))
             {
                return false;
             }
@@ -350,7 +350,7 @@
    {
       if (fromType instanceof TypeVariable)
       {
-         TypeVariable fromVariable = (TypeVariable) fromType;
+         TypeVariable<?> fromVariable = (TypeVariable<?>) fromType;
          if (type instanceof TypeVariable)
          {
             if (type == fromType)
@@ -364,7 +364,7 @@
                {
                   return true;
                }
-               fromVariable = (TypeVariable) fromBounds[0];
+               fromVariable = (TypeVariable<?>) fromBounds[0];
                fromBounds = fromVariable.getBounds();
             }
             return false;
@@ -383,7 +383,7 @@
       {
          ChoiceBound fromChoiceBound = (ChoiceBound) fromType;
          if (type instanceof TypeVariable &&
-               !isAssignable((TypeVariable) type, fromChoiceBound.variable))
+               !isAssignable(type, fromChoiceBound.variable))
          {
             return false;
          }
@@ -439,7 +439,7 @@
          }
          if (fromType instanceof TypeVariable)
          {
-            for (Type upperBound: ((TypeVariable) fromType).getBounds())
+            for (Type upperBound: ((TypeVariable<?>) fromType).getBounds())
             {
                if (isAssignable(type, upperBound))
                {
@@ -458,7 +458,7 @@
       }
       if (type instanceof TypeVariable)
       {
-         for (Type bound: ((TypeVariable) type).getBounds())
+         for (Type bound: ((TypeVariable<?>) type).getBounds())
          {
             if (!isAssignable(bound, fromType))
             {
@@ -488,7 +488,7 @@
       }
       ChoiceBound choiceBound = (ChoiceBound) type;
       if (fromType instanceof TypeVariable &&
-            !isAssignable(choiceBound.variable, (TypeVariable) fromType))
+            !isAssignable(choiceBound.variable, fromType))
       {
          return false;
       }

Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/annotation/AnnotationElement.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/annotation/AnnotationElement.java	2008-03-24 03:08:33 UTC (rev 71183)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/annotation/AnnotationElement.java	2008-03-24 03:41:24 UTC (rev 71184)
@@ -21,6 +21,7 @@
   */
 package org.jboss.aop.annotation;
 
+import java.lang.annotation.Annotation;
 import java.lang.reflect.Constructor;
 import java.lang.reflect.Field;
 import java.lang.reflect.Method;
@@ -29,6 +30,8 @@
 import java.security.PrivilegedActionException;
 import java.security.PrivilegedExceptionAction;
 
+import org.jboss.aop.util.ReflectUtils;
+
 /**
  * Bridge/portability class for resolving annotations in JDK 1.4 and JDK1.5
  * Should be usable in JDK 1.4 and also should support finding invisible annotations.
@@ -39,6 +42,7 @@
  */
 public class AnnotationElement extends PortableAnnotationElement
 {
+   private final static Annotation[] EMPTY_ANNOTATIONS = new Annotation[0];
    /**
     * Get a visible annotation for a particle Method.  If this is JDK 1.5
     * then this is a wrapper for Method.getAnnotation
@@ -47,7 +51,7 @@
     * @param annotation
     * @return
     */
-   public static Object getVisibleAnnotation(Method method, Class annotation)
+   public static <T extends Annotation> T getVisibleAnnotation(Method method, Class<T> annotation)
    {
       if (System.getSecurityManager() == null)
       {
@@ -67,7 +71,7 @@
     * @param annotation
     * @return
     */
-   public static Object getVisibleAnnotation(Constructor con, Class annotation)
+   public static <T extends Annotation> T getVisibleAnnotation(Constructor<?> con, Class<T> annotation)
    {
       if (System.getSecurityManager() == null)
       {
@@ -87,7 +91,7 @@
     * @param annotation
     * @return
     */
-   public static Object getVisibleAnnotation(Field field, Class annotation)
+   public static <T extends Annotation> T getVisibleAnnotation(Field field, Class<T> annotation)
    {
       if (System.getSecurityManager() == null)
       {
@@ -107,7 +111,7 @@
     * @param annotation
     * @return
     */
-   public static Object getVisibleAnnotation(Class clazz, Class annotation)
+   public static <T extends Annotation> T getVisibleAnnotation(Class<?> clazz, Class<T> annotation)
    {
       if (System.getSecurityManager() == null)
       {
@@ -119,7 +123,7 @@
       }
    }
 
-   public static boolean isVisibleAnnotationPresent(Class clazz, Class annotation)
+   public static boolean isVisibleAnnotationPresent(Class<?> clazz, Class<? extends Annotation> annotation)
    {
       if (System.getSecurityManager() == null)
       {
@@ -131,7 +135,7 @@
       }
    }
 
-   public static boolean isVisibleAnnotationPresent(Method m, Class annotation)
+   public static boolean isVisibleAnnotationPresent(Method m, Class<? extends Annotation> annotation)
    {
       if (System.getSecurityManager() == null)
       {
@@ -143,7 +147,7 @@
       }
    }
 
-   public static boolean isVisibleAnnotationPresent(Field f, Class annotation)
+   public static boolean isVisibleAnnotationPresent(Field f, Class<? extends Annotation> annotation)
    {
       if (System.getSecurityManager() == null)
       {
@@ -155,7 +159,7 @@
       }
    }
 
-   public static boolean isVisibleAnnotationPresent(Constructor con, Class annotation)
+   public static boolean isVisibleAnnotationPresent(Constructor<?> con, Class<? extends Annotation> annotation)
    {
       if (System.getSecurityManager() == null)
       {
@@ -167,10 +171,58 @@
       }
    }
 
-   public static Object[] getVisibleAnnotations(Class clazz) throws Exception
+   public static boolean isVisibleAnnotationPresent(Class<?> clazz, String annotation)
    {
       if (System.getSecurityManager() == null)
       {
+         return AnnotationElementAction.NON_PRIVILEGED.isVisibleAnnotationPresent(clazz, annotation);
+      }
+      else
+      {
+         return AnnotationElementAction.PRIVILEGED.isVisibleAnnotationPresent(clazz, annotation);
+      }
+   }
+
+   public static boolean isVisibleAnnotationPresent(Method m, String annotation)
+   {
+      if (System.getSecurityManager() == null)
+      {
+         return AnnotationElementAction.NON_PRIVILEGED.isVisibleAnnotationPresent(m, annotation);
+      }
+      else
+      {
+         return AnnotationElementAction.PRIVILEGED.isVisibleAnnotationPresent(m, annotation);
+      }
+   }
+
+   public static boolean isVisibleAnnotationPresent(Field f, String annotation)
+   {
+      if (System.getSecurityManager() == null)
+      {
+         return AnnotationElementAction.NON_PRIVILEGED.isVisibleAnnotationPresent(f, annotation);
+      }
+      else
+      {
+         return AnnotationElementAction.PRIVILEGED.isVisibleAnnotationPresent(f, annotation);
+      }
+   }
+
+   public static boolean isVisibleAnnotationPresent(Constructor<?> con, String annotation)
+   {
+      if (System.getSecurityManager() == null)
+      {
+         return AnnotationElementAction.NON_PRIVILEGED.isVisibleAnnotationPresent(con, annotation);
+      }
+      else
+      {
+         return AnnotationElementAction.PRIVILEGED.isVisibleAnnotationPresent(con, annotation);
+      }
+   }
+
+   public static Annotation[] getVisibleAnnotations(Class<?> clazz) throws Exception
+   {
+      if (System.getSecurityManager() == null)
+      {
          return AnnotationElementAction.NON_PRIVILEGED.getVisibleAnnotations(clazz);
       }
       else
@@ -179,7 +231,7 @@
       }
    }
 
-   public static Object[] getVisibleAnnotations(Method m) throws Exception
+   public static Annotation[] getVisibleAnnotations(Method m) throws Exception
    {
       if (System.getSecurityManager() == null)
       {
@@ -191,7 +243,7 @@
       }
    }
    
-   public static Object[] getVisibleAnnotations(Field f) throws Exception
+   public static Annotation[] getVisibleAnnotations(Field f) throws Exception
    {
       if (System.getSecurityManager() == null)
       {
@@ -203,7 +255,7 @@
       }
    }
    
-   public static Object[] getVisibleAnnotations(Constructor c) throws Exception
+   public static Annotation[] getVisibleAnnotations(Constructor<?> c) throws Exception
    {
       if (System.getSecurityManager() == null)
       {
@@ -218,141 +270,300 @@
    
    private interface AnnotationElementAction
    {
-      Object getVisibleAnnotation(Method method, Class annotation);
+      <T extends Annotation> T getVisibleAnnotation(Method method, Class<T> annotation);
 
-      Object getVisibleAnnotation(Constructor con, Class annotation);
+      <T extends Annotation> T getVisibleAnnotation(Constructor<?> con, Class<T> annotation);
 
-      Object getVisibleAnnotation(Field field, Class annotation);
+      <T extends Annotation> T getVisibleAnnotation(Field field, Class<T> annotation);
 
-      Object getVisibleAnnotation(Class clazz, Class annotation);
+      <T extends Annotation> T getVisibleAnnotation(Class<?> clazz, Class<T> annotation);
+      
+      <T extends Annotation> T getVisibleAnnotation(Method method, String annotation);
 
-      boolean isVisibleAnnotationPresent(Class clazz, Class annotation);
+      <T extends Annotation> T getVisibleAnnotation(Constructor<?> con, String annotation);
 
-      boolean isVisibleAnnotationPresent(Method m, Class annotation);
+      <T extends Annotation> T getVisibleAnnotation(Field field, String annotation);
 
-      boolean isVisibleAnnotationPresent(Field f, Class annotation);
+      <T extends Annotation> T getVisibleAnnotation(Class<?> clazz, String annotation);
 
-      boolean isVisibleAnnotationPresent(Constructor con, Class annotation);
+      boolean isVisibleAnnotationPresent(Class<?> clazz, Class<? extends Annotation> annotation);
 
-      Object[] getVisibleAnnotations(Class clazz) throws Exception;
+      boolean isVisibleAnnotationPresent(Method m, Class<? extends Annotation> annotation);
 
-      Object[] getVisibleAnnotations(Method m) throws Exception;
+      boolean isVisibleAnnotationPresent(Field f, Class<? extends Annotation> annotation);
+
+      boolean isVisibleAnnotationPresent(Constructor<?> con, Class<? extends Annotation> annotation);
       
-      Object[] getVisibleAnnotations(Field f) throws Exception;
+      boolean isVisibleAnnotationPresent(Class<?> clazz, String annotation);
+
+      boolean isVisibleAnnotationPresent(Method m, String annotation);
+
+      boolean isVisibleAnnotationPresent(Field f, String annotation);
+
+      boolean isVisibleAnnotationPresent(Constructor<?> con, String annotation);
+
+      <T extends Annotation> T[] getVisibleAnnotations(Class<?> clazz) throws Exception;
+
+      <T extends Annotation> T[] getVisibleAnnotations(Method m) throws Exception;
       
-      Object[] getVisibleAnnotations(Constructor c) throws Exception;
+      <T extends Annotation> T[] getVisibleAnnotations(Field f) throws Exception;
       
+      <T extends Annotation> T[] getVisibleAnnotations(Constructor<?> c) throws Exception;
+      
       AnnotationElementAction NON_PRIVILEGED = new AnnotationElementAction()
       {
-         public Object getVisibleAnnotation(Method method, Class annotation)
+         public <T extends Annotation> T getVisibleAnnotation(Method method, Class<T> annotation)
          {
             return method.getAnnotation(annotation);
          }
 
-         public Object getVisibleAnnotation(Constructor con, Class annotation)
+         public <T extends Annotation> T getVisibleAnnotation(Constructor<?> con, Class<T> annotation)
          {
             return con.getAnnotation(annotation);
          }
 
-         public Object getVisibleAnnotation(Field field, Class annotation)
+         public <T extends Annotation> T getVisibleAnnotation(Field field, Class<T> annotation)
          {
             return field.getAnnotation(annotation);
          }
 
-         public Object getVisibleAnnotation(Class clazz, Class annotation)
+         public <T extends Annotation> T getVisibleAnnotation(Class<?> clazz, Class<T> annotation)
          {
             return clazz.getAnnotation(annotation);
          }
+         public <T extends Annotation> T getVisibleAnnotation(Method method, String annotation)
+         {
+            for(Annotation a : getVisibleAnnotations(method))
+            {
+                if(a.annotationType().getName().equals(annotation))
+                  return (T)a;
+            }
+            return null;
+         }
 
-         public boolean isVisibleAnnotationPresent(Class clazz, Class annotation)
+         public <T extends Annotation> T  getVisibleAnnotation(Constructor<?> con, String annotation)
          {
+            for(Annotation a : getVisibleAnnotations(con))
+            {
+                if(a.annotationType().getName().equals(annotation))
+                  return (T)a;
+            }
+            return null;
+         }
+
+         public <T extends Annotation> T  getVisibleAnnotation(Field field, String annotation)
+         {
+            for(Annotation a : getVisibleAnnotations(field))
+            {
+                if(a.annotationType().getName().equals(annotation))
+                  return (T)a;
+            }
+            return null;
+         }
+
+         public <T extends Annotation> T getVisibleAnnotation(Class<?> clazz, String annotation)
+         {
+            for(Annotation a : getVisibleAnnotations(clazz))
+            {
+                if(a.annotationType().getName().equals(annotation))
+                  return (T)a;
+            }
+            return null;
+         }
+
+         public boolean isVisibleAnnotationPresent(Class<?> clazz, Class<? extends Annotation> annotation)
+         {
             return clazz.isAnnotationPresent(annotation);
          }
 
-         public boolean isVisibleAnnotationPresent(Method m, Class annotation)
+         public boolean isVisibleAnnotationPresent(Method m, Class<? extends Annotation> annotation)
          {
             return m.isAnnotationPresent(annotation);
          }
 
-         public boolean isVisibleAnnotationPresent(Field f, Class annotation)
+         public boolean isVisibleAnnotationPresent(Field f, Class<? extends Annotation> annotation)
          {
             return f.isAnnotationPresent(annotation);
          }
 
-         public boolean isVisibleAnnotationPresent(Constructor con, Class annotation)
+         public boolean isVisibleAnnotationPresent(Constructor<?> con, Class<? extends Annotation> annotation)
          {
             return con.isAnnotationPresent(annotation);
          }
+         
+         public boolean isVisibleAnnotationPresent(Class<?> clazz, String annotation)
+         {
+            for(Annotation a : getVisibleAnnotations(clazz))
+            {
+                if(a.annotationType().getName().equals(annotation))
+                  return true;
+            }
+            return false;
+         }
 
-         public Object[] getVisibleAnnotations(Class clazz) throws Exception
+         public boolean isVisibleAnnotationPresent(Method m, String annotation)
          {
-            return clazz.getAnnotations();
+            for(Annotation a : getVisibleAnnotations(m))
+            {
+                if(a.annotationType().getName().equals(annotation))
+                  return true;
+            }
+            return false;
          }
 
-         public Object[] getVisibleAnnotations(Method m) throws Exception
+         public boolean isVisibleAnnotationPresent(Field f, String annotation)
          {
-            return m.getAnnotations();
+            for(Annotation a : getVisibleAnnotations(f))
+            {
+                if(a.annotationType().getName().equals(annotation))
+                  return true;
+            }
+            return false;
          }
+
+         public boolean isVisibleAnnotationPresent(Constructor<?> con, String annotation)
+         {
+            for(Annotation a : getVisibleAnnotations(con))
+            {
+                if(a.annotationType().getName().equals(annotation))
+                  return true;
+            }
+            return false;
+         }
+
+         public <T extends Annotation> T[] getVisibleAnnotations(Class<?> clazz)
+         {
+            return (T[])clazz.getAnnotations();
+         }
+
+         public <T extends Annotation> T[] getVisibleAnnotations(Method m)
+         {
+            if (m.getName().startsWith("access$") && !ReflectUtils.isNotAccessMethod(m))
+            {
+               return (T[]) EMPTY_ANNOTATIONS;
+            }
+            return (T[])m.getAnnotations();
+         }
          
-         public Object[] getVisibleAnnotations(Field f) throws Exception
+         public <T extends Annotation> T[] getVisibleAnnotations(Field f)
          {
-            return f.getAnnotations();
+            return (T[])f.getAnnotations();
          }
          
-         public Object[] getVisibleAnnotations(Constructor c) throws Exception
+         public <T extends Annotation> T[] getVisibleAnnotations(Constructor<?> c)
          {
-            return c.getAnnotations();
+            return (T[])c.getAnnotations();
          }
       };
       
 
       AnnotationElementAction PRIVILEGED = new AnnotationElementAction()
       {
-         public Object getVisibleAnnotation(final Method method, final Class annotation)
+         public <T extends Annotation> T getVisibleAnnotation(final Method method, final Class<T> annotation)
          {
-            return AccessController.doPrivileged(new PrivilegedAction(){
-               public Object run()
+            return AccessController.doPrivileged(new PrivilegedAction<T>(){
+               public T run()
                {
                   return method.getAnnotation(annotation);
                }
             });
          }
 
-         public Object getVisibleAnnotation(final Constructor con, final Class annotation)
+         public <T extends Annotation> T  getVisibleAnnotation(final Constructor<?> con, final Class<T> annotation)
          {
-            return AccessController.doPrivileged(new PrivilegedAction(){
-               public Object run()
+            return AccessController.doPrivileged(new PrivilegedAction<T>(){
+               public T run()
                {
                   return con.getAnnotation(annotation);
                }
             });
          }
 
-         public Object getVisibleAnnotation(final Field field, final Class annotation)
+         public <T extends Annotation> T getVisibleAnnotation(final Field field, final Class<T> annotation)
          {
-            return AccessController.doPrivileged(new PrivilegedAction(){
-               public Object run()
+            return AccessController.doPrivileged(new PrivilegedAction<T>(){
+               public T run()
                {
                   return field.getAnnotation(annotation);
                }
             });
          }
 
-         public Object getVisibleAnnotation(final Class clazz, final Class annotation)
+         public <T extends Annotation> T getVisibleAnnotation(final Class<?> clazz, final Class<T> annotation)
          {
-            return AccessController.doPrivileged(new PrivilegedAction(){
-               public Object run()
+            return AccessController.doPrivileged(new PrivilegedAction<T>(){
+               public T run()
                {
                   return clazz.getAnnotation(annotation);
                }
             });
          }
 
-         public boolean isVisibleAnnotationPresent(final Class clazz, final Class annotation)
+         public <T extends Annotation> T getVisibleAnnotation(final Method method, final String annotation)
          {
-            Boolean present = (Boolean)AccessController.doPrivileged(new PrivilegedAction(){
-               public Object run()
+            return AccessController.doPrivileged(new PrivilegedAction<T>(){
+               public T run()
                {
+                  for(Annotation a : method.getAnnotations())
+                  {
+                      if(a.annotationType().getName().equals(annotation))
+                        return (T)a;
+                  }
+                  return null;
+               }
+            });
+         }
+
+         public <T extends Annotation> T getVisibleAnnotation(final Constructor<?> con, final String annotation)
+         {
+            return AccessController.doPrivileged(new PrivilegedAction<T>(){
+               public T run()
+               {
+                  for(Annotation a : con.getAnnotations())
+                  {
+                      if(a.annotationType().getName().equals(annotation))
+                        return (T)a;
+                  }
+                  return null;
+               }
+            });
+         }
+
+         public <T extends Annotation> T getVisibleAnnotation(final Field field, final String annotation)
+         {
+            return AccessController.doPrivileged(new PrivilegedAction<T>(){
+               public T run()
+               {
+                  for(Annotation a : field.getAnnotations())
+                  {
+                      if(a.annotationType().getName().equals(annotation))
+                        return (T)a;
+                  }
+                  return null;
+               }
+            });
+         }
+
+         public <T extends Annotation> T getVisibleAnnotation(final Class<?> clazz, final String annotation)
+         {
+            return AccessController.doPrivileged(new PrivilegedAction<T>(){
+               public T run()
+               {
+                  for(Annotation a : clazz.getAnnotations())
+                  {
+                      if(a.annotationType().getName().equals(annotation))
+                        return (T)a;
+                  }
+                  return null;
+               }
+            });
+         }
+         
+         public boolean isVisibleAnnotationPresent(final Class<?> clazz, final Class<? extends Annotation> annotation)
+         {
+            Boolean present = AccessController.doPrivileged(new PrivilegedAction<Boolean>(){
+               public Boolean run()
+               {
                   return clazz.isAnnotationPresent(annotation) ? Boolean.TRUE : Boolean.FALSE;
                }
             });
@@ -360,10 +571,10 @@
             return present.booleanValue();
          }
 
-         public boolean isVisibleAnnotationPresent(final Method m, final Class annotation)
+         public boolean isVisibleAnnotationPresent(final Method m, final Class<? extends Annotation> annotation)
          {
-            Boolean present = (Boolean)AccessController.doPrivileged(new PrivilegedAction(){
-               public Object run()
+            Boolean present = AccessController.doPrivileged(new PrivilegedAction<Boolean>(){
+               public Boolean run()
                {
                   return m.isAnnotationPresent(annotation) ? Boolean.TRUE : Boolean.FALSE;
                }
@@ -372,10 +583,10 @@
             return present.booleanValue();
          }
 
-         public boolean isVisibleAnnotationPresent(final Field f, final Class annotation)
+         public boolean isVisibleAnnotationPresent(final Field f, final Class<? extends Annotation> annotation)
          {
-            Boolean present = (Boolean)AccessController.doPrivileged(new PrivilegedAction(){
-               public Object run()
+            Boolean present = AccessController.doPrivileged(new PrivilegedAction<Boolean>(){
+               public Boolean run()
                {
                   return f.isAnnotationPresent(annotation) ? Boolean.TRUE : Boolean.FALSE;
                }
@@ -383,10 +594,10 @@
             return present;
          }
 
-         public boolean isVisibleAnnotationPresent(final Constructor con, final Class annotation)
+         public boolean isVisibleAnnotationPresent(final Constructor<?> con, final Class<? extends Annotation> annotation)
          {
-            Boolean present = (Boolean)AccessController.doPrivileged(new PrivilegedAction(){
-               public Object run()
+            Boolean present = AccessController.doPrivileged(new PrivilegedAction<Boolean>(){
+               public Boolean run()
                {
                   return con.isAnnotationPresent(annotation) ? Boolean.TRUE : Boolean.FALSE;
                }
@@ -394,15 +605,82 @@
             return present;
          }
 
-         public Object[] getVisibleAnnotations(final Class clazz) throws Exception 
+
+         public boolean isVisibleAnnotationPresent(final Class<?> clazz, final String annotation)
          {
+            Boolean present = AccessController.doPrivileged(new PrivilegedAction<Boolean>(){
+               public Boolean run()
+               {
+                  for(Annotation a : clazz.getAnnotations())
+                  {
+                      if(a.annotationType().getName().equals(annotation))
+                        return Boolean.TRUE;
+                  }
+                  return Boolean.FALSE;
+               }
+            });
+            
+            return present.booleanValue();
+         }
+
+         public boolean isVisibleAnnotationPresent(final Method m, final String annotation)
+         {
+            Boolean present = AccessController.doPrivileged(new PrivilegedAction<Boolean>(){
+               public Boolean run()
+               {
+                  for(Annotation a : m.getAnnotations())
+                  {
+                      if(a.annotationType().getName().equals(annotation))
+                        return Boolean.TRUE;
+                  }
+                  return Boolean.FALSE;
+               }
+            });
+            
+            return present.booleanValue();
+         }
+
+         public boolean isVisibleAnnotationPresent(final Field f, final String annotation)
+         {
+            Boolean present = AccessController.doPrivileged(new PrivilegedAction<Boolean>(){
+               public Boolean run()
+               {
+                  for(Annotation a : f.getAnnotations())
+                  {
+                      if(a.annotationType().getName().equals(annotation))
+                        return Boolean.TRUE;
+                  }
+                  return Boolean.FALSE;
+               }
+            });
+            return present;
+         }
+
+         public boolean isVisibleAnnotationPresent(final Constructor<?> con, final String annotation)
+         {
+            Boolean present = AccessController.doPrivileged(new PrivilegedAction<Boolean>(){
+               public Boolean run()
+               {
+                  for(Annotation a : con.getAnnotations())
+                  {
+                      if(a.annotationType().getName().equals(annotation))
+                        return Boolean.TRUE;
+                  }
+                  return Boolean.FALSE;
+               }
+            });
+            return present;
+         }
+
+         public <T extends Annotation> T[] getVisibleAnnotations(final Class<?> clazz) throws Exception 
+         {
             try
             {
-               return (Object[])AccessController.doPrivileged(new PrivilegedExceptionAction()
+               return AccessController.doPrivileged(new PrivilegedExceptionAction<T[]>()
                {
-                  public Object run() throws Exception
+                  public T[] run() throws Exception
                   {
-                     return clazz.getAnnotations();
+                     return (T[])clazz.getAnnotations();
                   }
                });
             }
@@ -412,14 +690,18 @@
             }
          }
 
-         public Object[] getVisibleAnnotations(final Method m) throws Exception 
+         public <T extends Annotation> T[] getVisibleAnnotations(final Method m) throws Exception 
          {
             try
             {
-               return (Object[])AccessController.doPrivileged(new PrivilegedExceptionAction(){
-                  public Object run() throws Exception
+               return AccessController.doPrivileged(new PrivilegedExceptionAction<T[]>(){
+                  public T[] run() throws Exception
                   {
-                     return m.getAnnotations();
+                     if (m.getName().startsWith("access$") && !ReflectUtils.isNotAccessMethod(m))
+                     {
+                        return (T[])EMPTY_ANNOTATIONS;
+                     }
+                     return (T[])m.getAnnotations();
                   }
                });
             }
@@ -429,14 +711,14 @@
             }
          }
          
-         public Object[] getVisibleAnnotations(final Field f) throws Exception
+         public <T extends Annotation> T[] getVisibleAnnotations(final Field f) throws Exception
          {
             try
             {
-               return (Object[])AccessController.doPrivileged(new PrivilegedExceptionAction(){
-                  public Object run() throws Exception
+               return AccessController.doPrivileged(new PrivilegedExceptionAction<T[]>(){
+                  public T[] run() throws Exception
                   {
-                     return f.getAnnotations();
+                     return (T[])f.getAnnotations();
                   }
                });
             }
@@ -446,14 +728,14 @@
             }
          }
          
-         public Object[] getVisibleAnnotations(final Constructor c) throws Exception
+         public <T extends Annotation> T[] getVisibleAnnotations(final Constructor<?> c) throws Exception
          {
             try
             {
-               return (Object[])AccessController.doPrivileged(new PrivilegedExceptionAction(){
-                  public Object run() throws Exception
+               return AccessController.doPrivileged(new PrivilegedExceptionAction<T[]>(){
+                  public T[] run() throws Exception
                   {
-                     return c.getAnnotations();
+                     return (T[])c.getAnnotations();
                   }
                });
             }

Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/annotation/AnnotationRepository.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/annotation/AnnotationRepository.java	2008-03-24 03:08:33 UTC (rev 71183)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/annotation/AnnotationRepository.java	2008-03-24 03:41:24 UTC (rev 71184)
@@ -30,7 +30,6 @@
 import java.util.Map;
 import java.util.Set;
 import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.locks.ReentrantReadWriteLock;
 
 import org.jboss.annotation.factory.AnnotationCreator;
 import org.jboss.aop.util.UnmodifiableEmptyCollections;
@@ -39,6 +38,7 @@
 
 /**
  * Repository for annotations that is used by the ClassAdvisor to override annotations.
+ * Generics have not been added to this class since that causes problems with EJB3 who have a class overriding this one
  *
  * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
  * @version $Revision$
@@ -48,17 +48,19 @@
    private static final String CLASS_ANNOTATION = "CLASS";
    
    /** Read/Write lock to be used when lazy creating the collections */
-   protected ReentrantReadWriteLock lock = new ReentrantReadWriteLock();
+   protected Object lazyCollectionLock = new Object();
 
-   volatile Map annotations = UnmodifiableEmptyCollections.EMPTY_CONCURRENT_HASHMAP;
-   volatile Map classAnnotations = UnmodifiableEmptyCollections.EMPTY_CONCURRENT_HASHMAP;
-   volatile Map disabledAnnotations = UnmodifiableEmptyCollections.EMPTY_CONCURRENT_HASHMAP;
+   @SuppressWarnings("unchecked") volatile Map annotations = UnmodifiableEmptyCollections.EMPTY_CONCURRENT_HASHMAP;
+   @SuppressWarnings("unchecked") volatile Map classAnnotations = UnmodifiableEmptyCollections.EMPTY_CONCURRENT_HASHMAP;
+   @SuppressWarnings("unchecked") volatile Map disabledAnnotations = UnmodifiableEmptyCollections.EMPTY_CONCURRENT_HASHMAP;
    
+   @SuppressWarnings("unchecked") 
    public Map getAnnotations()
    {
 	   return annotations;
    }
    
+   @SuppressWarnings("unchecked") 
    public Map getClassAnnotations()
    {
 	   return classAnnotations;
@@ -70,12 +72,14 @@
       classAnnotations.put(annotation, value);
    }
 
+   @SuppressWarnings("unchecked")
    public void addClassAnnotation(Class annotation, Object value)
    {
       initClassAnnotationsMap();
       classAnnotations.put(annotation.getName(), value);
    }
 
+   @SuppressWarnings("unchecked")
    public Object resolveClassAnnotation(Class annotation)
    {
       Object value = classAnnotations.get(annotation.getName());
@@ -88,6 +92,7 @@
       return value;
    }
 
+   @SuppressWarnings("unchecked")
    public Object resolveAnnotation(Member m, Class annotation)
    {
       Object value = resolveAnnotation(m, annotation.getName());
@@ -100,6 +105,7 @@
       return value;
    }
 
+   @SuppressWarnings("unchecked")
    protected Object extractAnnotation(Object value, Class annotation)
    {
       if (value == null) return null;
@@ -118,6 +124,7 @@
       return value;
    }
 
+   @SuppressWarnings("unchecked")
    protected Object resolveAnnotation(Member m, String annotation)
    {
       Map map = (Map) annotations.get(m);
@@ -128,6 +135,7 @@
       return null;
    }
    
+   @SuppressWarnings("unchecked")
    public void disableAnnotation(Member m, String annotation)
    {
       List annotationList = (List)disabledAnnotations.get(m);
@@ -140,6 +148,7 @@
       annotationList.add(annotation);
    }
    
+   @SuppressWarnings("unchecked")
    public void disableAnnotation(String annotation)
    {
       List annotationList = (List)disabledAnnotations.get(CLASS_ANNOTATION);
@@ -152,6 +161,7 @@
       annotationList.add(annotation);
    }
    
+   @SuppressWarnings("unchecked")
    public void enableAnnotation(String annotation)
    {
       List annotationList = (List)disabledAnnotations.get(CLASS_ANNOTATION);
@@ -162,11 +172,13 @@
       
    }
    
+   @SuppressWarnings("unchecked")
    public boolean isDisabled(Member m, Class annotation)
    {
       return isDisabled(m,annotation.getName());
    }
    
+   @SuppressWarnings("unchecked")
    public boolean isDisabled(Member m, String annotation)
    {
       List overrideList = (List)disabledAnnotations.get(m);
@@ -183,11 +195,13 @@
       return false;
    }
    
+   @SuppressWarnings("unchecked")
    public boolean isDisabled(Class annotation)
    {
       return isDisabled(annotation.getName());
    }
    
+   @SuppressWarnings("unchecked")
    public boolean isDisabled(String annotation)
    {
       List overrideList = (List)disabledAnnotations.get(CLASS_ANNOTATION);
@@ -204,6 +218,7 @@
       return false;
    }
 
+   @SuppressWarnings("unchecked")
    public void addAnnotation(Member m, Class annotation, Object value)
    {
       Map map = (Map) annotations.get(m);
@@ -216,6 +231,7 @@
       map.put(annotation.getName(), value);
    }
 
+   @SuppressWarnings("unchecked")
    public void addAnnotation(Member m, String annotation, Object value)
    {
       Map map = (Map) annotations.get(m);
@@ -233,11 +249,13 @@
       return classAnnotations.containsKey(annotation);
    }
 
+   @SuppressWarnings("unchecked")
    public boolean hasClassAnnotation(Class annotation)
    {
       return classAnnotations.containsKey(annotation.getName());
    }
 
+   @SuppressWarnings("unchecked")
    public boolean hasAnnotation(Member m, Class annotation)
    {
       return resolveAnnotation(m, annotation.getName()) != null;
@@ -248,6 +266,7 @@
       return resolveAnnotation(m, annotation) != null;
    }
 
+   @SuppressWarnings("unchecked")
    public boolean hasAnnotation(CtMember m, String annotation)
    {
       Set set = (Set) annotations.get(m);
@@ -255,6 +274,7 @@
       return false;
    }
 
+   @SuppressWarnings("unchecked")
    public void addAnnotation(CtMember m, String annotation)
    {
       Set set = (Set) annotations.get(m);
@@ -267,76 +287,48 @@
       set.add(annotation);
    }
 
-   /**
-    * Lock for write
-    */
-   protected void lockWrite()
-   {
-      lock.writeLock().lock();
-   }
-
-   /**
-    * Unlock for write
-    */
-   protected void unlockWrite()
-   {
-      lock.writeLock().unlock();
-   }
-
+   @SuppressWarnings("unchecked")
    protected void initAnnotationsMap()
    {
       if (annotations == UnmodifiableEmptyCollections.EMPTY_CONCURRENT_HASHMAP)
       {
-         lockWrite();
-         try
+         synchronized(lazyCollectionLock)
          {
             if (annotations == UnmodifiableEmptyCollections.EMPTY_CONCURRENT_HASHMAP)
             {
                annotations = new ConcurrentHashMap();;
             }
          }
-         finally
-         {
-            unlockWrite();
-         }
       }
    }
 
+   @SuppressWarnings("unchecked")
    protected void initClassAnnotationsMap()
    {
       if (classAnnotations == UnmodifiableEmptyCollections.EMPTY_CONCURRENT_HASHMAP)
       {
-         lockWrite();
-         try
+         synchronized(lazyCollectionLock)
          {
             if (classAnnotations == UnmodifiableEmptyCollections.EMPTY_CONCURRENT_HASHMAP)
             {
                classAnnotations = new ConcurrentHashMap();;
             }
          }
-         finally
-         {
-            unlockWrite();
-         }
       }
    }
 
+   @SuppressWarnings("unchecked")
    protected void initDisabledAnnotationsMap()
    {
       if (disabledAnnotations == UnmodifiableEmptyCollections.EMPTY_CONCURRENT_HASHMAP)
       {
-         lockWrite();
-         try
+         synchronized(lazyCollectionLock)
          {
             if (disabledAnnotations == UnmodifiableEmptyCollections.EMPTY_CONCURRENT_HASHMAP)
             {
                disabledAnnotations = new ConcurrentHashMap();;
             }
          }
-         finally
-         {
-            unlockWrite();
-         }
       }
    }
 }

Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/annotation/PortableAnnotationElement.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/annotation/PortableAnnotationElement.java	2008-03-24 03:08:33 UTC (rev 71183)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/annotation/PortableAnnotationElement.java	2008-03-24 03:41:24 UTC (rev 71184)
@@ -21,12 +21,6 @@
   */
 package org.jboss.aop.annotation;
 
-import java.lang.reflect.Constructor;
-import java.lang.reflect.Field;
-import java.lang.reflect.Method;
-import java.lang.reflect.Proxy;
-import java.util.Collection;
-
 import javassist.ClassPool;
 import javassist.CtClass;
 import javassist.CtConstructor;
@@ -37,12 +31,17 @@
 import javassist.bytecode.ClassFile;
 import javassist.bytecode.FieldInfo;
 import javassist.bytecode.MethodInfo;
-import javassist.bytecode.annotation.Annotation;
 
+import org.jboss.aop.AspectManager;
 import org.jboss.annotation.factory.javassist.AnnotationProxy;
-import org.jboss.aop.AspectManager;
 import org.jboss.aop.util.ReflectToJavassist;
 
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.util.Collection;
+
 /**
  * This base class is portable between JDK 1.4 and JDK 1.5
  * AnnotationElement will be different for JDK 1.4 and JDK 1.5
@@ -52,25 +51,53 @@
  */
 public class PortableAnnotationElement
 {
+   private static volatile boolean closingDownManager;
+   
+   public static void setClosingDownManager(boolean closing)
+   {
+      closingDownManager = closing; 
+   }
+   
    public static boolean isInvisibleAnnotationPresent(Field field, String annotation) throws Exception
    {
-      CtField ctMethod = ReflectToJavassist.fieldToJavassist(field);
-      return AnnotationElement.isInvisibleAnnotationPresent(ctMethod, annotation);
-
+      if (closingDownManager)
+      {
+         return false;
+      }
+      if(includeInvisibleAnnotation(annotation))
+      {
+         CtField ctMethod = ReflectToJavassist.fieldToJavassist(field);
+         return AnnotationElement.isInvisibleAnnotationPresent(ctMethod, annotation);
+      }
+      else
+         return false;
    }
 
    public static boolean isInvisibleAnnotationPresent(CtField field, String annotation)
    {
-      FieldInfo mi = field.getFieldInfo2();
+      if (closingDownManager)
+      {
+         return false;
+      }
+      if(includeInvisibleAnnotation(annotation))
+      {
+         FieldInfo mi = field.getFieldInfo2();
 
-      AnnotationsAttribute invisible = (AnnotationsAttribute) mi.getAttribute(AnnotationsAttribute.invisibleTag);
-      if (invisible == null) return false;
+         AnnotationsAttribute invisible = (AnnotationsAttribute) mi.getAttribute(AnnotationsAttribute.invisibleTag);
+         if (invisible == null) return false;
 
-      return invisible.getAnnotation(annotation) != null;
+         return invisible.getAnnotation(annotation) != null;
+      }
+      else
+         return false;
    }
 
    public static boolean isVisibleAnnotationPresent(CtField field, String annotation)
    {
+      if (closingDownManager)
+      {
+         return false;
+      }
       FieldInfo mi = field.getFieldInfo2();
 
       AnnotationsAttribute visible = (AnnotationsAttribute) mi.getAttribute(AnnotationsAttribute.visibleTag);
@@ -91,7 +118,7 @@
       AnnotationsAttribute visible = (AnnotationsAttribute) fi.getAttribute(AnnotationsAttribute.visibleTag);
       if (visible != null)
       {
-         for (Annotation annotation: visible.getAnnotations())
+         for (javassist.bytecode.annotation.Annotation annotation: visible.getAnnotations())
          {
             annotationNames.add(annotation.getTypeName());
          }
@@ -99,7 +126,7 @@
       AnnotationsAttribute invisible = (AnnotationsAttribute) fi.getAttribute(AnnotationsAttribute.invisibleTag);
       if (invisible != null)
       {
-         for (Annotation annotation: visible.getAnnotations())
+         for (javassist.bytecode.annotation.Annotation annotation: invisible.getAnnotations())
          {
             annotationNames.add(annotation.getTypeName());
          }
@@ -108,6 +135,10 @@
    
    public static boolean isAnyAnnotationPresent(CtField ctField, String annotation)
    {
+      if (closingDownManager)
+      {
+         return false;
+      }
       FieldInfo mi = ctField.getFieldInfo2();
 
       AnnotationsAttribute visible = (AnnotationsAttribute) mi.getAttribute(AnnotationsAttribute.visibleTag);
@@ -116,33 +147,56 @@
          if (visible.getAnnotation(annotation) != null) return true;
       }
 
-      AnnotationsAttribute invisible = (AnnotationsAttribute) mi.getAttribute(AnnotationsAttribute.invisibleTag);
-      if (invisible != null)
+      if(includeInvisibleAnnotation(annotation))
       {
-         if (invisible.getAnnotation(annotation) != null) return true;
+         AnnotationsAttribute invisible = (AnnotationsAttribute) mi.getAttribute(AnnotationsAttribute.invisibleTag);
+         if (invisible != null)
+         {
+            if (invisible.getAnnotation(annotation) != null) return true;
+         }
+         return false;
       }
-
-      return false;
+      else
+         return false;
    }
 
    public static boolean isInvisibleAnnotationPresent(Method method, String annotation) throws Exception
    {
-      CtMethod ctMethod = ReflectToJavassist.methodToJavassist(method);
-      if (ctMethod == null) return false;
-      MethodInfo mi = ctMethod.getMethodInfo2();
+      if (closingDownManager)
+      {
+         return false;
+      }
+      if(includeInvisibleAnnotation(annotation))
+      {
+         CtMethod ctMethod = ReflectToJavassist.methodToJavassist(method);
+         if (ctMethod == null) return false;
+         MethodInfo mi = ctMethod.getMethodInfo2();
 
 
-      AnnotationsAttribute invisible = (AnnotationsAttribute) mi.getAttribute(AnnotationsAttribute.invisibleTag);
-      if (invisible == null) return false;
+         AnnotationsAttribute invisible = (AnnotationsAttribute) mi.getAttribute(AnnotationsAttribute.invisibleTag);
+         if (invisible == null) return false;
 
-
-      return invisible.getAnnotation(annotation) != null;
+         return invisible.getAnnotation(annotation) != null;
+      }
+      else
+         return false;
    }
 
    public static boolean isAnyAnnotationPresent(Field field, String annotation) throws Exception
    {
-      CtField ctField = ReflectToJavassist.fieldToJavassist(field);
-      return AnnotationElement.isAnyAnnotationPresent(ctField, annotation);
+      if (closingDownManager)
+      {
+         return false;
+      }
+      if(AnnotationElement.isVisibleAnnotationPresent(field, annotation))
+         return true;
+      if(includeInvisibleAnnotation(annotation))
+      {
+         CtField ctField = ReflectToJavassist.fieldToJavassist(field);
+         return AnnotationElement.isAnyAnnotationPresent(ctField, annotation);
+      }
+      else
+         return false;
 
    }
    
@@ -158,7 +212,7 @@
       AnnotationsAttribute visible = (AnnotationsAttribute) mi.getAttribute(AnnotationsAttribute.visibleTag);
       if (visible != null)
       {
-         for (Annotation annotation: visible.getAnnotations())
+         for (javassist.bytecode.annotation.Annotation annotation: visible.getAnnotations())
          {
             annotationNames.add(annotation.getTypeName());
          }
@@ -166,7 +220,7 @@
       AnnotationsAttribute invisible = (AnnotationsAttribute) mi.getAttribute(AnnotationsAttribute.invisibleTag);
       if (invisible != null)
       {
-         for (Annotation annotation: visible.getAnnotations())
+         for (javassist.bytecode.annotation.Annotation annotation: invisible.getAnnotations())
          {
             annotationNames.add(annotation.getTypeName());
          }
@@ -175,15 +229,29 @@
 
    public static boolean isAnyAnnotationPresent(Method method, String annotation) throws Exception
    {
-      CtMethod ctMethod = ReflectToJavassist.methodToJavassist(method);
-      if (ctMethod == null) return false;
-      boolean present = AnnotationElement.isAnyAnnotationPresent(ctMethod, annotation);
-      return present;
-
+      if (closingDownManager)
+      {
+         return false;
+      }
+      if(AnnotationElement.isVisibleAnnotationPresent(method, annotation))
+         return true;
+      if(includeInvisibleAnnotation(annotation))
+      {
+         CtMethod ctMethod = ReflectToJavassist.methodToJavassist(method);
+         if (ctMethod == null) return false;
+         boolean present = AnnotationElement.isAnyAnnotationPresent(ctMethod, annotation);
+         return present;
+      }
+      else
+         return false;
    }
 
    public static boolean isAnyAnnotationPresent(CtMethod ctMethod, String annotation)
    {
+      if (closingDownManager)
+      {
+         return false;
+      }
       MethodInfo mi = ctMethod.getMethodInfo2();
 
       AnnotationsAttribute visible = (AnnotationsAttribute) mi.getAttribute(AnnotationsAttribute.visibleTag);
@@ -192,36 +260,60 @@
          if (visible.getAnnotation(annotation) != null) return true;
       }
 
-      AnnotationsAttribute invisible = (AnnotationsAttribute) mi.getAttribute(AnnotationsAttribute.invisibleTag);
-      if (invisible != null)
+      if(includeInvisibleAnnotation(annotation))
       {
-         if (invisible.getAnnotation(annotation) != null) return true;
+         AnnotationsAttribute invisible = (AnnotationsAttribute) mi.getAttribute(AnnotationsAttribute.invisibleTag);
+         if (invisible != null)
+         {
+            if (invisible.getAnnotation(annotation) != null) return true;
+         }
+         return false;
       }
-
-      return false;
+      else
+         return false;
+      
    }
 
-   public static boolean isInvisibleAnnotationPresent(Constructor con, String annotation) throws Exception
+   public static boolean isInvisibleAnnotationPresent(Constructor<?> con, String annotation) throws Exception
    {
-      CtConstructor ctMethod = ReflectToJavassist.constructorToJavassist(con);
-      return AnnotationElement.isInvisibleAnnotationPresent(ctMethod, annotation);
-
-
+      if (closingDownManager)
+      {
+         return false;
+      }
+      if(includeInvisibleAnnotation(annotation))
+      {
+         CtConstructor ctMethod = ReflectToJavassist.constructorToJavassist(con);
+         return AnnotationElement.isInvisibleAnnotationPresent(ctMethod, annotation);
+      }
+      else
+         return false;
    }
 
    public static boolean isInvisibleAnnotationPresent(CtConstructor ctMethod, String annotation)
    {
-      MethodInfo mi = ctMethod.getMethodInfo2();
+      if (closingDownManager)
+      {
+         return false;
+      }
+      if(includeInvisibleAnnotation(annotation))
+      {
+         MethodInfo mi = ctMethod.getMethodInfo2();
 
+         AnnotationsAttribute invisible = (AnnotationsAttribute) mi.getAttribute(AnnotationsAttribute.invisibleTag);
+         if (invisible == null) return false;
 
-      AnnotationsAttribute invisible = (AnnotationsAttribute) mi.getAttribute(AnnotationsAttribute.invisibleTag);
-      if (invisible == null) return false;
-
-      return invisible.getAnnotation(annotation) != null;
+         return invisible.getAnnotation(annotation) != null;
+      }
+      else
+         return false;
    }
 
    public static boolean isVisibleAnnotationPresent(CtConstructor ctMethod, String annotation)
    {
+      if (closingDownManager)
+      {
+         return false;
+      }
       MethodInfo mi = ctMethod.getMethodInfo2();
 
 
@@ -243,7 +335,7 @@
       AnnotationsAttribute visible = (AnnotationsAttribute) ci.getAttribute(AnnotationsAttribute.visibleTag);
       if (visible != null)
       {
-         for (Annotation annotation: visible.getAnnotations())
+         for (javassist.bytecode.annotation.Annotation annotation: visible.getAnnotations())
          {
             annotationNames.add(annotation.getTypeName());
          }
@@ -251,22 +343,36 @@
       AnnotationsAttribute invisible = (AnnotationsAttribute) ci.getAttribute(AnnotationsAttribute.invisibleTag);
       if (invisible != null)
       {
-         for (Annotation annotation: visible.getAnnotations())
+         for (javassist.bytecode.annotation.Annotation annotation: invisible.getAnnotations())
          {
             annotationNames.add(annotation.getTypeName());
          }
       }
    }
 
-   public static boolean isAnyAnnotationPresent(Constructor con, String annotation) throws Exception
+   public static boolean isAnyAnnotationPresent(Constructor<?> con, String annotation) throws Exception
    {
-      CtConstructor ctMethod = ReflectToJavassist.constructorToJavassist(con);
-      return AnnotationElement.isAnyAnnotationPresent(ctMethod, annotation);
-
+      if (closingDownManager)
+      {
+         return false;
+      }
+      if(AnnotationElement.isVisibleAnnotationPresent(con, annotation))
+         return true;
+      if(includeInvisibleAnnotation(annotation))
+      {
+         CtConstructor ctMethod = ReflectToJavassist.constructorToJavassist(con);
+         return AnnotationElement.isAnyAnnotationPresent(ctMethod, annotation);
+      }
+      else
+         return false;
    }
 
    public static boolean isAnyAnnotationPresent(CtConstructor ctMethod, String annotation)
    {
+      if (closingDownManager)
+      {
+         return false;
+      }
       MethodInfo mi = ctMethod.getMethodInfo2();
 
       AnnotationsAttribute visible = (AnnotationsAttribute) mi.getAttribute(AnnotationsAttribute.visibleTag);
@@ -275,28 +381,45 @@
          if (visible.getAnnotation(annotation) != null) return true;
       }
 
-      AnnotationsAttribute invisible = (AnnotationsAttribute) mi.getAttribute(AnnotationsAttribute.invisibleTag);
-      if (invisible != null)
+      if(includeInvisibleAnnotation(annotation))
       {
-         if (invisible.getAnnotation(annotation) != null) return true;
+         AnnotationsAttribute invisible = (AnnotationsAttribute) mi.getAttribute(AnnotationsAttribute.invisibleTag);
+         if (invisible != null)
+         {
+            if (invisible.getAnnotation(annotation) != null) return true;
+         }
+         return false;
       }
-
-      return false;
+      else
+         return false;
    }
 
-   public static boolean isInvisibleAnnotationPresent(Class clazz, String annotation) throws Exception
+   public static boolean isInvisibleAnnotationPresent(Class<?> clazz, String annotation) throws Exception
    {
-      if (clazz == Void.TYPE) return false;
-      ClassFile cf = AnnotationElement.getClassFile(clazz);
+      if (closingDownManager)
+      {
+         return false;
+      }
+      if(includeInvisibleAnnotation(annotation))
+      {
+         if (clazz == Void.TYPE) return false;
+         ClassFile cf = AnnotationElement.getClassFile(clazz);
 
-      AnnotationsAttribute invisible = (AnnotationsAttribute) cf.getAttribute(AnnotationsAttribute.invisibleTag);
-      if (invisible == null) return false;
+         AnnotationsAttribute invisible = (AnnotationsAttribute) cf.getAttribute(AnnotationsAttribute.invisibleTag);
+         if (invisible == null) return false;
 
-      return invisible.getAnnotation(annotation) != null;
+         return invisible.getAnnotation(annotation) != null;
+      }
+      else
+         return false;
    }
 
    public static boolean isAnyAnnotationPresent(CtClass clazz, String annotation) throws Exception
    {
+      if (closingDownManager)
+      {
+         return false;
+      }
       try
       {
          if (clazz == CtClass.voidType) return false;
@@ -313,41 +436,59 @@
          AnnotationsAttribute visible = (AnnotationsAttribute) cf.getAttribute(AnnotationsAttribute.visibleTag);
          if (visible != null)
          {
-            if (visible.getAnnotation(annotation) != null) return true;
+            if (visible.getAnnotation(annotation) != null) 
+               return true;
          }
 
-         AnnotationsAttribute invisible = (AnnotationsAttribute) cf.getAttribute(AnnotationsAttribute.invisibleTag);
-         if (invisible != null)
+         if(includeInvisibleAnnotation(annotation))
          {
-            if (invisible.getAnnotation(annotation) != null) return true;
+            AnnotationsAttribute invisible = (AnnotationsAttribute) cf.getAttribute(AnnotationsAttribute.invisibleTag);
+            if (invisible != null)
+            {
+               if (invisible.getAnnotation(annotation) != null) return true;
+            }
+            return false;
          }
-
-         return false;
+         else
+            return false;
+        
       }
       catch (RuntimeException e)
       {
          String name = (clazz != null) ? clazz.getName() : null;
-         throw new RuntimeException("Error looking for " + annotation + " in " + clazz.getName(), e);
+         throw new RuntimeException("Error looking for " + annotation + " in " + name, e);
       }
    }
 
-   public static boolean isAnyAnnotationPresent(Class clazz, String annotation) throws Exception
+   public static boolean isAnyAnnotationPresent(Class<?> clazz, String annotation) throws Exception
    {
-      if (clazz == Void.TYPE) return false;
-      ClassFile cf = AnnotationElement.getClassFile(clazz);
-      AnnotationsAttribute visible = (AnnotationsAttribute) cf.getAttribute(AnnotationsAttribute.visibleTag);
-      if (visible != null)
+      if (closingDownManager)
       {
-         if (visible.getAnnotation(annotation) != null) return true;
+         return false;
       }
+      if (clazz == Void.TYPE) return false;
+      if(AnnotationElement.isVisibleAnnotationPresent(clazz, annotation))
+         return true;
+      
+//      ClassFile cf = AnnotationElement.getClassFile(clazz);
+//      AnnotationsAttribute visible = (AnnotationsAttribute) cf.getAttribute(AnnotationsAttribute.visibleTag);
+//      if (visible != null)
+//      {
+//         if (visible.getAnnotation(annotation) != null) return true;
+//      }
 
-      AnnotationsAttribute invisible = (AnnotationsAttribute) cf.getAttribute(AnnotationsAttribute.invisibleTag);
-      if (invisible != null)
+      if(includeInvisibleAnnotation(annotation))
       {
-         if (invisible.getAnnotation(annotation) != null) return true;
+         ClassFile cf = AnnotationElement.getClassFile(clazz);
+         AnnotationsAttribute invisible = (AnnotationsAttribute) cf.getAttribute(AnnotationsAttribute.invisibleTag);
+         if (invisible != null)
+         {
+            if (invisible.getAnnotation(annotation) != null) return true;
+         }
+         return false;
       }
-
-      return false;
+      else
+         return false;
    }
    
    public static void loadAllAnnotationsPresent(Class clazz,
@@ -361,7 +502,7 @@
       AnnotationsAttribute visible = (AnnotationsAttribute) cf.getAttribute(AnnotationsAttribute.visibleTag);
       if (visible != null)
       {
-         for (Annotation annotation: visible.getAnnotations())
+         for (javassist.bytecode.annotation.Annotation annotation: visible.getAnnotations())
          {
             annotationNames.add(annotation.getTypeName());
          }
@@ -369,14 +510,14 @@
       AnnotationsAttribute invisible = (AnnotationsAttribute) cf.getAttribute(AnnotationsAttribute.invisibleTag);
       if (invisible != null)
       {
-         for (Annotation annotation: visible.getAnnotations())
+         for (javassist.bytecode.annotation.Annotation annotation: invisible.getAnnotations())
          {
             annotationNames.add(annotation.getTypeName());
          }
       }
    }
 
-   protected static ClassFile getClassFile(Class clazz) throws NotFoundException
+   protected static ClassFile getClassFile(Class<?> clazz) throws NotFoundException
    {
       ClassPool pool = AspectManager.instance().findClassPool(clazz.getClassLoader());
       CtClass ct = pool.get(clazz.getName());
@@ -384,7 +525,7 @@
       return cf;
    }
 
-   protected static Object create(AnnotationsAttribute group, Class annotation) throws Exception
+   protected static Object create(AnnotationsAttribute group, Class<? extends Annotation> annotation) throws Exception
    {
       if (group == null) return null;
       javassist.bytecode.annotation.Annotation info = group.getAnnotation(annotation.getName());
@@ -392,49 +533,72 @@
       return AnnotationProxy.createProxy(info, annotation);
    }
 
-   public static Object getInvisibleAnnotation(Method method, Class annotation)
+   public static Object getInvisibleAnnotation(Method method, Class<? extends Annotation> annotation)
    {
-      try
+      if (closingDownManager)
       {
-         CtMethod ctMethod = ReflectToJavassist.methodToJavassist(method);
-         if (ctMethod == null)
+         return false;
+      }
+      
+      if(includeInvisibleAnnotation(annotation))
+      {
+         try
          {
-            return null;
-         }
-         MethodInfo mi = ctMethod.getMethodInfo2();
+            CtMethod ctMethod = ReflectToJavassist.methodToJavassist(method);
+            if (ctMethod == null)
+            {
+               return null;
+            }
+            MethodInfo mi = ctMethod.getMethodInfo2();
 
-         AnnotationsAttribute invisible = (AnnotationsAttribute) mi.getAttribute(AnnotationsAttribute.invisibleTag);
-         if (invisible == null) return null;
+            AnnotationsAttribute invisible = (AnnotationsAttribute) mi.getAttribute(AnnotationsAttribute.invisibleTag);
+            if (invisible == null) return null;
 
-         return create(invisible, annotation);
+            return create(invisible, annotation);
+         }
+         catch (Exception e)
+         {
+            throw new RuntimeException(e);  //To change body of catch statement use Options | File Templates.
+         }
       }
-      catch (Exception e)
-      {
-         throw new RuntimeException(e);  //To change body of catch statement use Options | File Templates.
-      }
+      else
+         return false;
    }
 
-   public static Object getInvisibleAnnotation(Constructor con, Class annotation)
+   public static Object getInvisibleAnnotation(Constructor<?> con, Class<? extends Annotation> annotation)
    {
-      try
+      if (closingDownManager)
       {
-         CtConstructor ctMethod = ReflectToJavassist.constructorToJavassist(con);
-         MethodInfo mi = ctMethod.getMethodInfo2();
+         return false;
+      }
+      if(includeInvisibleAnnotation(annotation))
+      {
+         try
+         {
+            CtConstructor ctMethod = ReflectToJavassist.constructorToJavassist(con);
+            MethodInfo mi = ctMethod.getMethodInfo2();
 
 
-         AnnotationsAttribute invisible = (AnnotationsAttribute) mi.getAttribute(AnnotationsAttribute.invisibleTag);
-         if (invisible == null) return null;
+            AnnotationsAttribute invisible = (AnnotationsAttribute) mi.getAttribute(AnnotationsAttribute.invisibleTag);
+            if (invisible == null) return null;
 
-         return create(invisible, annotation);
+            return create(invisible, annotation);
+         }
+         catch (Exception e)
+         {
+            throw new RuntimeException(e);  //To change body of catch statement use Options | File Templates.
+         }
       }
-      catch (Exception e)
-      {
-         throw new RuntimeException(e);  //To change body of catch statement use Options | File Templates.
-      }
+      else
+         return false;
    }
 
-   public static Object getInvisibleAnnotation(Field field, Class annotation)
+   public static Object getInvisibleAnnotation(Field field, Class<? extends Annotation> annotation)
    {
+      if (closingDownManager)
+      {
+         return false;
+      }
       try
       {
          CtField ctField = ReflectToJavassist.fieldToJavassist(field);
@@ -452,8 +616,12 @@
       }
    }
 
-   public static Object getInvisibleAnnotation(Class clazz, Class annotation)
+   public static Object getInvisibleAnnotation(Class<?> clazz, Class<? extends Annotation> annotation)
    {
+      if (closingDownManager)
+      {
+         return false;
+      }
       try
       {
          if (clazz == Void.TYPE) return null;
@@ -477,11 +645,14 @@
     * @param annotation
     * @return
     */
-   public static Object getAnyAnnotation(Method method, Class annotation)
+   public static Object getAnyAnnotation(Method method, Class<? extends Annotation> annotation)
    {
       Object rtn = AnnotationElement.getVisibleAnnotation(method, annotation);
       if (rtn != null) return rtn;
-      return getInvisibleAnnotation(method, annotation);
+      if(includeInvisibleAnnotation(annotation))
+         return getInvisibleAnnotation(method, annotation);
+      else
+         return null;
    }
 
    /**
@@ -491,140 +662,130 @@
     * @param annotation
     * @return
     */
-   public static Object getAnyAnnotation(Constructor con, Class annotation)
+   public static Object getAnyAnnotation(Constructor<?> con, Class<? extends Annotation> annotation)
    {
       Object rtn = AnnotationElement.getVisibleAnnotation(con, annotation);
       if (rtn != null) return rtn;
-      return getInvisibleAnnotation(con, annotation);
+      if(includeInvisibleAnnotation(annotation))
+         return getInvisibleAnnotation(con, annotation);
+      else
+         return null;
    }
 
-   public static Object getAnyAnnotation(Field field, Class annotation)
+   public static Object getAnyAnnotation(Field field, Class<? extends Annotation> annotation)
    {
       Object rtn = AnnotationElement.getVisibleAnnotation(field, annotation);
       if (rtn != null) return rtn;
-      return getInvisibleAnnotation(field, annotation);
+      if(includeInvisibleAnnotation(annotation))
+         return getInvisibleAnnotation(field, annotation);
+      else
+         return null;
    }
 
-   public static Object getAnyAnnotation(Class clazz, Class annotation)
+   public static Object getAnyAnnotation(Class<?> clazz, Class<? extends Annotation> annotation)
    {
       if (clazz == Void.TYPE) return null;
       Object rtn = AnnotationElement.getVisibleAnnotation(clazz, annotation);
       if (rtn != null) return rtn;
-      return getInvisibleAnnotation(clazz, annotation);
+      if(includeInvisibleAnnotation(annotation))
+         return getInvisibleAnnotation(clazz, annotation);
+      else
+         return null;
    }
 
-   public static boolean isAnyAnnotationPresent(Field field, Class annotation) throws Exception
+   public static boolean isAnyAnnotationPresent(Field field, Class<? extends Annotation> annotation) throws Exception
    {
-      if (AnnotationElement.isVisibleAnnotationPresent(field, annotation)) return true;
-      CtField ctMethod = ReflectToJavassist.fieldToJavassist(field);
-      return isInvisibleAnnotationPresent(ctMethod, annotation.getName());
+      if (AnnotationElement.isVisibleAnnotationPresent(field, annotation)) 
+         return true;
+      if (closingDownManager)
+      {
+         return false;
+      }
+      if(includeInvisibleAnnotation(annotation))
+      {
+         CtField ctMethod = ReflectToJavassist.fieldToJavassist(field);
+         return isInvisibleAnnotationPresent(ctMethod, annotation.getName());
+      }
+      else
+         return false;
    }
 
-   public static boolean isAnyAnnotationPresent(Class clazz, Class annotation) throws Exception
+   public static boolean isAnyAnnotationPresent(Class<?> clazz, Class<? extends Annotation> annotation) throws Exception
    {
       if (clazz == Void.TYPE) return false;
-      if (AnnotationElement.isVisibleAnnotationPresent(clazz, annotation)) return true;
-      ClassFile cf = getClassFile(clazz);
+      if (AnnotationElement.isVisibleAnnotationPresent(clazz, annotation)) 
+         return true;
+      if (closingDownManager)
+      {
+         return false;
+      }
+      if(includeInvisibleAnnotation(annotation))
+      {
+         ClassFile cf = getClassFile(clazz);
 
-      AnnotationsAttribute invisible = (AnnotationsAttribute) cf.getAttribute(AnnotationsAttribute.invisibleTag);
-      if (invisible == null) return false;
+         AnnotationsAttribute invisible = (AnnotationsAttribute) cf.getAttribute(AnnotationsAttribute.invisibleTag);
+         if (invisible == null) return false;
 
-      return invisible.getAnnotation(annotation.getName()) != null;
+         return invisible.getAnnotation(annotation.getName()) != null;
+      }
+      else
+         return false;
    }
 
-   public static boolean isAnyAnnotationPresent(Constructor con, Class annotation) throws Exception
+   public static boolean isAnyAnnotationPresent(Constructor<?> con, Class<? extends Annotation> annotation) throws Exception
    {
-      if (AnnotationElement.isVisibleAnnotationPresent(con, annotation)) return true;
-      CtConstructor ctMethod = ReflectToJavassist.constructorToJavassist(con);
-      return isVisibleAnnotationPresent(ctMethod, annotation.getName());
-
-
+      if (AnnotationElement.isVisibleAnnotationPresent(con, annotation)) 
+         return true;
+      if (closingDownManager)
+      {
+         return false;
+      }
+      if(includeInvisibleAnnotation(annotation))
+      {
+         CtConstructor ctMethod = ReflectToJavassist.constructorToJavassist(con);
+         return isVisibleAnnotationPresent(ctMethod, annotation.getName());
+      }
+      else
+         return false;
    }
 
-   public static boolean isAnyAnnotationPresent(Method method, Class annotation) throws Exception
+   public static boolean isAnyAnnotationPresent(Method method, Class<? extends Annotation> annotation) throws Exception
    {
-      if (AnnotationElement.isVisibleAnnotationPresent(method, annotation)) return true;
-      CtMethod ctMethod = ReflectToJavassist.methodToJavassist(method);
-      if (ctMethod == null) return false;
-      MethodInfo mi = ctMethod.getMethodInfo2();
+      if (AnnotationElement.isVisibleAnnotationPresent(method, annotation)) 
+         return true;
+      if (closingDownManager)
+      {
+         return false;
+      }
+      if(includeInvisibleAnnotation(annotation))
+      {
+         CtMethod ctMethod = ReflectToJavassist.methodToJavassist(method);
+         if (ctMethod == null) return false;
+         MethodInfo mi = ctMethod.getMethodInfo2();
 
+         AnnotationsAttribute invisible = (AnnotationsAttribute) mi.getAttribute(AnnotationsAttribute.invisibleTag);
+         if (invisible == null) return false;
 
-      AnnotationsAttribute invisible = (AnnotationsAttribute) mi.getAttribute(AnnotationsAttribute.invisibleTag);
-      if (invisible == null) return false;
-
-      return invisible.getAnnotation(annotation.getName()) != null;
+         return invisible.getAnnotation(annotation.getName()) != null;
+      }
+      else
+         return false;
    }
-
-   public static boolean isVisibleAnnotationPresent(Field field, String annotation) throws Exception
+   
+   protected static boolean includeInvisibleAnnotation(Class<? extends Annotation> annotation)
    {
-      CtField ctMethod = ReflectToJavassist.fieldToJavassist(field);
-      return isVisibleAnnotationPresent(ctMethod, annotation);
+      return  includeInvisibleAnnotation(annotation.getPackage().getName());
    }
-
-   public static boolean isVisibleAnnotationPresent(Class clazz, String annotation) throws Exception
-   {
-      if (clazz == Void.TYPE) return false;
-
-      ClassFile cf = getClassFile(clazz);
-
-      AnnotationsAttribute visible = (AnnotationsAttribute) cf.getAttribute(AnnotationsAttribute.visibleTag);
-      if (visible == null) return false;
-
-      return visible.getAnnotation(annotation) != null;
-   }
-
-   public static boolean isVisibleAnnotationPresent(Constructor con, String annotation) throws Exception
-   {
-      CtConstructor ctMethod = ReflectToJavassist.constructorToJavassist(con);
-      return isVisibleAnnotationPresent(ctMethod, annotation);
-
-
-   }
-
-   public static boolean isVisibleAnnotationPresent(Method method, String annotation) throws Exception
-   {
-      CtMethod ctMethod = ReflectToJavassist.methodToJavassist(method);
-      if (ctMethod == null) return false;
-      MethodInfo mi = ctMethod.getMethodInfo2();
-
-
-      AnnotationsAttribute visible = (AnnotationsAttribute) mi.getAttribute(AnnotationsAttribute.visibleTag);
-      if (visible == null) return false;
-
-      return visible.getAnnotation(annotation) != null;
-   }
-
-   public static Object[] getVisibleAnnotations(Class clazz) throws Exception
-   {
-      return AnnotationElement.getVisibleAnnotations(clazz);
-   }
-
-   public static Object[] getVisibleAnnotations(Method m) throws Exception
-   {
-      return AnnotationElement.getVisibleAnnotations(m);
-   }
-      
-   public static Object[] getVisibleAnnotations(Field f) throws Exception
-   {
-      return AnnotationElement.getVisibleAnnotations(f);
-   }
    
-   public static Object[] getVisibleAnnotations(Constructor c) throws Exception
+   protected static boolean includeInvisibleAnnotation(String annotation)
    {
-      return AnnotationElement.getVisibleAnnotations(c);
-   }
-      
-   public static Class getAnnotationType(Object o)
-   {
-      Class proxy = o.getClass();
-      if (Proxy.isProxyClass(proxy))
+      for(String includedAnnotation : AspectManager.instance().getIncludedInvisibleAnnotations())
       {
-         Class[] interfaces = proxy.getInterfaces();
-         if (interfaces.length == 1)
+         if(includedAnnotation.equals("*") || annotation.startsWith(includedAnnotation))
          {
-            return interfaces[0];
+            return true;
          }
       }
-     return null;
+      return false;
    }
 }

Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/annotation/compiler/AnnotationDocletTag.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/annotation/compiler/AnnotationDocletTag.java	2008-03-24 03:08:33 UTC (rev 71183)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/annotation/compiler/AnnotationDocletTag.java	2008-03-24 03:41:24 UTC (rev 71184)
@@ -107,6 +107,7 @@
       return null;
    }
 
+   @SuppressWarnings("unchecked")
    public Map getNamedParameterMap()
    {
       return null;

Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/annotation/compiler/AnnotationInfoCreator.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/annotation/compiler/AnnotationInfoCreator.java	2008-03-24 03:08:33 UTC (rev 71183)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/annotation/compiler/AnnotationInfoCreator.java	2008-03-24 03:41:24 UTC (rev 71184)
@@ -86,8 +86,8 @@
    {
       if (base.getMemberNames().size() > 1) throw new RuntimeException("single value expected from annotation: " + base.getTypeName());
 
-      Set set = base.getMemberNames();
-      MemberValue mv = base.getMemberValue((String) set.iterator().next());
+      Set<String> set = base.getMemberNames();
+      MemberValue mv = base.getMemberValue(set.iterator().next());
       node.getValue().jjtAccept(this, mv);
       return data;
    }

Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/annotation/compiler/ByteCodeAnnotationCompiler.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/annotation/compiler/ByteCodeAnnotationCompiler.java	2008-03-24 03:08:33 UTC (rev 71183)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/annotation/compiler/ByteCodeAnnotationCompiler.java	2008-03-24 03:41:24 UTC (rev 71184)
@@ -110,7 +110,7 @@
    private CtMethod getJavassistMethod(JavaMethod method, CtClass clazz) throws Exception
    {
       CtMethod methods[] = clazz.getDeclaredMethods();
-      ArrayList possible = new ArrayList();
+      ArrayList<CtMethod> possible = new ArrayList<CtMethod>();
       for (int i = 0; i < methods.length; i++)
       {
          if (methods[i].getName().equals(method.getName()))
@@ -122,11 +122,11 @@
          }
       }
       if (possible.size() == 0) throw new RuntimeException("cannot resolve method" + method.toString());
-      if (possible.size() == 1) return (CtMethod) possible.get(0);
+      if (possible.size() == 1) return possible.get(0);
 
       for (int i = 0; i < possible.size(); i++)
       {
-         CtMethod ctMethod = (CtMethod) possible.get(i);
+         CtMethod ctMethod = possible.get(i);
          CtClass[] params = ctMethod.getParameterTypes();
          boolean bad = false;
          for (int k = 0; k < params.length; k++)
@@ -145,7 +145,7 @@
    private CtConstructor getJavassistConstructor(JavaMethod method, CtClass clazz, boolean isInnerClass) throws Exception
    {
       CtConstructor cons[] = clazz.getDeclaredConstructors();
-      ArrayList possible = new ArrayList();
+      ArrayList<CtConstructor> possible = new ArrayList<CtConstructor>();
       for (int i = 0; i < cons.length; i++)
       {
          //non-static inner classes get wrapping class as an "invisible" constructor param 
@@ -166,11 +166,11 @@
       }
       
       if (possible.size() == 0) throw new RuntimeException("cannot resolve constructor" + method.toString());
-      if (possible.size() == 1) return (CtConstructor) possible.get(0);
+      if (possible.size() == 1) return possible.get(0);
 
       for (int i = 0; i < possible.size(); i++)
       {
-         CtConstructor ctCon = (CtConstructor) possible.get(i);
+         CtConstructor ctCon = possible.get(i);
          CtClass[] params = ctCon.getParameterTypes();
          boolean bad = false;
          for (int k = 0; k < params.length; k++)

Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/annotation/util/FindAnnotations.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/annotation/util/FindAnnotations.java	2008-03-24 03:08:33 UTC (rev 71183)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/annotation/util/FindAnnotations.java	2008-03-24 03:41:24 UTC (rev 71184)
@@ -75,10 +75,10 @@
       }
 
       System.out.println("**** method annotations ****");
-      List methods = cf.getMethods();
+      List<MethodInfo> methods = cf.getMethods();
       for (int i = 0; i < methods.size(); i++)
       {
-         MethodInfo mi = (MethodInfo) methods.get(i);
+         MethodInfo mi = methods.get(i);
          System.out.println("method: " + mi.getName());
          System.out.println("CONST POOL: ");
          mi.getConstPool().print();
@@ -103,10 +103,10 @@
       }
 
       System.out.println("**** field annotations ****");
-      List fields = cf.getFields();
+      List<FieldInfo> fields = cf.getFields();
       for (int i = 0; i < fields.size(); i++)
       {
-         FieldInfo mi = (FieldInfo) fields.get(i);
+         FieldInfo mi = fields.get(i);
          System.out.println("field: " + mi.getName());
          System.out.println("CONST POOL: ");
          mi.getConstPool().print();
@@ -134,14 +134,14 @@
    public static void printAnnotation(Annotation info)
    {
       System.out.print("@" + info.getTypeName());
-      Set members = info.getMemberNames();
+      Set<String> members = info.getMemberNames();
       if (members != null)
       {
          System.out.print("(");
-         Iterator mit = members.iterator();
+         Iterator<String> mit = members.iterator();
          while (mit.hasNext())
          {
-            String name = (String) mit.next();
+            String name = mit.next();
             System.out.print(name + "=" + info.getMemberValue(name).toString());
             if (mit.hasNext()) System.out.print(", ");
          }

Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/ant/AnnotationC.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/ant/AnnotationC.java	2008-03-24 03:08:33 UTC (rev 71183)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/ant/AnnotationC.java	2008-03-24 03:41:24 UTC (rev 71184)
@@ -299,7 +299,7 @@
       // compile lists
       String[] list = compileSourcepath.list();
       
-      ArrayList compilingFiles = new ArrayList();
+      ArrayList<String> compilingFiles = new ArrayList<String>();
       for (int i = 0; i < list.length; i++)
       {
          File srcDir = getProject().resolveFile(list[i]);
@@ -326,7 +326,7 @@
       StringBuffer niceSourceList = new StringBuffer("File");
       for (int i = 0; i < compilingFiles.size(); i++)
       {
-         String file = (String) compilingFiles.get(i);
+         String file = compilingFiles.get(i);
          cmd.createArgument().setValue(file);
          niceSourceList.append("    " + file + lSep);
       }

Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/ant/AopC.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/ant/AopC.java	2008-03-24 03:08:33 UTC (rev 71183)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/ant/AopC.java	2008-03-24 03:41:24 UTC (rev 71184)
@@ -27,7 +27,6 @@
 import java.io.FileWriter;
 import java.io.IOException;
 import java.util.ArrayList;
-import java.util.Iterator;
 
 import org.apache.tools.ant.BuildException;
 import org.apache.tools.ant.DirectoryScanner;
@@ -65,7 +64,7 @@
    private boolean report = false;
    private boolean optimized = true;
    private String maxmemory = null;
-   ArrayList sysproperties = new ArrayList();
+   ArrayList<Environment.Variable> sysproperties = new ArrayList<Environment.Variable>();
 
    File sourceFiles;
    /**
@@ -372,9 +371,8 @@
          optimize.setValue(String.valueOf(optimized));
          java.addSysproperty(optimize);
 
-         for (Iterator it = sysproperties.iterator() ; it.hasNext() ; )
+         for (Environment.Variable var : sysproperties)
          {
-            Environment.Variable var = (Environment.Variable)it.next();
             java.addSysproperty(var);
          }
          
@@ -411,7 +409,7 @@
       // scan source directories and dest directory to build up
       // compile lists
       String[] list = compileSourcepath.list();
-      ArrayList compilingFiles = new ArrayList();
+      ArrayList<String> compilingFiles = new ArrayList<String>();
       for (int i = 0; i < list.length; i++)
       {
          File srcDir = getProject().resolveFile(list[i]);
@@ -438,7 +436,7 @@
       for (int i = 0; i < compilingFiles.size(); i++)
       {
          //Add 1 to allow for the spaces between args
-         length += ((String) compilingFiles.get(i)).length() + 1;
+         length += compilingFiles.get(i).length() + 1;
 
          if (length > maxSrc)
          {
@@ -451,16 +449,15 @@
          StringBuffer niceSourceList = new StringBuffer("Files\n");
          for (int i = 0; i < compilingFiles.size(); i++)
          {
-            String file = (String) compilingFiles.get(i);
+            String file = compilingFiles.get(i);
             cmd.createArgument().setValue(file);
             niceSourceList.append("    " + file + lSep);
          }
       }
       else
       {
-         for (Iterator it = sysproperties.iterator() ; it.hasNext() ; )
+         for (Environment.Variable var : sysproperties)
          {
-            Environment.Variable var = (Environment.Variable)it.next();
             if (var.getKey().equals("java.io.tmpdir"))
             {
                System.setProperty("java.io.tmpdir", var.getValue());
@@ -481,7 +478,7 @@
 
             for (int i = 0; i < compilingFiles.size(); i++)
             {
-               writer.write((String) compilingFiles.get(i));
+               writer.write(compilingFiles.get(i));
                writer.newLine();
             }
             writer.flush();

Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/array/ArrayBinding.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/array/ArrayBinding.java	2008-03-24 03:08:33 UTC (rev 71183)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/array/ArrayBinding.java	2008-03-24 03:41:24 UTC (rev 71184)
@@ -26,8 +26,6 @@
 import java.util.List;
 
 import org.jboss.aop.advice.InterceptorFactory;
-import org.jboss.aop.pointcut.Pointcut;
-import org.jboss.aop.pointcut.ast.ParseException;
 
 /**
  * 
@@ -50,10 +48,10 @@
 
    public void addInterceptorFactory(InterceptorFactory factory)
    {
-      List list = Arrays.asList(interceptorFactories);
-      list = new ArrayList(list);
+      List<InterceptorFactory> list = Arrays.asList(interceptorFactories);
+      list = new ArrayList<InterceptorFactory>(list);
       list.add(factory);
-      interceptorFactories = (InterceptorFactory[]) list.toArray(new InterceptorFactory[list.size()]);
+      interceptorFactories = list.toArray(new InterceptorFactory[list.size()]);
    }
 
 

Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/array/ArrayElementInvocation.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/array/ArrayElementInvocation.java	2008-03-24 03:08:33 UTC (rev 71183)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/array/ArrayElementInvocation.java	2008-03-24 03:41:24 UTC (rev 71184)
@@ -21,6 +21,7 @@
 */ 
 package org.jboss.aop.array;
 
+import java.lang.annotation.Annotation;
 import java.util.List;
 import java.util.Map;
 
@@ -103,30 +104,49 @@
    }
 
    @Override
-   public Map getResponseContextInfo()
+   public Map<Object, Object> getResponseContextInfo()
    {
       throw new NotImplementedException();
    }
 
    @Override
-   public Object resolveAnnotation(Class annotation)
+   public Object resolveAnnotation(Class<? extends Annotation> annotation)
    {
       throw new NotImplementedException();
    }
 
    @Override
-   public Object resolveAnnotation(Class[] annotations)
+   public Object resolveAnnotation(Class<? extends Annotation>[] annotations)
    {
       throw new NotImplementedException();
    }
 
    @Override
-   public Object resolveClassAnnotation(Class annotation)
+   public Object resolveClassAnnotation(Class<? extends Annotation> annotation)
    {
       throw new NotImplementedException();
    }
 
    @Override
+   public <T extends Annotation> T resolveTypedAnnotation(Class<T> annotation)
+   {
+      throw new NotImplementedException();
+   }
+
+   @Override
+   public <T extends Annotation> T resolveTypedAnnotation(Class<T>[] annotations)
+   {
+      throw new NotImplementedException();
+   }
+
+   @Override
+   public <T extends Annotation> T resolveTypedClassAnnotation(Class<T> annotation)
+   {
+      throw new NotImplementedException();
+   }
+
+
+   @Override
    public Object resolveClassMetaData(Object key, Object attr)
    {
       throw new NotImplementedException();
@@ -145,7 +165,7 @@
    }
 
    @Override
-   public void setResponseContextInfo(Map responseContextInfo)
+   public void setResponseContextInfo(Map<Object, Object> responseContextInfo)
    {
       throw new NotImplementedException();
    }

Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/array/ArrayRegistry.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/array/ArrayRegistry.java	2008-03-24 03:08:33 UTC (rev 71183)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/array/ArrayRegistry.java	2008-03-24 03:41:24 UTC (rev 71184)
@@ -267,10 +267,10 @@
    
    private ArrayType isArray(Object arrayCandidate)
    {
-      Class candidateClass = arrayCandidate.getClass();
+      Class<?> candidateClass = arrayCandidate.getClass();
       if (candidateClass.isArray())
       {
-         Class componentType = candidateClass.getComponentType();
+         Class<?> componentType = candidateClass.getComponentType();
          if (componentType.isArray())
          {
             return ArrayType.MULTIDIM_ARRAY;

Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/array/ArrayRegistryEntry.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/array/ArrayRegistryEntry.java	2008-03-24 03:08:33 UTC (rev 71183)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/array/ArrayRegistryEntry.java	2008-03-24 03:41:24 UTC (rev 71184)
@@ -31,18 +31,18 @@
 public abstract class ArrayRegistryEntry
 {
    /** WeakReference to the object or array containing the reference */
-   WeakReference owner;
+   WeakReference<Object> owner;
    
    /** WeakReference to the referenced array */
-   WeakReference array;
+   WeakReference<Object> array;
    
    /** True if the object referencing the array is a "normal" object, false if it ia an array */
    boolean ownerIsRoot;
    
    ArrayRegistryEntry(Object owner, boolean ownerIsRoot, Object array)
    {
-      this.owner = new WeakReference(owner);
-      this.array = new WeakReference(array);
+      this.owner = new WeakReference<Object>(owner);
+      this.array = new WeakReference<Object>(array);
       this.ownerIsRoot = ownerIsRoot;
       if (ownerIsRoot && owner.getClass().isArray()) {
          throw new RuntimeException("Owner is root and an array was passed in");

Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/array/ArrayReplacement.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/array/ArrayReplacement.java	2008-03-24 03:08:33 UTC (rev 71183)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/array/ArrayReplacement.java	2008-03-24 03:41:24 UTC (rev 71184)
@@ -91,7 +91,7 @@
       }
    }
 
-   public boolean matches(Advisor advisor, Class clazz)
+   public boolean matches(Advisor advisor, Class<?> clazz)
    {
       if (classExpr != null)
          return Util.matchesClassExpr(classExpr, clazz, advisor);

Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/array/ElementArrayRegistryEntry.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/array/ElementArrayRegistryEntry.java	2008-03-24 03:08:33 UTC (rev 71183)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/array/ElementArrayRegistryEntry.java	2008-03-24 03:41:24 UTC (rev 71184)
@@ -21,8 +21,6 @@
 */ 
 package org.jboss.aop.array;
 
-import java.util.HashSet;
-
 /**
  * 
  * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>

Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/array/FieldArrayRegistryEntry.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/array/FieldArrayRegistryEntry.java	2008-03-24 03:08:33 UTC (rev 71183)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/array/FieldArrayRegistryEntry.java	2008-03-24 03:41:24 UTC (rev 71184)
@@ -21,8 +21,6 @@
 */ 
 package org.jboss.aop.array;
 
-import java.util.HashSet;
-
 /**
  * 
  * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>

Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/classpool/AOPClassPool.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/classpool/AOPClassPool.java	2008-03-24 03:08:33 UTC (rev 71183)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/classpool/AOPClassPool.java	2008-03-24 03:41:24 UTC (rev 71184)
@@ -22,7 +22,6 @@
 package org.jboss.aop.classpool;
 
 import java.lang.ref.WeakReference;
-import java.util.Iterator;
 import java.util.Map;
 import java.util.concurrent.ConcurrentHashMap;
 
@@ -104,13 +103,12 @@
             Object o = generatedClasses.get(classname);
             if (o == null)
             {
-               Map registeredCLs = AspectManager.getRegisteredCLs();
+               Map<ClassLoader, ClassPool> registeredCLs = AspectManager.getRegisteredCLs();
                synchronized (registeredCLs)
                {
-                  Iterator it = registeredCLs.values().iterator();
-                  while (it.hasNext())
+                  for(ClassPool pl : AspectManager.getRegisteredCLs().values())
                   {
-                     AOPClassPool pool = (AOPClassPool) it.next();
+                     AOPClassPool pool = (AOPClassPool) pl;
                      if (pool.isUnloadedClassLoader())
                      {
                         AspectManager.instance().unregisterClassLoader(pool.getClassLoader());
@@ -158,7 +156,7 @@
    protected boolean isLocalResource(String resourceName)
    {
       String classResourceName = getResourceName(resourceName);
-      Boolean isLocal = (Boolean)localResources.get(classResourceName);
+      Boolean isLocal = localResources.get(classResourceName);
       if (isLocal != null)
       {
          return isLocal.booleanValue();

Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/classpool/AOPClassPoolRepository.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/classpool/AOPClassPoolRepository.java	2008-03-24 03:08:33 UTC (rev 71183)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/classpool/AOPClassPoolRepository.java	2008-03-24 03:41:24 UTC (rev 71184)
@@ -28,7 +28,6 @@
 import java.security.PrivilegedExceptionAction;
 import java.util.HashMap;
 import java.util.HashSet;
-import java.util.Iterator;
 import java.util.Map;
 
 import org.jboss.aop.Advisor;
@@ -56,7 +55,7 @@
    private final static AOPClassPoolRepository instance = new AOPClassPoolRepository();
    
    /** The classes per classppol */
-   protected final HashMap ucl2classes = new HashMap();
+   protected final HashMap<ClassLoader, HashSet<Class<?>>> ucl2classes = new HashMap<ClassLoader, HashSet<Class<?>>>();
 
    /** The top-level AspectManager this pool belongs to */
    AspectManager manager;
@@ -140,7 +139,7 @@
     * 
     * @return the registered classloaders
     */
-   public Map getRegisteredCLs()
+   public Map<ClassLoader, ClassPool> getRegisteredCLs()
    {
       return delegate.getRegisteredCLs();
    }
@@ -163,12 +162,12 @@
       delegate.unregisterClassLoader(cl);
    }
    
-   public void registerClass(Class clazz)
+   public void registerClass(Class<?> clazz)
    {
-      HashSet classes = (HashSet) ucl2classes.get(clazz.getClassLoader());
+      HashSet<Class<?>> classes = ucl2classes.get(clazz.getClassLoader());
       if (classes == null)
       {
-         classes = new HashSet();
+         classes = new HashSet<Class<?>>();
          ucl2classes.put(clazz.getClassLoader(), classes);
       }
       classes.add(clazz);
@@ -190,26 +189,24 @@
    {
       synchronized (delegate.getRegisteredCLs())
       {
-         HashSet classes = (HashSet) ucl2classes.remove(cl);
+         HashSet<Class<?>> classes = ucl2classes.remove(cl);
          if (classes != null)
          {
-            Iterator it = classes.iterator();
-            while (it.hasNext())
+            for (Class<?> clazz : classes)
             {
-               Object clazz = it.next();
                synchronized (manager.getAdvisors())
                {
-                  WeakReference ref = (WeakReference)manager.getAdvisors().get(clazz);
+                  WeakReference<Advisor> ref = manager.getAdvisors().get(clazz);
                   if (ref != null)
                   {
-                     Advisor advisor = (Advisor)ref.get();
+                     Advisor advisor = ref.get();
                      manager.getAdvisors().remove(clazz);
                      if (advisor != null)
                      {
                         advisor.cleanup();
                      }
                   }
-                  Class advisedClass = (Class)clazz;
+                  Class<?> advisedClass = clazz;
                   try
                   {
                      //The static advisor field should be the only remaining hard reference to the advisor
@@ -242,7 +239,7 @@
          {
             try
             {
-               AccessController.doPrivileged(new PrivilegedExceptionAction()
+               AccessController.doPrivileged(new PrivilegedExceptionAction<Object>()
                {
                   public Object run()
                   {

Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/contrib/IDEClassPoolFactory.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/contrib/IDEClassPoolFactory.java	2008-03-24 03:08:33 UTC (rev 71183)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/contrib/IDEClassPoolFactory.java	2008-03-24 03:41:24 UTC (rev 71184)
@@ -46,11 +46,11 @@
 public class IDEClassPoolFactory implements ScopedClassPoolFactory
 {
 
-   private ArrayList classPaths;
+   private ArrayList<URL> classPaths;
 
    public IDEClassPoolFactory()
    {
-      classPaths = new ArrayList();
+      classPaths = new ArrayList<URL>();
    }
 
    public ScopedClassPool create(ClassLoader loader, ClassPool pool, ScopedClassPoolRepository repository)
@@ -102,7 +102,7 @@
          {
             public Object run()
             {
-               URL urlPaths[] = (URL[]) classPaths.toArray(new URL[classPaths.size()]);
+               URL urlPaths[] = classPaths.toArray(new URL[classPaths.size()]);
                loader = new Loader(urlPaths, Thread.currentThread().getContextClassLoader());
                setClassLoader(loader);
 
@@ -115,7 +115,7 @@
          insertClassPath(classPath);
       }
 
-      public Class toClass(CtClass cc)
+      public Class<?> toClass(CtClass cc)
               throws CannotCompileException
       {
          try
@@ -143,10 +143,10 @@
          super(urls, src);
       }
 
-      public Class loadClass(String name, byte[] classfile)
+      public Class<?> loadClass(String name, byte[] classfile)
               throws ClassFormatError
       {
-         Class c = defineClass(name, classfile, 0, classfile.length);
+         Class<?> c = defineClass(name, classfile, 0, classfile.length);
 
          resolveClass(c);
          return c;

Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/eclipsesupport/EclipseTestTransformer.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/eclipsesupport/EclipseTestTransformer.java	2008-03-24 03:08:33 UTC (rev 71183)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/eclipsesupport/EclipseTestTransformer.java	2008-03-24 03:41:24 UTC (rev 71184)
@@ -118,7 +118,7 @@
       {
           if(args[i].toLowerCase().equals("-classnames") || args[i].toLowerCase().equals("-classname"))
           {
-              Vector list = new Vector();
+              Vector<String> list = new Vector<String>();
               for(int j = i + 1; j < args.length; j++)
               {
                   if(args[j].startsWith("-"))
@@ -128,7 +128,7 @@
                   list.add(args[j]);
               }
 
-              fTestClassNames = (String[])list.toArray(new String[list.size()]);
+              fTestClassNames = list.toArray(new String[list.size()]);
           } 
       }
       

Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/expressions/ConstructorExpression.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/expressions/ConstructorExpression.java	2008-03-24 03:08:33 UTC (rev 71183)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/expressions/ConstructorExpression.java	2008-03-24 03:41:24 UTC (rev 71184)
@@ -55,7 +55,7 @@
    }
 
 
-   public boolean matches(Constructor con)
+   public boolean matches(Constructor<?> con)
    {
       Matcher cm = classExpr.matcher(con.getDeclaringClass().getName());
       if (cm.matches() == false) return false;
@@ -63,7 +63,7 @@
       return params.matches(con.getParameterTypes());
    }
 
-   public boolean matchParamsOnly(Constructor con)
+   public boolean matchParamsOnly(Constructor<?> con)
    {
       return params.matches(con.getParameterTypes());
    }

Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/expressions/ParameterExpression.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/expressions/ParameterExpression.java	2008-03-24 03:08:33 UTC (rev 71183)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/expressions/ParameterExpression.java	2008-03-24 03:41:24 UTC (rev 71184)
@@ -52,12 +52,12 @@
    public Pattern[] parameterPatterns;
    public boolean isAll = false;
 
-   protected static String simpleType(Class type)
+   protected static String simpleType(Class<?> type)
    {
-      Class ret = type;
+      Class<?> ret = type;
       if (ret.isArray())
       {
-         Class arr = ret;
+         Class<?> arr = ret;
          String array = "";
          while (arr.isArray())
          {
@@ -85,7 +85,7 @@
             throw new RuntimeException("Illegal parameter list expression: " + expression);
          }
          StringTokenizer tokenizer = new StringTokenizer(expression, ",");
-         ArrayList paramList = new ArrayList();
+         ArrayList<Pattern> paramList = new ArrayList<Pattern>();
          while (tokenizer.hasMoreTokens())
          {
             String token = tokenizer.nextToken().trim();
@@ -95,11 +95,11 @@
             token = token.replaceAll("\\]", "\\\\]");
             paramList.add(Pattern.compile(token));
          }
-         parameterPatterns = (Pattern[])paramList.toArray(new Pattern[paramList.size()]);
+         parameterPatterns = paramList.toArray(new Pattern[paramList.size()]);
       }
    }
 
-   public boolean matches(Class[] params)
+   public boolean matches(Class<?>[] params)
    {
       if (isAll)
       {

Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/hook/GenerateInstrumentedClassLoader.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/hook/GenerateInstrumentedClassLoader.java	2008-03-24 03:08:33 UTC (rev 71183)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/hook/GenerateInstrumentedClassLoader.java	2008-03-24 03:41:24 UTC (rev 71184)
@@ -48,12 +48,33 @@
       CtMethod wrapper = CtNewMethod.make(Modifier.PROTECTED, method.getReturnType(), "defineClass", method.getParameterTypes(), method.getExceptionTypes(), null, clazz);
 
       String code = "{"
-              + "  byte[] newBytes = org.jboss.aop.AspectManager.instance().translate($1, $0, $2) ;"
-              + "  if (newBytes != (byte[])null) {"
-              + "    return wrappedDefineClass($1, newBytes, 0, newBytes.length, $5); "
-              + "  } else {"
-              + "    return wrappedDefineClass($1, $2, $3, $4, $5); "
-              + "  }"
+              + " if (!$1.startsWith(\"org.jboss.aop.\") &&"
+              + " !$1.endsWith(\"$aop\") &&"
+              + " !$1.startsWith(\"javassist\") &&"
+              + " !$1.startsWith(\"org.jboss.util.\") &&"
+              + " !$1.startsWith(\"gnu.trove.\") &&"
+              + " !$1.startsWith(\"EDU.oswego.cs.dl.util.concurrent.\") &&"
+              // System classes
+              + " !$1.startsWith(\"org.apache.crimson\") &&"
+              + " !$1.startsWith(\"org.apache.xalan\") &&"
+              + " !$1.startsWith(\"org.apache.xml\") &&"
+              + " !$1.startsWith(\"org.apache.xpath\") &&"
+              + " !$1.startsWith(\"org.ietf.\") &&"
+              + " !$1.startsWith(\"org.omg.\") &&"
+              + " !$1.startsWith(\"org.w3c.\") &&"
+              + " !$1.startsWith(\"org.xml.sax.\") &&"
+              + " !$1.startsWith(\"sunw.\") &&"
+              + " !$1.startsWith(\"sun.\") &&"
+              + " !$1.startsWith(\"java.\") &&"
+              + " !$1.startsWith(\"javax.\") &&"
+              + " !$1.startsWith(\"com.sun.\") &&"
+              + " !$1.startsWith(\"$Proxy\")) {"
+              + "      byte[] newBytes = org.jboss.aop.AspectManager.instance().translate($1, $0, $2) ;"
+              + "      if (newBytes != (byte[])null) {"
+              + "         return wrappedDefineClass($1, newBytes, 0, newBytes.length, $5); "
+              + "      }}"
+              + "  return wrappedDefineClass($1, $2, $3, $4, $5); "
+              + "  "
               + "}";
       wrapper.setBody(code);
       clazz.addMethod(wrapper);

Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/hook/JDK14TransformerManager.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/hook/JDK14TransformerManager.java	2008-03-24 03:08:33 UTC (rev 71183)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/hook/JDK14TransformerManager.java	2008-03-24 03:41:24 UTC (rev 71184)
@@ -41,7 +41,7 @@
 
    public static boolean isNonAdvisableClassName(String classname)
    {
-      return (classname.startsWith("org.jboss.aop") ||
+      return (classname.startsWith("org.jboss.aop.") ||
       classname.endsWith("$aop") ||
       classname.startsWith("javassist") ||
       classname.startsWith("org.jboss.util.") ||

Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/instrument/CallerTransformer.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/instrument/CallerTransformer.java	2008-03-24 03:08:33 UTC (rev 71183)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/instrument/CallerTransformer.java	2008-03-24 03:41:24 UTC (rev 71184)
@@ -326,7 +326,7 @@
          {
             if (ClassAdvisor.isWithoutAdvisement(methodName)
             || methodName.startsWith("_")
-            || classname.startsWith("org.jboss.aop")
+            || classname.startsWith("org.jboss.aop.")
             || call.getMethodName().equals("class$") // todo not sure why this is part of the method call
             || !Instrumentor.isTransformable(callingClass)
             )
@@ -434,7 +434,7 @@
          try
          {
             String classname = call.getClassName();
-            if (classname.startsWith("org.jboss.aop") || !Instrumentor.isTransformable(callingClass))
+            if (classname.startsWith("org.jboss.aop.") || !Instrumentor.isTransformable(callingClass))
             {
                return;
             }

Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/instrument/GeneratedAdvisorMethodExecutionTransformer.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/instrument/GeneratedAdvisorMethodExecutionTransformer.java	2008-03-24 03:08:33 UTC (rev 71183)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/instrument/GeneratedAdvisorMethodExecutionTransformer.java	2008-03-24 03:41:24 UTC (rev 71184)
@@ -464,30 +464,32 @@
    {
       String joinpointName = getJoinPointFieldName(trans);
       String infoName = getMethodInfoFieldName(trans.getOriginalName(), trans.getHash());
-
+      
       String code =
          "{" +
-         "   if (" + joinpointName + " == null && " + infoName + " != null && " + infoName + ".hasAdvices())" +
+         "   if (" + infoName + " == null) {"+
+         "         " + getAopReturnStr(trans.getWMethod()) + "$1." + trans.getWrappedName() + "(" + getNonStaticJavasistParamString(trans.getWMethod().getParameterTypes().length) + ");" +
+         (trans.getWMethod().getReturnType().equals(CtClass.voidType)? "return;":"") +
+             "}" +
+         GeneratedAdvisorInstrumentor.generateInterceptorChainLockCode(infoName) +
+         "   try" +
          "   {" +
-         GeneratedAdvisorInstrumentor.generateInterceptorChainLockCode(infoName) +
-         "      try" +
+
+         "      if (" + joinpointName + " == null && " + infoName + " != null && " + infoName + ".hasAdvices())" +
          "      {" +
-         "          if (" + joinpointName + " == null && " + infoName + " != null && " + infoName + ".hasAdvices())" +
-         "          {" +
-         "              super." + JoinPointGenerator.GENERATE_JOINPOINT_CLASS + "(" + infoName + ");" +
-         "          }" +
-         "      } finally {" +
+         "           super." + JoinPointGenerator.GENERATE_JOINPOINT_CLASS + "(" + infoName + ");" +
+         "      }" +
+         "      if (" + joinpointName + " == null)" +
+         "      { " +
+         "         " + getAopReturnStr(trans.getWMethod()) + "$1." + trans.getWrappedName() + "(" + getNonStaticJavasistParamString(trans.getWMethod().getParameterTypes().length) + ");" +
+         "      }" +
+         "      else" +
+         "      {" +
+         "       " + getAopReturnStr(trans.getWMethod()) + joinpointName + "." + MethodJoinPointGenerator.INVOKE_JOINPOINT + "($$);" +
+         "      }" +
+         "   } finally {" +
          GeneratedAdvisorInstrumentor.generateInterceptorChainUnlockCode(infoName) +
-         "      }" +
          "   }" +
-         "   if (" + joinpointName + " == null)" +
-         "   { " +
-         "      " + getAopReturnStr(trans.getWMethod()) + "$1." + trans.getWrappedName() + "(" + getNonStaticJavasistParamString(trans.getWMethod().getParameterTypes().length) + ");" +
-         "   }" +
-         "   else" +
-         "   {" +
-         "    " + getAopReturnStr(trans.getWMethod()) + joinpointName + "." + MethodJoinPointGenerator.INVOKE_JOINPOINT + "($$);" +
-         "   }" +
          "}";
 
       return code;

Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/instrument/Instrumentor.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/instrument/Instrumentor.java	2008-03-24 03:08:33 UTC (rev 71183)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/instrument/Instrumentor.java	2008-03-24 03:41:24 UTC (rev 71184)
@@ -171,6 +171,29 @@
       return false;
    }
 
+   public boolean isProxyObject(CtClass clazz) throws NotFoundException
+   {
+      CtClass[] interfaces = clazz.getInterfaces();
+      CtClass proxyObject = forName("javassist.util.proxy.ProxyObject");
+      for (int i = 0; i < interfaces.length; i++)
+      {
+         if (interfaces[i].equals(proxyObject)) return true;
+         if (interfaces[i].getName().equals("javassist.util.proxy.ProxyObject")) return true;
+      }
+      return false;
+   }
+   
+   public void prepareClassForTransformation(CtClass clazz) throws NotFoundException
+   {
+      CtMethod[] methods = clazz.getDeclaredMethods();
+      for(int i=0; i < methods.length;i++)
+      {
+         if(methods[i].getName().equals("_getAdvisor") ||
+               methods[i].getName().equals("_getInstanceAdvisor"))
+            clazz.removeMethod(methods[i]);
+      }
+   }
+
    public static boolean implementsAdvised(CtClass clazz) throws NotFoundException
    {
       CtClass[] interfaces = clazz.getInterfaces();
@@ -686,8 +709,9 @@
       return (clazz.isInterface() ||
             clazz.isFrozen() ||
             clazz.isArray() ||
-            clazz.getName().startsWith("org.jboss.aop") ||
+            clazz.getName().startsWith("org.jboss.aop.") ||
             isAdvised(clazz) ||
+//            isProxyObject(clazz) ||
             !isTransformable(clazz));
    }
 
@@ -700,6 +724,7 @@
       try
       {
          if (shouldNotTransform(clazz)) return false;
+         prepareClassForTransformation(clazz);
          if (AspectManager.verbose && logger.isDebugEnabled()) logger.debug("trying to transform " + clazz.getName());
 
          DeclareChecker.checkDeclares(manager, clazz, advisor);
@@ -908,6 +933,7 @@
 
       // add marker interface.
       clazz.addInterface(forName(AOP_PACKAGE + ".Advised"));
+
       doSetupBasics(clazz);
    }
 
@@ -946,7 +972,6 @@
          }
          // instrument classes that access the joinpoints whose status have changed, in
          // order to make this classes access the joinpoint wrapper instead
-         Collection classPools = manager.getRegisteredCLs().values();
          Collection conversionsRegistered = new HashSet();
          synchronized(this.processedClasses)
          {

Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/instrument/JoinPointGenerator.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/instrument/JoinPointGenerator.java	2008-03-24 03:08:33 UTC (rev 71183)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/instrument/JoinPointGenerator.java	2008-03-24 03:41:24 UTC (rev 71184)
@@ -441,7 +441,7 @@
 
    private String getJoinpointClassName()
    {
-      return baseJoinPointClassName + getIncrement();
+      return baseJoinPointClassName + getIncrement() + "$aop";
    }
 
    private void createInitialisePerInstanceAspectsMethod(CtClass clazz, AdviceSetups setups, Class advisedClass) throws CannotCompileException, NotFoundException

Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/instrument/JoinpointStatusUpdate.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/instrument/JoinpointStatusUpdate.java	2008-03-24 03:08:33 UTC (rev 71183)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/instrument/JoinpointStatusUpdate.java	2008-03-24 03:41:24 UTC (rev 71184)
@@ -24,6 +24,8 @@
 import java.util.ArrayList;
 import java.util.Collection;
 
+import org.jboss.aop.MethodInfo;
+
 import javassist.CtClass;
 
 /**
@@ -65,25 +67,25 @@
        * The field read joinpoints.
        * A collection of <code>java.lang.Integer</code>.
        */
-      public Collection fieldReads;
+      public Collection<Integer> fieldReads;
 
       /**
        * The field write joinponts.
        * A collection of <code>java.lang.Integer</code>.
        */
-      public Collection fieldWrites;
+      public Collection<Integer> fieldWrites;
       
       /**
        * The constructor execution joinpoints.
        * A collection of <code>java.lang.Integer</code>.
        */
-      public Collection constructorExecutions;
+      public Collection<Integer> constructorExecutions;
       
       /**
        * The method execution joinpoints.
-       * A collection of <code>org.jboss.aop.MethodJoinPoint</code>.
+       * A collection of <code>org.jboss.aop.MethodInfo</code>.
        */
-      public Collection methodExecutions;
+      public Collection<MethodInfo> methodExecutions;
       
       /**
        * Constructor.
@@ -95,10 +97,10 @@
        * instance may contain.
        */
       public ClassJoinpoints(int fields, int constructors, int methods) {
-         this.fieldReads = new ArrayList(fields);
-         this.fieldWrites = new ArrayList(fields);
-         this.constructorExecutions = new ArrayList(constructors);
-         this.methodExecutions = new ArrayList(methods);
+         this.fieldReads = new ArrayList<Integer>(fields);
+         this.fieldWrites = new ArrayList<Integer>(fields);
+         this.constructorExecutions = new ArrayList<Integer>(constructors);
+         this.methodExecutions = new ArrayList<MethodInfo>(methods);
       }     
       
       /**

Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/instrument/OptimizedCallerInvocations.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/instrument/OptimizedCallerInvocations.java	2008-03-24 03:08:33 UTC (rev 71183)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/instrument/OptimizedCallerInvocations.java	2008-03-24 03:41:24 UTC (rev 71184)
@@ -112,7 +112,7 @@
       ////////////////
       //Create the class
       CtClass invocation = makeInvocationClass(pool, 
-            Modifier.isPrivate(method.getModifiers()), callingClass, className,
+            true /*Modifier.isPrivate(method.getModifiers())*/, callingClass, className,
                   methodInvocation);
    
       ////////////////
@@ -163,7 +163,7 @@
       ////////////////
       //Create the class
       CtClass invocation = makeInvocationClass(pool,
-            Modifier.isPrivate(con.getModifiers()), callingClass, className,
+            /*Modifier.isPrivate(con.getModifiers())*/ true, callingClass, className,
             conInvocation);
    
       ////////////////

Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/instrument/OptimizedConstructionInvocations.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/instrument/OptimizedConstructionInvocations.java	2008-03-24 03:08:33 UTC (rev 71183)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/instrument/OptimizedConstructionInvocations.java	2008-03-24 03:41:24 UTC (rev 71184)
@@ -48,7 +48,7 @@
     */
    protected static String getOptimizedInvocationClassName(CtClass declaringClazz, int constructorIndex)
    {
-      return declaringClazz.getName() + constructorIndex + "OptimizedConstructionInvocation";
+      return declaringClazz.getName() + ".AOP" + constructorIndex + "OptimizedConstructionInvocation";
    }
 
    protected static String createOptimizedInvocationClass(
@@ -61,7 +61,7 @@
       ////////////////
       //Create the class
       String className = getOptimizedInvocationClassName(clazz, index);
-      boolean makeInnerClass = !Modifier.isPublic(con.getModifiers());
+      boolean makeInnerClass = true; //!Modifier.isPublic(con.getModifiers());
       CtClass invocation = makeInvocationClassNoCtors(pool, makeInnerClass, clazz,
             className, conInvocation);
       CtConstructor template = null;

Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/instrument/OptimizedConstructorInvocations.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/instrument/OptimizedConstructorInvocations.java	2008-03-24 03:08:33 UTC (rev 71183)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/instrument/OptimizedConstructorInvocations.java	2008-03-24 03:41:24 UTC (rev 71184)
@@ -49,7 +49,7 @@
     */
    protected static String getOptimizedInvocationClassName(CtClass declaringClazz, int constructorIndex)
    {
-      return declaringClazz.getName() + "_" + constructorIndex + "OptimizedConstructorInvocation";
+      return declaringClazz.getName() + ".AOP" + constructorIndex + "OptimizedConstructorInvocation";
    }
 
    protected static String createOptimizedInvocationClass(Instrumentor instrumentor,
@@ -62,7 +62,7 @@
       ////////////////
       //Create the class
       String className = getOptimizedInvocationClassName(clazz, index);
-      boolean makeInnerClass = !Modifier.isPublic(con.getModifiers());
+      boolean makeInnerClass = true;//!Modifier.isPublic(con.getModifiers());
       CtClass invocation = makeInvocationClassNoCtors(pool, makeInnerClass,
             clazz, className, conInvocation);
       

Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/introduction/AnnotationIntroduction.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/introduction/AnnotationIntroduction.java	2008-03-24 03:08:33 UTC (rev 71183)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/introduction/AnnotationIntroduction.java	2008-03-24 03:41:24 UTC (rev 71184)
@@ -132,7 +132,7 @@
       return ((Boolean) target.jjtAccept(matcher, null)).booleanValue();
    }
 
-   public boolean matches(Advisor advisor, Class clazz)
+   public boolean matches(Advisor advisor, Class<?> clazz)
    {
       AnnotationMatcher matcher = new AnnotationMatcher(advisor, clazz);
       return ((Boolean) target.jjtAccept(matcher, null)).booleanValue();
@@ -144,7 +144,7 @@
       return ((Boolean) target.jjtAccept(matcher, null)).booleanValue();
    }
 
-   public boolean matches(Advisor advisor, Constructor con)
+   public boolean matches(Advisor advisor, Constructor<?> con)
    {
       AnnotationMatcher matcher = new AnnotationMatcher(advisor, con);
       return ((Boolean) target.jjtAccept(matcher, null)).booleanValue();

Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/introduction/InterfaceIntroduction.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/introduction/InterfaceIntroduction.java	2008-03-24 03:08:33 UTC (rev 71183)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/introduction/InterfaceIntroduction.java	2008-03-24 03:41:24 UTC (rev 71184)
@@ -264,7 +264,7 @@
       }
    }
 
-   public boolean matches(Advisor advisor, Class clazz)
+   public boolean matches(Advisor advisor, Class<?> clazz)
    {
       if (classExpr != null)
          return Util.matchesClassExpr(classExpr, clazz, advisor);

Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/Construction.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/Construction.java	2008-03-24 03:08:33 UTC (rev 71183)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/Construction.java	2008-03-24 03:41:24 UTC (rev 71184)
@@ -36,5 +36,5 @@
    /**
     * Gets the constructor being called
     */
-   Constructor getConstructor();
+   Constructor<?> getConstructor();
 }
\ No newline at end of file

Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/ConstructionInvocation.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/ConstructionInvocation.java	2008-03-24 03:08:33 UTC (rev 71183)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/ConstructionInvocation.java	2008-03-24 03:41:24 UTC (rev 71184)
@@ -21,6 +21,7 @@
   */
 package org.jboss.aop.joinpoint;
 
+import java.lang.annotation.Annotation;
 import java.lang.reflect.Constructor;
 
 import org.jboss.aop.ConstructionInfo;
@@ -40,9 +41,9 @@
    private static final long serialVersionUID = -6040602776303875808L;
 
    protected Object[] arguments = null; // MARSHALLED
-   protected transient Constructor constructor = null;
+   protected transient Constructor<?> constructor = null;
 
-   public ConstructionInvocation(Interceptor[] interceptors, Constructor con, Object[] args)
+   public ConstructionInvocation(Interceptor[] interceptors, Constructor<?> con, Object[] args)
    {
       super(interceptors);
       this.constructor = con;
@@ -50,7 +51,7 @@
    }
 
 
-   public ConstructionInvocation(Interceptor[] interceptors, Constructor con)
+   public ConstructionInvocation(Interceptor[] interceptors, Constructor<?> con)
    {
       super(interceptors);
       this.constructor = con;
@@ -102,20 +103,24 @@
     * This method resolves an annotation based on the context of the invocation.
     *
     */
-   public Object resolveAnnotation(Class annotation)
+   public Object resolveAnnotation(Class<? extends Annotation> annotation)
    {
-      Object val = super.resolveAnnotation(annotation);
+      return resolveTypedAnnotation(annotation);
+   }
+
+   public <T extends Annotation> T resolveTypedAnnotation(Class<T> annotation)
+   {
+      T val = super.resolveTypedAnnotation(annotation);
       if (val != null) return val;
 
       if (getAdvisor() != null)
       {
-         val = getAdvisor().resolveAnnotation(constructor, annotation);
+         val = getAdvisor().resolveTypedAnnotation(constructor, annotation);
          if (val != null) return val;
       }
 
       return null;
    }
-
    /**
     * This method resolves metadata based on the context of the invocation.
     * It iterates through its list of MetaDataResolvers to find out the
@@ -221,12 +226,12 @@
       this.arguments = arguments;
    }
 
-   public Constructor getConstructor()
+   public Constructor<?> getConstructor()
    {
       return constructor;
    }
 
-   public void setConstructor(Constructor constructor)
+   public void setConstructor(Constructor<?> constructor)
    {
       this.constructor = constructor;
    }

Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/ConstructionInvocationWrapper.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/ConstructionInvocationWrapper.java	2008-03-24 03:08:33 UTC (rev 71183)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/ConstructionInvocationWrapper.java	2008-03-24 03:41:24 UTC (rev 71184)
@@ -99,22 +99,22 @@
       return invocation;
    }
 
-   public Constructor getConstructor()
+   public Constructor<?> getConstructor()
    {
       return wrapped.getConstructor();
    }
 
-   public void setConstructor(Constructor constructor)
-   {
-      wrapped.setConstructor(constructor);
-   }
+//   public void setConstructor(Constructor<?> constructor)
+//   {
+//      wrapped.setConstructor(constructor);
+//   }
 
-   public Map getResponseContextInfo()
+   public Map<Object, Object> getResponseContextInfo()
    {
       return wrapped.getResponseContextInfo();
    }
 
-   public void setResponseContextInfo(Map responseContextInfo)
+   public void setResponseContextInfo(Map<Object, Object> responseContextInfo)
    {
       wrapped.setResponseContextInfo(responseContextInfo);
    }

Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/ConstructorCall.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/ConstructorCall.java	2008-03-24 03:08:33 UTC (rev 71183)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/ConstructorCall.java	2008-03-24 03:41:24 UTC (rev 71184)
@@ -34,16 +34,16 @@
    /**
     * Gets the constructor being called
     */
-   Constructor getConstructor();
+   Constructor<?> getConstructor();
 
    /**
     * Gets the class making the call
     */
-   Class getCallingClass();
+   Class<?> getCallingClass();
 
    /**
     * Gets the class being called
     */
-   Class getCalledClass();
+   Class<?> getCalledClass();
 
 }
\ No newline at end of file

Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/ConstructorCallByConstructor.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/ConstructorCallByConstructor.java	2008-03-24 03:08:33 UTC (rev 71183)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/ConstructorCallByConstructor.java	2008-03-24 03:41:24 UTC (rev 71184)
@@ -34,6 +34,6 @@
    /**
     * Gets the calling constructor
     */
-   Constructor getCallingConstructor();
+   Constructor<?> getCallingConstructor();
 
 }
\ No newline at end of file

Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/ConstructorCalledByConstructorInvocation.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/ConstructorCalledByConstructorInvocation.java	2008-03-24 03:08:33 UTC (rev 71183)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/ConstructorCalledByConstructorInvocation.java	2008-03-24 03:41:24 UTC (rev 71184)
@@ -43,8 +43,8 @@
    private static final long serialVersionUID = -1569257745454443521L;
 
    //info fields
-   protected Constructor calling;
-   protected Constructor constructor;
+   protected Constructor<?> calling;
+   protected Constructor<?> constructor;
    protected Method wrappingMethod;
    
    public ConstructorCalledByConstructorInvocation(ConByConInfo info, Object callingObject, Object[] args, Interceptor[] interceptors)
@@ -57,7 +57,7 @@
       this(info.getAdvisor(), info.getCallingConstructor(), info.getConstructor(), info.getWrappingMethod(), callingObject, null, interceptors);
    }
    
-   public ConstructorCalledByConstructorInvocation(Advisor advisor, Constructor calling, Constructor constructor, Method wrappingMethod, Object callingObject, Object[] args, Interceptor[] interceptors)
+   public ConstructorCalledByConstructorInvocation(Advisor advisor, Constructor<?> calling, Constructor<?> constructor, Method wrappingMethod, Object callingObject, Object[] args, Interceptor[] interceptors)
    {
       super(advisor, callingObject, interceptors);
       this.calling = calling;
@@ -75,7 +75,7 @@
     *
     * @return the constructor that is calling the called constructor
     */
-   public Constructor getCallingConstructor()
+   public Constructor<?> getCallingConstructor()
    {
       return calling;
    }
@@ -83,7 +83,7 @@
     *
     * @return the constructor call being executed by the calling method
     */
-   public Constructor getCalledConstructor() { return constructor; }
+   public Constructor<?> getCalledConstructor() { return constructor; }
 
    /**
     * Is the called constructor aspectized?  If so then there is a wrapping

Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/ConstructorCalledByConstructorInvocationWrapper.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/ConstructorCalledByConstructorInvocationWrapper.java	2008-03-24 03:08:33 UTC (rev 71183)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/ConstructorCalledByConstructorInvocationWrapper.java	2008-03-24 03:41:24 UTC (rev 71184)
@@ -93,12 +93,12 @@
       wrapped.setArguments(arguments);
    }
 
-   public Constructor getCallingConstructor()
+   public Constructor<?> getCallingConstructor()
    {
       return wrapped.getCallingConstructor();
    }
 
-   public Constructor getCalledConstructor()
+   public Constructor<?> getCalledConstructor()
    {
       return wrapped.getCalledConstructor();
    }
@@ -120,7 +120,7 @@
       return invocation;
    }
 
-   public Map getResponseContextInfo()
+   public Map<Object, Object> getResponseContextInfo()
    {
       return wrapped.getResponseContextInfo();
    }
@@ -130,7 +130,7 @@
       wrapped.addResponseAttachment(key, val);
    }
 
-   public void setResponseContextInfo(Map responseContextInfo)
+   public void setResponseContextInfo(Map<Object, Object> responseContextInfo)
    {
       wrapped.setResponseContextInfo(responseContextInfo);
    }

Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/ConstructorCalledByConstructorJoinpoint.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/ConstructorCalledByConstructorJoinpoint.java	2008-03-24 03:08:33 UTC (rev 71183)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/ConstructorCalledByConstructorJoinpoint.java	2008-03-24 03:41:24 UTC (rev 71184)
@@ -31,11 +31,11 @@
  */
 public class ConstructorCalledByConstructorJoinpoint implements Joinpoint
 {
-   private final Constructor calling;
-   private final Constructor called;
+   private final Constructor<?> calling;
+   private final Constructor<?> called;
    int hashCode;
 
-   public ConstructorCalledByConstructorJoinpoint(Constructor calling, Constructor called)
+   public ConstructorCalledByConstructorJoinpoint(Constructor<?> calling, Constructor<?> called)
    {
       this.calling = calling;
       this.called = called;
@@ -61,12 +61,12 @@
       return hashCode;
    }
 
-   public Constructor getCalling()
+   public Constructor<?> getCalling()
    {
       return calling;
    }
 
-   public Constructor getCalled()
+   public Constructor<?> getCalled()
    {
       return called;
    }

Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/ConstructorCalledByMethodInvocation.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/ConstructorCalledByMethodInvocation.java	2008-03-24 03:08:33 UTC (rev 71183)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/ConstructorCalledByMethodInvocation.java	2008-03-24 03:41:24 UTC (rev 71184)
@@ -43,9 +43,9 @@
    private static final long serialVersionUID = -3269308917757322223L;
 
    //info fields
-   protected Class callingClass;
+   protected Class<?> callingClass;
    protected Method callingMethod;
-   protected Constructor constructor;
+   protected Constructor<?> constructor;
    protected Method wrappingMethod; 
    
    public ConstructorCalledByMethodInvocation(ConByMethodInfo info, Object callingObject, Object[] args, Interceptor[] interceptors)
@@ -58,8 +58,8 @@
       this(info.getAdvisor(), info.getCallingClass(), info.getCallingMethod(), info.getConstructor(), info.getWrappingMethod(), callingObject, null, interceptors);
    }
    
-   public ConstructorCalledByMethodInvocation(Advisor advisor, Class callingClass, 
-         Method callingMethod, Constructor constructor, Method wrappingMethod, Object callingObject, Object[] args, Interceptor[] interceptors)
+   public ConstructorCalledByMethodInvocation(Advisor advisor, Class<?> callingClass, 
+         Method callingMethod, Constructor<?> constructor, Method wrappingMethod, Object callingObject, Object[] args, Interceptor[] interceptors)
    {
       super(advisor, callingObject, interceptors);
       this.callingClass = callingClass;
@@ -78,7 +78,7 @@
    /**
     * @return The class that is making the call on the constructor
     */
-   public Class getCallingClass()
+   public Class<?> getCallingClass()
    {
       return callingClass;
    }
@@ -94,7 +94,7 @@
    /**
     * @return the constructor call being executed by the calling method
     */
-   public Constructor getCalledConstructor()
+   public Constructor<?> getCalledConstructor()
    {
       return constructor;
    }

Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/ConstructorCalledByMethodInvocationWrapper.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/ConstructorCalledByMethodInvocationWrapper.java	2008-03-24 03:08:33 UTC (rev 71183)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/ConstructorCalledByMethodInvocationWrapper.java	2008-03-24 03:41:24 UTC (rev 71184)
@@ -75,7 +75,7 @@
       return wrapped.getInstanceResolver();
    }
 
-   public Class getCallingClass()
+   public Class<?> getCallingClass()
    {
       return wrapped.getCallingClass();
    }
@@ -85,7 +85,7 @@
       return wrapped.getCallingMethod();
    }
 
-   public Constructor getCalledConstructor()
+   public Constructor<?> getCalledConstructor()
    {
       return wrapped.getCalledConstructor();
    }
@@ -122,12 +122,12 @@
       wrapped.setTargetObject(targetObject);
    }
 
-   public Map getResponseContextInfo()
+   public Map<Object, Object> getResponseContextInfo()
    {
       return wrapped.getResponseContextInfo();
    }
 
-   public void setResponseContextInfo(Map responseContextInfo)
+   public void setResponseContextInfo(Map<Object, Object> responseContextInfo)
    {
       wrapped.setResponseContextInfo(responseContextInfo);
    }

Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/ConstructorCalledByMethodJoinpoint.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/ConstructorCalledByMethodJoinpoint.java	2008-03-24 03:08:33 UTC (rev 71183)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/ConstructorCalledByMethodJoinpoint.java	2008-03-24 03:41:24 UTC (rev 71184)
@@ -33,10 +33,10 @@
 public class ConstructorCalledByMethodJoinpoint implements Joinpoint
 {
    private final Method calling;
-   private final Constructor called;
+   private final Constructor<?> called;
    int hashCode;
 
-   public ConstructorCalledByMethodJoinpoint(Method calling, Constructor called)
+   public ConstructorCalledByMethodJoinpoint(Method calling, Constructor<?> called)
    {
       this.calling = calling;
       this.called = called;
@@ -67,7 +67,7 @@
       return calling;
    }
 
-   public Constructor getCalled()
+   public Constructor<?> getCalled()
    {
       return called;
    }

Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/ConstructorExecution.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/ConstructorExecution.java	2008-03-24 03:08:33 UTC (rev 71183)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/ConstructorExecution.java	2008-03-24 03:41:24 UTC (rev 71184)
@@ -35,6 +35,6 @@
    /**
     * Gets the constructor being called
     */
-   Constructor getConstructor();
+   Constructor<?> getConstructor();
 
 }
\ No newline at end of file

Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/ConstructorInvocation.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/ConstructorInvocation.java	2008-03-24 03:08:33 UTC (rev 71183)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/ConstructorInvocation.java	2008-03-24 03:41:24 UTC (rev 71184)
@@ -24,6 +24,7 @@
 import org.jboss.aop.ConstructorInfo;
 import org.jboss.aop.advice.Interceptor;
 
+import java.lang.annotation.Annotation;
 import java.lang.reflect.Constructor;
 import java.lang.reflect.InvocationTargetException;
 
@@ -40,7 +41,7 @@
    private static final long serialVersionUID = -7880020293056198584L;
 
    protected Object[] arguments = null; // MARSHALLED
-   protected transient Constructor constructor = null;
+   protected transient Constructor<?> constructor = null;
 
    public ConstructorInvocation(Interceptor[] interceptors)
    {
@@ -86,7 +87,7 @@
    {
       try
       {
-         Constructor con = getConstructor();
+         Constructor<?> con = getConstructor();
          Object[] args = getArguments();
          setTargetObject(con.newInstance(args));
          return getTargetObject();
@@ -115,14 +116,19 @@
     * This method resolves an annotation based on the context of the invocation.
     *
     */
-   public Object resolveAnnotation(Class annotation)
+   public Object resolveAnnotation(Class<? extends Annotation> annotation)
    {
-      Object val = super.resolveAnnotation(annotation);
+      return resolveTypedAnnotation(annotation);
+   }
+
+   public <T extends Annotation> T resolveTypedAnnotation(Class<T> annotation)
+   {
+      T val = super.resolveTypedAnnotation(annotation);
       if (val != null) return val;
 
       if (getAdvisor() != null)
       {
-         val = getAdvisor().resolveAnnotation(constructor, annotation);
+         val = getAdvisor().resolveTypedAnnotation(constructor, annotation);
          if (val != null) return val;
       }
 
@@ -227,12 +233,12 @@
       this.arguments = arguments;
    }
 
-   public Constructor getConstructor()
+   public Constructor<?> getConstructor()
    {
       return constructor;
    }
 
-   public void setConstructor(Constructor constructor)
+   public void setConstructor(Constructor<?> constructor)
    {
       this.constructor = constructor;
    }

Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/ConstructorInvocationWrapper.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/ConstructorInvocationWrapper.java	2008-03-24 03:08:33 UTC (rev 71183)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/ConstructorInvocationWrapper.java	2008-03-24 03:41:24 UTC (rev 71184)
@@ -99,22 +99,22 @@
       return invocation;
    }
 
-   public Constructor getConstructor()
+   public Constructor<?> getConstructor()
    {
       return wrapped.getConstructor();
    }
 
-   public void setConstructor(Constructor constructor)
+   public void setConstructor(Constructor<?> constructor)
    {
       wrapped.setConstructor(constructor);
    }
 
-   public Map getResponseContextInfo()
+   public Map<Object, Object> getResponseContextInfo()
    {
       return wrapped.getResponseContextInfo();
    }
 
-   public void setResponseContextInfo(Map responseContextInfo)
+   public void setResponseContextInfo(Map<Object, Object> responseContextInfo)
    {
       wrapped.setResponseContextInfo(responseContextInfo);
    }

Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/ConstructorJoinpoint.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/ConstructorJoinpoint.java	2008-03-24 03:08:33 UTC (rev 71183)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/ConstructorJoinpoint.java	2008-03-24 03:41:24 UTC (rev 71184)
@@ -31,10 +31,10 @@
  */
 public class ConstructorJoinpoint implements Joinpoint
 {
-   private final Constructor constructor;
+   private final Constructor<?> constructor;
    int hashCode;
 
-   public ConstructorJoinpoint(Constructor con)
+   public ConstructorJoinpoint(Constructor<?> con)
    {
       this.constructor = con;
    }
@@ -57,7 +57,7 @@
       return hashCode;
    }
 
-   public Constructor getConstructor()
+   public Constructor<?> getConstructor()
    {
       return constructor;
    }

Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/FieldInvocation.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/FieldInvocation.java	2008-03-24 03:08:33 UTC (rev 71183)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/FieldInvocation.java	2008-03-24 03:41:24 UTC (rev 71184)
@@ -24,6 +24,7 @@
 import org.jboss.aop.FieldInfo;
 import org.jboss.aop.advice.Interceptor;
 
+import java.lang.annotation.Annotation;
 import java.lang.reflect.Field;
 
 /**
@@ -63,19 +64,25 @@
     * This method resolves an annotation based on the context of the invocation.
     *
     */
-   public Object resolveAnnotation(Class annotation)
+   public Object resolveAnnotation(Class<? extends Annotation> annotation)
    {
-      Object val = super.resolveAnnotation(annotation);
+      return resolveTypedAnnotation(annotation);
+   }
+
+   public <T extends Annotation> T resolveTypedAnnotation(Class<T> annotation)
+   {
+      T val = super.resolveTypedAnnotation(annotation);
       if (val != null) return val;
 
       if (getAdvisor() != null)
       {
-         val = getAdvisor().resolveAnnotation(field, annotation);
+         val = getAdvisor().resolveTypedAnnotation(field, annotation);
          if (val != null) return val;
       }
 
       return null;
    }
+   
    /**
     * This method resolves metadata based on the context of the invocation.
     * It iterates through its list of MetaDataResolvers to find out the

Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/FieldReadInvocationWrapper.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/FieldReadInvocationWrapper.java	2008-03-24 03:08:33 UTC (rev 71183)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/FieldReadInvocationWrapper.java	2008-03-24 03:41:24 UTC (rev 71184)
@@ -99,12 +99,12 @@
       return wrapped.getIndex();
    }
 
-   public Map getResponseContextInfo()
+   public Map<Object, Object> getResponseContextInfo()
    {
       return wrapped.getResponseContextInfo();
    }
 
-   public void setResponseContextInfo(Map responseContextInfo)
+   public void setResponseContextInfo(Map<Object, Object> responseContextInfo)
    {
       wrapped.setResponseContextInfo(responseContextInfo);
    }

Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/FieldWriteInvocationWrapper.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/FieldWriteInvocationWrapper.java	2008-03-24 03:08:33 UTC (rev 71183)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/FieldWriteInvocationWrapper.java	2008-03-24 03:41:24 UTC (rev 71184)
@@ -109,12 +109,12 @@
       return wrapped.getIndex();
    }
 
-   public Map getResponseContextInfo()
+   public Map<Object, Object> getResponseContextInfo()
    {
       return wrapped.getResponseContextInfo();
    }
 
-   public void setResponseContextInfo(Map responseContextInfo)
+   public void setResponseContextInfo(Map<Object, Object> responseContextInfo)
    {
       wrapped.setResponseContextInfo(responseContextInfo);
    }

Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/Invocation.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/Invocation.java	2008-03-24 03:08:33 UTC (rev 71183)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/Invocation.java	2008-03-24 03:41:24 UTC (rev 71184)
@@ -25,6 +25,7 @@
 import org.jboss.aop.advice.Interceptor;
 import org.jboss.aop.metadata.SimpleMetaData;
 
+import java.lang.annotation.Annotation;
 import java.util.Map;
 
 /**
@@ -35,9 +36,9 @@
  */
 public interface Invocation
 {
-   Map getResponseContextInfo();
+   Map<Object, Object> getResponseContextInfo();
 
-   void setResponseContextInfo(Map responseContextInfo);
+   void setResponseContextInfo(Map<Object, Object> responseContextInfo);
 
    void addResponseAttachment(Object key, Object val);
 
@@ -62,6 +63,7 @@
     */
    Object resolveClassMetaData(Object key, Object attr);
 
+   
    /**
     * Abstraction for resolving an annotation so that
     * it can be overriden from the Class
@@ -69,26 +71,53 @@
     * @param annotation
     * @return
     */
-   Object resolveClassAnnotation(Class annotation);
+   Object resolveClassAnnotation(Class<? extends Annotation> annotation);
 
    /**
     * Abstraction for resolving an annotation so that
+    * it can be overriden from the Class
+    *
+    * @param annotation
+    * @return
+    */
+   <T extends Annotation> T resolveTypedClassAnnotation(Class<T> annotation);
+
+   /**
+    * Abstraction for resolving an annotation so that
     * it can be overriden from the Method, Constructor, Field, etc.
     *
     * @param annotation
     * @return
     */
-   Object resolveAnnotation(Class annotation);
+   Object resolveAnnotation(Class<? extends Annotation> annotation);
    
    /**
     * Abstraction for resolving an annotation so that
     * it can be overriden from the Method, Constructor, Field, etc.
     *
+    * @param annotation
+    * @return
+    */
+   <T extends Annotation> T resolveTypedAnnotation(Class<T> annotation);
+
+   /**
+    * Abstraction for resolving an annotation so that
+    * it can be overriden from the Method, Constructor, Field, etc.
+    *
     * @param annotations
     * @return
     */
-   Object resolveAnnotation(Class[] annotations);
+   Object resolveAnnotation(Class<? extends Annotation>[] annotations);
 
+   /**
+    * Abstraction for resolving an annotation so that
+    * it can be overriden from the Method, Constructor, Field, etc.
+    *
+    * @param annotations
+    * @return
+    */
+   <T extends Annotation> T resolveTypedAnnotation(Class<T>[] annotations);
+
     /**
     * Invoke on the next interceptor in the chain.  If this is already
     * the end of the chain, reflection will call the constructor, field, or

Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/InvocationBase.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/InvocationBase.java	2008-03-24 03:08:33 UTC (rev 71183)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/InvocationBase.java	2008-03-24 03:41:24 UTC (rev 71184)
@@ -28,6 +28,7 @@
 import org.jboss.aop.metadata.MetaDataResolver;
 import org.jboss.aop.metadata.SimpleMetaData;
 
+import java.lang.annotation.Annotation;
 import java.util.HashMap;
 import java.util.Map;
 
@@ -48,26 +49,26 @@
    protected transient int currentInterceptor = 0;
    protected transient org.jboss.aop.advice.Interceptor[] interceptors = null;
    protected transient Advisor advisor = null;
-   protected transient Map responseContextInfo = null;
+   protected transient Map<Object, Object> responseContextInfo = null;
 
    protected transient Object targetObject = null;
 
    // todo need to refactor this as ClassProxyTemplate still needs this for remoting
    protected transient MetaDataResolver instanceResolver;
    
-   public Map getResponseContextInfo()
+   public Map<Object, Object> getResponseContextInfo()
    {
       return responseContextInfo;
    }
 
-   public void setResponseContextInfo(Map responseContextInfo)
+   public void setResponseContextInfo(Map<Object, Object> responseContextInfo)
    {
       this.responseContextInfo = responseContextInfo;
    }
 
    public void addResponseAttachment(Object key, Object val)
    {
-      if (responseContextInfo == null) responseContextInfo = new HashMap(1);
+      if (responseContextInfo == null) responseContextInfo = new HashMap<Object, Object>(1);
       responseContextInfo.put(key, val);
    }
 
@@ -200,24 +201,39 @@
    }
 
 
-   public Object resolveClassAnnotation(Class annotation)
+   public Object resolveClassAnnotation(Class<? extends Annotation> annotation)
    {
-      if (advisor != null) return advisor.resolveAnnotation(annotation);
-      return null;
+      return resolveTypedClassAnnotation(annotation);
    }
+   
+   public <T extends Annotation> T resolveTypedClassAnnotation(Class<T> annotation)
+   {
+      if (advisor != null) return advisor.resolveTypedAnnotation(annotation);
+      return null;      
+   }
 
-   public Object resolveAnnotation(Class annotation)
+   public Object resolveAnnotation(Class<? extends Annotation> annotation)
    {
       // todo need to add hooks for invocation and thread metadata.
       return null;
    }
    
-   public Object resolveAnnotation(Class[] annotations)
+   public <T extends Annotation> T resolveTypedAnnotation(Class<T> annotation)
    {
+      return null;
+   }
+   
+   public Object resolveAnnotation(Class<? extends Annotation>[] annotations)
+   {
       // todo need to add hooks for invocation and thread metadata.
       return null;
    }
 
+   public <T extends Annotation> T resolveTypedAnnotation(Class<T>[] annotations)
+   {
+      return null;
+   }
+   
    /**
     * This method resolves metadata based on the context of the invocation.
     * It iterates through its list of MetaDataResolvers to find out the

Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/InvocationResponse.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/InvocationResponse.java	2008-03-24 03:08:33 UTC (rev 71183)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/InvocationResponse.java	2008-03-24 03:41:24 UTC (rev 71184)
@@ -23,7 +23,6 @@
  
 import java.io.IOException;
 import java.util.HashMap;
-import java.util.Iterator;
 import java.util.Map;
 
 /**
@@ -43,18 +42,18 @@
 
    private static final long serialVersionUID = 2974596986988236395L;
 
-   public Map getContextInfo()
+   public Map<Object, Object> getContextInfo()
    {
       return contextInfo;
    }
 
-   public void setContextInfo(Map contextInfo)
+   public void setContextInfo(Map<Object, Object> contextInfo)
    {
       this.contextInfo = contextInfo;
    }
 
    // The Map of methods used by this Invocation
-   protected Map contextInfo = null;
+   protected Map<Object, Object> contextInfo = null;
    protected Object response = null;
 
    // Constructors --------------------------------------------------
@@ -84,7 +83,7 @@
 
    public void addAttachment(Object key, Object val)
    {
-      if (contextInfo == null) contextInfo = new HashMap(1);
+      if (contextInfo == null) contextInfo = new HashMap<Object, Object>(1);
       contextInfo.put(key, val);
    }
 
@@ -106,10 +105,8 @@
       else
       {
          out.writeInt(contextInfo.size());
-         Iterator keys = contextInfo.keySet().iterator();
-         while (keys.hasNext())
+         for (Object currentKey : contextInfo.keySet())
          {
-            Object currentKey = keys.next();
             out.writeObject(currentKey);
             out.writeObject(contextInfo.get(currentKey));
          }
@@ -129,7 +126,7 @@
       }
       else
       {
-         contextInfo = new HashMap(size);
+         contextInfo = new HashMap<Object, Object>(size);
          for (int i = 0; i < size; i++)
          {
             Object key = in.readObject();

Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/JoinPointBean.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/JoinPointBean.java	2008-03-24 03:08:33 UTC (rev 71183)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/JoinPointBean.java	2008-03-24 03:41:24 UTC (rev 71184)
@@ -21,6 +21,8 @@
  */
 package org.jboss.aop.joinpoint;
 
+import java.lang.annotation.Annotation;
+
 import org.jboss.aop.Advisor;
 
 /**
@@ -39,7 +41,7 @@
    /**
     * Gets the advisor's class
     */
-   Class getClazz();
+   Class<?> getClazz();
 
    /**
     * Resolves metadata on the class
@@ -49,11 +51,11 @@
    /**
     * Resolves annotations for the class
     */
-   Object resolveClassAnnotation(Class annotation);
+   <T extends Annotation> T resolveClassAnnotation(Class<T> annotation);
 
    /**
     * Resolves annotations on the particular joinpoint (field, constructor, method etc.)
     */
-   Object resolveAnnotation(Class annotation);
+   <T extends Annotation> T resolveAnnotation(Class<T> annotation);
 
 }
\ No newline at end of file

Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/MethodCall.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/MethodCall.java	2008-03-24 03:08:33 UTC (rev 71183)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/MethodCall.java	2008-03-24 03:41:24 UTC (rev 71184)
@@ -34,12 +34,12 @@
    /**
     * Gets the class containing the method/constructor making the call
     */
-   Class getCallingClass();
+   Class<?> getCallingClass();
 
    /**
     * Gets the class containing the method being called 
     */
-   Class getCalledClass();
+   Class<?> getCalledClass();
 
    /**
     * Gets the method being called

Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/MethodCallByConstructor.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/MethodCallByConstructor.java	2008-03-24 03:08:33 UTC (rev 71183)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/MethodCallByConstructor.java	2008-03-24 03:41:24 UTC (rev 71184)
@@ -34,6 +34,6 @@
    /**
     * Gets the constructor making the call
     */
-   Constructor getCallingConstructor();
+   Constructor<?> getCallingConstructor();
 
 }
\ No newline at end of file

Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/MethodCalledByConstructorInvocation.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/MethodCalledByConstructorInvocation.java	2008-03-24 03:08:33 UTC (rev 71183)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/MethodCalledByConstructorInvocation.java	2008-03-24 03:41:24 UTC (rev 71184)
@@ -43,7 +43,7 @@
    private static final long serialVersionUID = -1903092605231217830L;
    
    //info fields
-   protected Constructor calling;
+   protected Constructor<?> calling;
    protected Method method;
    
    public MethodCalledByConstructorInvocation(MethodByConInfo info, Object callingObject, Object target, Object[] args, Interceptor[] interceptors)
@@ -56,7 +56,7 @@
       this(info.getAdvisor(), info.getCallingConstructor(), info.getMethod(), callingObject, target, null, interceptors);
    }
    
-   public MethodCalledByConstructorInvocation(Advisor advisor, Constructor calling, Method method, Object callingObject, Object target, Object[] args, Interceptor[] interceptors)
+   public MethodCalledByConstructorInvocation(Advisor advisor, Constructor<?> calling, Method method, Object callingObject, Object target, Object[] args, Interceptor[] interceptors)
    {
       super(advisor, callingObject, interceptors);
       this.calling = calling;
@@ -162,7 +162,7 @@
     *
     * @return The constructor that is calling the method
     */
-   public Constructor getCalling()
+   public Constructor<?> getCalling()
    {
       return calling;
    }

Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/MethodCalledByConstructorInvocationWrapper.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/MethodCalledByConstructorInvocationWrapper.java	2008-03-24 03:08:33 UTC (rev 71183)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/MethodCalledByConstructorInvocationWrapper.java	2008-03-24 03:41:24 UTC (rev 71184)
@@ -92,7 +92,7 @@
       wrapped.setArguments(arguments);
    }
 
-   public Constructor getCalling()
+   public Constructor<?> getCalling()
    {
       return wrapped.getCalling();
    }
@@ -102,7 +102,7 @@
       return wrapped.getCalledMethod();
    }
 
-   public Map getResponseContextInfo()
+   public Map<Object, Object> getResponseContextInfo()
    {
       return wrapped.getResponseContextInfo();
    }
@@ -112,7 +112,7 @@
       wrapped.addResponseAttachment(key, val);
    }
 
-   public void setResponseContextInfo(Map responseContextInfo)
+   public void setResponseContextInfo(Map<Object, Object> responseContextInfo)
    {
       wrapped.setResponseContextInfo(responseContextInfo);
    }

Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/MethodCalledByConstructorJoinpoint.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/MethodCalledByConstructorJoinpoint.java	2008-03-24 03:08:33 UTC (rev 71183)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/MethodCalledByConstructorJoinpoint.java	2008-03-24 03:41:24 UTC (rev 71184)
@@ -32,11 +32,11 @@
  */
 public class MethodCalledByConstructorJoinpoint implements Joinpoint
 {
-   private final Constructor calling;
+   private final Constructor<?> calling;
    private final Method called;
    int hashCode;
 
-   public MethodCalledByConstructorJoinpoint(Constructor calling, Method called)
+   public MethodCalledByConstructorJoinpoint(Constructor<?> calling, Method called)
    {
       this.calling = calling;
       this.called = called;
@@ -62,7 +62,7 @@
       return hashCode;
    }
 
-   public Constructor getCalling()
+   public Constructor<?> getCalling()
    {
       return calling;
    }

Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/MethodCalledByMethodInvocation.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/MethodCalledByMethodInvocation.java	2008-03-24 03:08:33 UTC (rev 71183)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/MethodCalledByMethodInvocation.java	2008-03-24 03:41:24 UTC (rev 71184)
@@ -42,7 +42,7 @@
    private static final long serialVersionUID = -156920151151728318L;
    
    //info fields
-   Class callingClass;
+   Class<?> callingClass;
    Method callingMethod;
    Method method;
    
@@ -56,7 +56,7 @@
       this(info.getAdvisor(), info.getCallingClass(), info.getCallingMethod(), info.getMethod(), callingObject, targetObject, null, interceptors);
    }
 
-   public MethodCalledByMethodInvocation(Advisor advisor, Class callingClass, 
+   public MethodCalledByMethodInvocation(Advisor advisor, Class<?> callingClass, 
          Method callingMethod, Method method, Object callingObject, Object targetObject, Object[] args, Interceptor[] interceptors)
    {
       super(advisor, callingObject, interceptors);
@@ -163,7 +163,7 @@
    /**
     * @return The class that is making the call on the method
     */
-   public Class getCallingClass()
+   public Class<?> getCallingClass()
    {
       return callingClass;
    }

Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/MethodCalledByMethodInvocationWrapper.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/MethodCalledByMethodInvocationWrapper.java	2008-03-24 03:08:33 UTC (rev 71183)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/MethodCalledByMethodInvocationWrapper.java	2008-03-24 03:41:24 UTC (rev 71184)
@@ -98,7 +98,7 @@
       wrapped.setArguments(arguments);
    }
 
-   public Class getCallingClass()
+   public Class<?> getCallingClass()
    {
       return wrapped.getCallingClass();
    }
@@ -108,12 +108,12 @@
       return wrapped.getCallingMethod();
    }
 
-   public Map getResponseContextInfo()
+   public Map<Object, Object> getResponseContextInfo()
    {
       return wrapped.getResponseContextInfo();
    }
 
-   public void setResponseContextInfo(Map responseContextInfo)
+   public void setResponseContextInfo(Map<Object, Object> responseContextInfo)
    {
       wrapped.setResponseContextInfo(responseContextInfo);
    }

Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/MethodInvocation.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/MethodInvocation.java	2008-03-24 03:08:33 UTC (rev 71183)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/MethodInvocation.java	2008-03-24 03:41:24 UTC (rev 71184)
@@ -24,6 +24,7 @@
 import java.io.IOException;
 import java.io.ObjectInput;
 import java.io.ObjectOutput;
+import java.lang.annotation.Annotation;
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
 import java.rmi.MarshalledObject;
@@ -144,15 +145,15 @@
          if (target == null)
 
             throw new IllegalArgumentException("Null target for method " + method);
-         Class methodClass = method.getClass();
-         Class targetClass = target.getClass();
+         Class<?> methodClass = method.getClass();
+         Class<?> targetClass = target.getClass();
          if (methodClass.isAssignableFrom(targetClass) == false)
             throw new IllegalArgumentException("Wrong target. " + targetClass + " for " + method);
-         ArrayList expected = new ArrayList();
-         Class[] parameterTypes = method.getParameterTypes();
+         ArrayList<String> expected = new ArrayList<String>();
+         Class<?>[] parameterTypes = method.getParameterTypes();
          for (int i = 0; i < parameterTypes.length; ++i)
             expected.add(parameterTypes[i].getName());
-         ArrayList actual = new ArrayList();
+         ArrayList<String> actual = new ArrayList<String>();
          if (arguments != null)
          {
             for (int i = 0; i < arguments.length; ++i)
@@ -175,14 +176,19 @@
    /**
     * This method resolves an annotation based on the context of the invocation.
     */
-   public Object resolveAnnotation(Class annotation)
+   public Object resolveAnnotation(Class<? extends Annotation> annotation)
    {
-      Object val = super.resolveAnnotation(annotation);
+      return resolveTypedAnnotation(annotation);
+   }
+
+   public <T extends Annotation> T resolveTypedAnnotation(Class<T> annotation)
+   {
+      T val = super.resolveTypedAnnotation(annotation);
       if (val != null) return val;
 
       if (getAdvisor() != null)
       {
-         val = getAdvisor().resolveAnnotation(getMethodHash(), getMethod(), annotation);
+         val = getAdvisor().resolveTypedAnnotation(getMethodHash(), getMethod(), annotation);
          if (val != null) return val;
       }
 
@@ -192,7 +198,7 @@
    /**
     * This method resolves an annotation based on the context of the invocation.
     */
-   public Object resolveAnnotation(Class[] annotations)
+   public Object resolveAnnotation(Class<? extends Annotation>[] annotations)
    {
       Object val = super.resolveAnnotation(annotations);
       if (val != null) return val;
@@ -202,10 +208,24 @@
          val = getAdvisor().resolveAnnotation(getMethod(), annotations);
          if (val != null) return val;
       }
+      
+      return null;
+   }
 
+   public <T extends Annotation> T resolveTypedAnnotation(Class<T>[] annotations)
+   {
+      T val = super.resolveTypedAnnotation(annotations);
+      if (val != null) return val;
+
+      if (getAdvisor() != null)
+      {
+         val = getAdvisor().resolveTypedAnnotation(getMethod(), annotations);
+         if (val != null) return val;
+      }
+
       return null;
    }
-
+   
    /**
     * This method resolves metadata based on the context of the invocation.
     * It iterates through its list of MetaDataResolvers to find out the

Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/MethodInvocationWrapper.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/MethodInvocationWrapper.java	2008-03-24 03:08:33 UTC (rev 71183)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/MethodInvocationWrapper.java	2008-03-24 03:41:24 UTC (rev 71184)
@@ -122,12 +122,12 @@
       return wrapped.getAdvisor();
    }
 
-   public Map getResponseContextInfo()
+   public Map<Object, Object> getResponseContextInfo()
    {
       return wrapped.getResponseContextInfo();
    }
 
-   public void setResponseContextInfo(Map responseContextInfo)
+   public void setResponseContextInfo(Map<Object, Object> responseContextInfo)
    {
       wrapped.setResponseContextInfo(responseContextInfo);
    }

Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/metadata/ClassMetaDataBinding.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/metadata/ClassMetaDataBinding.java	2008-03-24 03:08:33 UTC (rev 71183)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/metadata/ClassMetaDataBinding.java	2008-03-24 03:41:24 UTC (rev 71184)
@@ -41,7 +41,7 @@
    protected String expr;
    protected String name;
    protected String tag;
-   protected ArrayList advisors = new ArrayList();
+   protected ArrayList<WeakReference<Advisor>> advisors = new ArrayList<WeakReference<Advisor>>();
    protected ClassMetaDataLoader loader;
 
    public ClassMetaDataBinding(ClassMetaDataLoader loader, String name, String tag, String exp)
@@ -74,14 +74,14 @@
       // we may be having in the future an Advisor per instance.
       synchronized (advisors)
       {
-         Iterator it = advisors.iterator();
+         Iterator<WeakReference<Advisor>> it = advisors.iterator();
          while (it.hasNext())
          {
-            WeakReference ref = (WeakReference) it.next();
-            Object obj = ref.get();
-            if (obj == null) it.remove();
+            WeakReference<Advisor> ref = it.next();
+            Advisor adv = ref.get();
+            if (adv == null) it.remove();
          }
-         advisors.add(new WeakReference(advisor));
+         advisors.add(new WeakReference<Advisor>(advisor));
       }
       advisor.addClassMetaData(this);
    }
@@ -92,8 +92,8 @@
       {
          for (int i = 0; i < advisors.size(); i++)
          {
-            WeakReference ref = (WeakReference) advisors.get(i);
-            Advisor advisor = (Advisor) ref.get();
+            WeakReference<Advisor> ref = advisors.get(i);
+            Advisor advisor = ref.get();
             if (advisor != null)
                advisor.removeClassMetaData(this);
          }
@@ -113,7 +113,7 @@
       return name.hashCode();
    }
 
-   public boolean matches(Advisor advisor, Class clazz)
+   public boolean matches(Advisor advisor, Class<?> clazz)
    {
       return Util.matchesClassExpr(classExpr, clazz, advisor);
    }

Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/metadata/ClassMetaDataLoader.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/metadata/ClassMetaDataLoader.java	2008-03-24 03:08:33 UTC (rev 71183)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/metadata/ClassMetaDataLoader.java	2008-03-24 03:41:24 UTC (rev 71184)
@@ -65,5 +65,5 @@
     * @param constructors
     * @throws Exception
     */
-   public void bind(Advisor advisor, ClassMetaDataBinding data, Method[] methods, Field[] fields, Constructor[] constructors) throws Exception;
+   public void bind(Advisor advisor, ClassMetaDataBinding data, Method[] methods, Field[] fields, Constructor<?>[] constructors) throws Exception;
 }

Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/metadata/ConstructorConfig.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/metadata/ConstructorConfig.java	2008-03-24 03:08:33 UTC (rev 71183)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/metadata/ConstructorConfig.java	2008-03-24 03:41:24 UTC (rev 71184)
@@ -57,7 +57,7 @@
 
    // Public --------------------------------------------------------
 
-   public boolean patternMatches(Constructor constructor)
+   public boolean patternMatches(Constructor<?> constructor)
    {
       // the wildcard matches everything
       if (signature.equals("*"))
@@ -96,11 +96,11 @@
          return;
       }
       signature = "(";
-      Iterator paramsIterator = XmlHelper.getChildrenByTagName(paramsElement,
+      Iterator<Element> paramsIterator = XmlHelper.getChildrenByTagName(paramsElement,
                                                                "constructor-param");
       while (paramsIterator.hasNext())
       {
-         signature += XmlHelper.getElementContent((Element)paramsIterator.next()).trim();
+         signature += XmlHelper.getElementContent(paramsIterator.next()).trim();
          signature += " ";
       }
       signature += ")";

Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/metadata/ConstructorMetaData.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/metadata/ConstructorMetaData.java	2008-03-24 03:08:33 UTC (rev 71183)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/metadata/ConstructorMetaData.java	2008-03-24 03:41:24 UTC (rev 71184)
@@ -36,41 +36,39 @@
  */
 public class ConstructorMetaData implements MetaDataResolver
 {
-   HashMap constructorMetaData = new HashMap();
+   final HashMap<String, SimpleMetaData> constructorMetaData = new HashMap<String, SimpleMetaData>();
 
    public boolean hasTag(String tag)
    {
-      Iterator values = constructorMetaData.values().iterator();
-      while (values.hasNext())
+      for (SimpleMetaData map : constructorMetaData.values())
       {
-         SimpleMetaData map = (SimpleMetaData)values.next();
          if (map.hasTag(tag)) return true;
       }
       return false;
    }
-   public synchronized boolean hasTag(Constructor constructor, String tag)
+   public synchronized boolean hasTag(Constructor<?> constructor, String tag)
    {
       SimpleMetaData meta = getConstructorMetaData(constructor);
       if (meta == null) return false;
       return meta.hasTag(tag);
    }
 
-   public void tagConstructor(Constructor con, Object tag)
+   public void tagConstructor(Constructor<?> con, Object tag)
    {
       addConstructorMetaData(con, tag, EMPTY_TAG, new Object(), PayloadKey.TRANSIENT);
    }
 
-   public void addConstructorMetaData(Constructor constructor, Object tag, Object attr, Object value)
+   public void addConstructorMetaData(Constructor<?> constructor, Object tag, Object attr, Object value)
    {
       addConstructorMetaData(constructor.toString(), tag, attr, value, PayloadKey.MARSHALLED);
    }
-   public void addConstructorMetaData(Constructor constructor, Object tag, Object attr, Object value, PayloadKey type)
+   public void addConstructorMetaData(Constructor<?> constructor, Object tag, Object attr, Object value, PayloadKey type)
    {
       addConstructorMetaData(constructor.toString(), tag, attr, value, type);
    }
    public synchronized void addConstructorMetaData(String key, Object tag, Object attr, Object value, PayloadKey type)
    {
-      SimpleMetaData constructorData = (SimpleMetaData)constructorMetaData.get(key);
+      SimpleMetaData constructorData = constructorMetaData.get(key);
       if (constructorData == null)
       {
          constructorData = new SimpleMetaData();
@@ -79,31 +77,31 @@
       constructorData.addMetaData(tag, attr, value, type);
    }
 
-   public synchronized Iterator getConstructors()
+   public synchronized Iterator<String> getConstructors()
    {
       return constructorMetaData.keySet().iterator();
    }
 
-   public synchronized SimpleMetaData getConstructorMetaData(Constructor constructor)
+   public synchronized SimpleMetaData getConstructorMetaData(Constructor<?> constructor)
    {
-      return (SimpleMetaData)constructorMetaData.get(constructor.toString());
+      return constructorMetaData.get(constructor.toString());
    }
 
    public synchronized SimpleMetaData getConstructorMetaData(String constructor)
    {
-      return (SimpleMetaData)constructorMetaData.get(constructor);
+      return constructorMetaData.get(constructor);
    }
 
-   public synchronized Object getConstructorMetaData(Constructor constructor, Object tag, Object attr)
+   public synchronized Object getConstructorMetaData(Constructor<?> constructor, Object tag, Object attr)
    {
-      SimpleMetaData constructorData = (SimpleMetaData)constructorMetaData.get(constructor.toString());
+      SimpleMetaData constructorData = constructorMetaData.get(constructor.toString());
       if (constructorData == null) return null;
       return constructorData.getMetaData(tag, attr);
    }
 
    public synchronized Object getConstructorMetaData(String constructor, Object tag, Object attr)
    {
-      SimpleMetaData constructorData = (SimpleMetaData)constructorMetaData.get(constructor);
+      SimpleMetaData constructorData = constructorMetaData.get(constructor);
       if (constructorData == null) return null;
       return constructorData.getMetaData(tag, attr);
    }
@@ -115,14 +113,14 @@
 
    public Object resolve(Invocation invocation, Object tag, Object attr)
    {
-      Constructor constructor = ((ConstructorInvocation)invocation).getConstructor();
+      Constructor<?> constructor = ((ConstructorInvocation)invocation).getConstructor();
       return getConstructorMetaData(constructor, tag, attr);
    }
 
    public synchronized SimpleMetaData getAllMetaData(Invocation invocation)
    {
-      Constructor constructor = ((ConstructorInvocation)invocation).getConstructor();
-      return (SimpleMetaData)constructorMetaData.get(constructor);
+      Constructor<?> constructor = ((ConstructorInvocation)invocation).getConstructor();
+      return constructorMetaData.get(constructor);
    }
 
    // temporary interface so that loader/compiler can get annotations
@@ -139,7 +137,7 @@
 
    public synchronized boolean hasGroup(CtConstructor constructor, String tag)
    {
-      SimpleMetaData meta = (SimpleMetaData)constructorMetaData.get(constructor.getSignature());
+      SimpleMetaData meta = constructorMetaData.get(constructor.getSignature());
       if (meta == null) return false;
       return meta.hasTag(tag);
    }

Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/metadata/FieldMetaData.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/metadata/FieldMetaData.java	2008-03-24 03:08:33 UTC (rev 71183)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/metadata/FieldMetaData.java	2008-03-24 03:41:24 UTC (rev 71184)
@@ -35,14 +35,12 @@
  */
 public class FieldMetaData implements MetaDataResolver
 {
-   HashMap fieldMetaData = new HashMap();
+   HashMap<String, SimpleMetaData> fieldMetaData = new HashMap<String, SimpleMetaData>();
 
    public boolean hasTag(String tag)
    {
-      Iterator values = fieldMetaData.values().iterator();
-      while (values.hasNext())
+      for (SimpleMetaData map : fieldMetaData.values())
       {
-         SimpleMetaData map = (SimpleMetaData)values.next();
          if (map.hasTag(tag)) return true;
       }
       return false;
@@ -87,7 +85,7 @@
    public synchronized void addFieldMetaData(String key, Object tag, Object attr, Object value, PayloadKey type)
    {
       String fieldName = key;
-      SimpleMetaData fieldData = (SimpleMetaData)fieldMetaData.get(fieldName);
+      SimpleMetaData fieldData = fieldMetaData.get(fieldName);
       if (fieldData == null)
       {
          fieldData = new SimpleMetaData();
@@ -105,19 +103,19 @@
 
    public synchronized Object getFieldMetaData(String fieldName, Object tag, Object attr)
    {
-      SimpleMetaData fieldData = (SimpleMetaData)fieldMetaData.get(fieldName);
+      SimpleMetaData fieldData = fieldMetaData.get(fieldName);
       if (fieldData == null) return null;
       return fieldData.getMetaData(tag, attr);
    }
 
-   public synchronized Iterator getFields()
+   public synchronized Iterator<String> getFields()
    {
       return fieldMetaData.keySet().iterator();
    }
 
    public synchronized SimpleMetaData getFieldMetaData(String field)
    {
-      return (SimpleMetaData)fieldMetaData.get(field);
+      return fieldMetaData.get(field);
    }
 
    public synchronized void clear()
@@ -134,6 +132,6 @@
    public synchronized SimpleMetaData getAllMetaData(Invocation invocation)
    {
       Field field = ((FieldInvocation)invocation).getField();
-      return (SimpleMetaData)fieldMetaData.get(field);
+      return fieldMetaData.get(field);
    }
 }

Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/metadata/MethodConfig.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/metadata/MethodConfig.java	2008-03-24 03:08:33 UTC (rev 71183)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/metadata/MethodConfig.java	2008-03-24 03:41:24 UTC (rev 71184)
@@ -106,11 +106,11 @@
       Element paramsElement = XmlHelper.getOptionalChild(element, "method-params");
       if (paramsElement != null)
       {
-         Iterator paramsIterator = XmlHelper.getChildrenByTagName(paramsElement,
+         Iterator<Element> paramsIterator = XmlHelper.getChildrenByTagName(paramsElement,
                                                                   "method-param");
          while (paramsIterator.hasNext())
          {
-            signature += XmlHelper.getElementContent((Element)paramsIterator.next());
+            signature += XmlHelper.getElementContent(paramsIterator.next());
             signature += " ";
          }
       }
@@ -127,13 +127,13 @@
       return buf.toString();
    }
 
-   public static String getSignature(Class[] source)
+   public static String getSignature(Class<?>[] source)
    {
       StringBuffer sig = new StringBuffer("(");
       for( int i=0; i < source.length; i++ )
       {
          String brackets = "";
-         Class cls = source[i];
+         Class<?> cls = source[i];
          while(cls.isArray())
          {
             brackets += "[]";

Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/metadata/MethodMetaData.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/metadata/MethodMetaData.java	2008-03-24 03:08:33 UTC (rev 71183)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/metadata/MethodMetaData.java	2008-03-24 03:41:24 UTC (rev 71184)
@@ -39,15 +39,13 @@
  */
 public class MethodMetaData implements MetaDataResolver
 {
-   volatile Map methodMetaData = UnmodifiableEmptyCollections.EMPTY_CONCURRENT_HASHMAP;
-   HashMap inexactMatches;
+   volatile Map<String, SimpleMetaData> methodMetaData = UnmodifiableEmptyCollections.EMPTY_CONCURRENT_HASHMAP;
+   HashMap<String, HashMap<Object, HashMap<Object, Boolean>>> inexactMatches;
 
    public boolean hasTag(String group)
    {
-      Iterator values = methodMetaData.values().iterator();
-      while (values.hasNext())
+      for (SimpleMetaData map : methodMetaData.values())
       {
-         SimpleMetaData map = (SimpleMetaData)values.next();
          if (map.hasTag(group)) return true;
       }
       return false;
@@ -75,7 +73,7 @@
 
    private synchronized void addMethodMetaData(String key, Object tag, Object attr, Object value, PayloadKey type, boolean exactMatch)
    {
-      SimpleMetaData methodData = (SimpleMetaData)methodMetaData.get(key);
+      SimpleMetaData methodData = methodMetaData.get(key);
       if (methodData == null)
       {
          methodData = new SimpleMetaData();
@@ -92,20 +90,20 @@
       {
          if (inexactMatches == null)
          {
-            inexactMatches = new HashMap();
+            inexactMatches = new HashMap<String, HashMap<Object, HashMap<Object, Boolean>>>();
          }
          
-         HashMap tags = (HashMap)inexactMatches.get(key);
+         HashMap<Object, HashMap<Object, Boolean>> tags = inexactMatches.get(key);
          if (tags == null)
          {
-            tags = new HashMap();
+            tags = new HashMap<Object, HashMap<Object, Boolean>>();
             inexactMatches.put(key, tags);
          }
          
-         HashMap attrs = (HashMap)tags.get(tag);
+         HashMap<Object, Boolean> attrs = tags.get(tag);
          if (attrs == null)
          {
-            attrs = new HashMap();
+            attrs = new HashMap<Object, Boolean>();
             tags.put(tag, attrs);
          }
          attrs.put(attr, Boolean.TRUE);
@@ -113,9 +111,9 @@
       else
       {
          if (inexactMatches == null)return;
-         HashMap tags = (HashMap)inexactMatches.get(key);
+         HashMap<Object, HashMap<Object, Boolean>> tags = inexactMatches.get(key);
          if (tags == null) return;
-         HashMap attrs = (HashMap)tags.get(tag);
+         HashMap<Object, Boolean> attrs = tags.get(tag);
          if (attrs == null) return;
          attrs.remove(attr);
       }
@@ -125,9 +123,9 @@
    public synchronized boolean tagWasMatchedInexactly(Method method, Object tag, Object attr)
    {
       if (inexactMatches == null) return false;
-      HashMap tags = (HashMap)inexactMatches.get(method.toString());
+      HashMap<Object, HashMap<Object, Boolean>> tags = inexactMatches.get(method.toString());
       if (tags == null) return false;
-      HashMap attrs = (HashMap)tags.get(tag);
+      HashMap<Object, Boolean> attrs = tags.get(tag);
       if (attrs == null) return false;
       return (attrs.get(attr) != null);
    }
@@ -139,7 +137,7 @@
       return meta.hasTag(tag);
    }
 
-   public Iterator getMethods()
+   public Iterator<String> getMethods()
    {
       return methodMetaData.keySet().iterator();
    }
@@ -151,7 +149,7 @@
     */
    public SimpleMetaData getMethodMetaData(String method)
    {
-      return (SimpleMetaData)methodMetaData.get(method);
+      return methodMetaData.get(method);
    }
 
    public SimpleMetaData getMethodMetaData(Method method)
@@ -161,7 +159,7 @@
 
    public Object getMethodMetaData(Method method, Object tag, Object attr)
    {
-      SimpleMetaData methodData = (SimpleMetaData)methodMetaData.get(method.toString());
+      SimpleMetaData methodData = methodMetaData.get(method.toString());
       if (methodData == null) return null;
       return methodData.getMetaData(tag, attr);
    }
@@ -180,7 +178,7 @@
    public SimpleMetaData getAllMetaData(Invocation invocation)
    {
       MethodInvocation methodInvocation = (MethodInvocation)invocation;
-      return (SimpleMetaData)methodMetaData.get(methodInvocation.getMethod().toString());
+      return methodMetaData.get(methodInvocation.getMethod().toString());
    }
 
    //--- temporary interface until metadata is bound to actual class, this is needed for loader/compiler to
@@ -215,7 +213,7 @@
    {
       if (methodMetaData == UnmodifiableEmptyCollections.EMPTY_CONCURRENT_HASHMAP)
       {
-         methodMetaData = new ConcurrentHashMap();
+         methodMetaData = new ConcurrentHashMap<String, SimpleMetaData>();
       }
    }
 }

Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/metadata/SimpleClassMetaDataBinding.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/metadata/SimpleClassMetaDataBinding.java	2008-03-24 03:08:33 UTC (rev 71183)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/metadata/SimpleClassMetaDataBinding.java	2008-03-24 03:41:24 UTC (rev 71184)
@@ -95,9 +95,9 @@
 
    protected SimpleMetaData defaultMetaData = new SimpleMetaData();
    protected SimpleMetaData classMetaData = new SimpleMetaData();
-   protected ArrayList queuedMethodMetaData = new ArrayList();
-   protected ArrayList queuedFieldMetaData = new ArrayList();
-   protected ArrayList queuedConstructorMetaData = new ArrayList();
+   protected ArrayList<QueuedMethodMetaData> queuedMethodMetaData = new ArrayList<QueuedMethodMetaData>();
+   protected ArrayList<QueuedMetaData> queuedFieldMetaData = new ArrayList<QueuedMetaData>();
+   protected ArrayList<QueuedConstructorMetaData> queuedConstructorMetaData = new ArrayList<QueuedConstructorMetaData>();
 
    public SimpleClassMetaDataBinding(ClassMetaDataLoader loader, String name, String tag, String expr)
    {
@@ -122,7 +122,7 @@
       queuedMethodMetaData.add(new QueuedMethodMetaData(methodExpr, tag, attr, value));
    }
 
-   public ArrayList getQueuedMethodMetaData()
+   public ArrayList<QueuedMethodMetaData> getQueuedMethodMetaData()
    {
       return queuedMethodMetaData;
    }
@@ -135,7 +135,7 @@
       queuedFieldMetaData.add(new QueuedMetaData(fieldExpr, tag, attr, value));
    }
 
-   public ArrayList getQueuedFieldMetaData()
+   public ArrayList<QueuedMetaData> getQueuedFieldMetaData()
    {
       return queuedFieldMetaData;
    }
@@ -148,7 +148,7 @@
       queuedConstructorMetaData.add(new QueuedConstructorMetaData(constructorExpr, tag, attr, value));
    }
 
-   public ArrayList getQueuedConstructorMetaData()
+   public ArrayList<QueuedConstructorMetaData> getQueuedConstructorMetaData()
    {
       return queuedConstructorMetaData;
    }

Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/metadata/SimpleClassMetaDataLoader.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/metadata/SimpleClassMetaDataLoader.java	2008-03-24 03:08:33 UTC (rev 71183)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/metadata/SimpleClassMetaDataLoader.java	2008-03-24 03:41:24 UTC (rev 71184)
@@ -95,10 +95,10 @@
          }
       }
 
-      Iterator it = XmlHelper.getChildrenByTagName(element, "method");
+      Iterator<Element> it = XmlHelper.getChildrenByTagName(element, "method");
       while (it.hasNext())
       {
-         Element method = (Element) it.next();
+         Element method = it.next();
          String methodName = method.getAttribute("name");
          String expr = method.getAttribute("expr");
          if (methodName != null && methodName.equals(""))
@@ -140,7 +140,7 @@
       it = XmlHelper.getChildrenByTagName(element, "field");
       while (it.hasNext())
       {
-         Element field = (Element) it.next();
+         Element field = it.next();
          String fieldName = field.getAttribute("name");
          NodeList children = field.getChildNodes();
          boolean hadTag = false;
@@ -164,7 +164,7 @@
       it = XmlHelper.getChildrenByTagName(element, "constructor");
       while (it.hasNext())
       {
-         Element field = (Element) it.next();
+         Element field = it.next();
          String expr = field.getAttribute("expr");
          NodeList children = field.getChildNodes();
          boolean hadTag = false;
@@ -188,7 +188,7 @@
       return data;
    }
 
-   public void bind(Advisor advisor, ClassMetaDataBinding data, Method[] methods, Field[] fields, Constructor[] constructors) throws Exception
+   public void bind(Advisor advisor, ClassMetaDataBinding data, Method[] methods, Field[] fields, Constructor<?>[] constructors) throws Exception
    {
       SimpleClassMetaDataBinding meta = (SimpleClassMetaDataBinding) data;
       SimpleMetaData defaultData = advisor.getDefaultMetaData();
@@ -225,10 +225,10 @@
       }
       
       boolean exactMatch = data.matches(advisor, advisor.getClazz());
-      ArrayList queuedData = data.getQueuedMethodMetaData();
+      ArrayList<SimpleClassMetaDataBinding.QueuedMethodMetaData> queuedData = data.getQueuedMethodMetaData();
       for (int i = 0; i < queuedData.size(); i++)
       {
-         SimpleClassMetaDataBinding.QueuedMethodMetaData queued = (SimpleClassMetaDataBinding.QueuedMethodMetaData) queuedData.get(i);
+         SimpleClassMetaDataBinding.QueuedMethodMetaData queued = queuedData.get(i);
          for (int j = 0; j < advisedMethods.length; j++)
          {
             if (queued.expr.matches(advisedMethods[j]))
@@ -264,10 +264,10 @@
 
    protected void bindFieldMetaData(SimpleClassMetaDataBinding data, FieldMetaData fieldMetaData, Field[] advisedFields)
    {
-      ArrayList queuedData = data.getQueuedFieldMetaData();
+      ArrayList<SimpleClassMetaDataBinding.QueuedMetaData> queuedData = data.getQueuedFieldMetaData();
       for (int i = 0; i < queuedData.size(); i++)
       {
-         SimpleClassMetaDataBinding.QueuedMetaData queued = (SimpleClassMetaDataBinding.QueuedMetaData) queuedData.get(i);
+         SimpleClassMetaDataBinding.QueuedMetaData queued = queuedData.get(i);
          for (int j = 0; j < advisedFields.length; j++)
          {
             String fieldName = advisedFields[j].getName();
@@ -279,12 +279,12 @@
       }
    }
 
-   protected void bindConstructorMetaData(SimpleClassMetaDataBinding data, ConstructorMetaData conMetaData, Constructor[] advisedCons)
+   protected void bindConstructorMetaData(SimpleClassMetaDataBinding data, ConstructorMetaData conMetaData, Constructor<?>[] advisedCons)
    {
-      ArrayList queuedData = data.getQueuedConstructorMetaData();
+      ArrayList<SimpleClassMetaDataBinding.QueuedConstructorMetaData> queuedData = data.getQueuedConstructorMetaData();
       for (int i = 0; i < queuedData.size(); i++)
       {
-         SimpleClassMetaDataBinding.QueuedConstructorMetaData queued = (SimpleClassMetaDataBinding.QueuedConstructorMetaData) queuedData.get(i);
+         SimpleClassMetaDataBinding.QueuedConstructorMetaData queued = queuedData.get(i);
          ConstructorExpression expression = queued.expr;
          for (int j = 0; j < advisedCons.length; j++)
          {
@@ -324,10 +324,10 @@
 
    protected void bindMethodMetaData(SimpleClassMetaDataBinding data, MethodMetaData methodMetaData, CtMethod[] advisedMethods) throws NotFoundException
    {
-      ArrayList queuedData = data.getQueuedMethodMetaData();
+      ArrayList<SimpleClassMetaDataBinding.QueuedMethodMetaData> queuedData = data.getQueuedMethodMetaData();
       for (int i = 0; i < queuedData.size(); i++)
       {
-         SimpleClassMetaDataBinding.QueuedMethodMetaData queued = (SimpleClassMetaDataBinding.QueuedMethodMetaData) queuedData.get(i);
+         SimpleClassMetaDataBinding.QueuedMethodMetaData queued = queuedData.get(i);
          for (int j = 0; j < advisedMethods.length; j++)
          {
             if (queued.expr.matches(advisedMethods[j]))
@@ -340,10 +340,10 @@
 
    protected void bindFieldMetaData(SimpleClassMetaDataBinding data, FieldMetaData fieldMetaData, CtField[] advisedFields)
    {
-      ArrayList queuedData = data.getQueuedFieldMetaData();
+      ArrayList<SimpleClassMetaDataBinding.QueuedMetaData> queuedData = data.getQueuedFieldMetaData();
       for (int i = 0; i < queuedData.size(); i++)
       {
-         SimpleClassMetaDataBinding.QueuedMetaData queued = (SimpleClassMetaDataBinding.QueuedMetaData) queuedData.get(i);
+         SimpleClassMetaDataBinding.QueuedMetaData queued = queuedData.get(i);
          for (int j = 0; j < advisedFields.length; j++)
          {
             String fieldName = advisedFields[j].getName();
@@ -357,10 +357,10 @@
 
    protected void bindConstructorMetaData(SimpleClassMetaDataBinding data, ConstructorMetaData conMetaData, CtConstructor[] advisedCons) throws NotFoundException
    {
-      ArrayList queuedData = data.getQueuedConstructorMetaData();
+      ArrayList<SimpleClassMetaDataBinding.QueuedConstructorMetaData> queuedData = data.getQueuedConstructorMetaData();
       for (int i = 0; i < queuedData.size(); i++)
       {
-         SimpleClassMetaDataBinding.QueuedConstructorMetaData queued = (SimpleClassMetaDataBinding.QueuedConstructorMetaData) queuedData.get(i);
+         SimpleClassMetaDataBinding.QueuedConstructorMetaData queued = queuedData.get(i);
          ConstructorExpression expression = queued.expr;
          for (int j = 0; j < advisedCons.length; j++)
          {

Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/metadata/SimpleMetaData.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/metadata/SimpleMetaData.java	2008-03-24 03:08:33 UTC (rev 71183)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/metadata/SimpleMetaData.java	2008-03-24 03:41:24 UTC (rev 71184)
@@ -133,11 +133,11 @@
     * @param name tag of the queried metadata
     * @return a map containing all the metadata tagged with {@code name}
     */
-   public synchronized HashMap tag(String name)
+   public synchronized HashMap<Object, MetaDataValue> tag(String name)
    {
-      HashMap map = (HashMap) metaData.get(name);
+      HashMap<Object, MetaDataValue> map = metaData.get(name);
       if (map == null) return null;
-      return (HashMap) map.clone();
+      return (HashMap<Object, MetaDataValue>) map.clone();
    }
 
    /**
@@ -249,7 +249,7 @@
     */
    public synchronized void removeMetaData(Object tag, Object attr)
    {
-      HashMap groupData = (HashMap) metaData.get(tag);
+      HashMap<Object, MetaDataValue> groupData = metaData.get(tag);
       if (groupData != null)
       {
          groupData.remove(attr);
@@ -284,7 +284,7 @@
     */
    public synchronized void mergeIn(SimpleMetaData data)
    {
-      Iterator it = data.metaData.keySet().iterator();
+      Iterator<Object> it = data.metaData.keySet().iterator();
       while (it.hasNext())
       {
          Object tag = it.next();
@@ -316,17 +316,17 @@
       while (it.hasNext())
       {
          Object group = it.next();
-         HashMap map = (HashMap) metaData.get(group);
+         HashMap<Object, MetaDataValue> map = metaData.get(group);
          //System.out.println("******** marshalling group " + group + " size = " + map.size());
          if (map != null && map.size() > 0)
          {
             boolean groupWritten = false;
-            Iterator attrs = map.keySet().iterator();
+            Iterator<Object> attrs = map.keySet().iterator();
             while (attrs.hasNext())
             {
                Object attr = attrs.next();
                //System.out.println("******** marshalling attr: " + group + "." + attr);
-               MetaDataValue value = (MetaDataValue) map.get(attr);
+               MetaDataValue value = map.get(attr);
                if (value.type == PayloadKey.TRANSIENT) continue;
                if (!groupWritten)
                {

Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/metadata/ThreadMetaData.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/metadata/ThreadMetaData.java	2008-03-24 03:08:33 UTC (rev 71183)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/metadata/ThreadMetaData.java	2008-03-24 03:41:24 UTC (rev 71184)
@@ -37,7 +37,7 @@
  */
 public class ThreadMetaData implements MetaDataResolver
 {
-   ThreadLocal metaData = new ThreadLocal();
+   ThreadLocal<SimpleMetaData> metaData = new ThreadLocal<SimpleMetaData>();
 
    public void addMetaData(Object tag, Object attr, Object value)
    {
@@ -46,7 +46,7 @@
 
    public void addMetaData(Object tag, Object attr, Object value, PayloadKey type)
    {
-      SimpleMetaData data = (SimpleMetaData)metaData.get();
+      SimpleMetaData data = metaData.get();
       if (data == null)
       {
          data = new SimpleMetaData();
@@ -57,21 +57,21 @@
 
    public Object getMetaData(Object tag, Object attr)
    {
-      SimpleMetaData data = (SimpleMetaData)metaData.get();
+      SimpleMetaData data = metaData.get();
       if (data == null) return null;
       return data.getMetaData(tag, attr);
    }
 
    public synchronized void removeMetaData(Object tag, Object attr)
    {
-      SimpleMetaData data = (SimpleMetaData)metaData.get();
+      SimpleMetaData data = metaData.get();
       if (data == null) return;
       data.removeMetaData(tag, attr);
    }
 
    public synchronized void removeGroupData(Object tag)
    {
-      SimpleMetaData data = (SimpleMetaData)metaData.get();
+      SimpleMetaData data = metaData.get();
       if (data == null) return;
       data.removeGroupData(tag);
    }
@@ -83,7 +83,7 @@
 
    public SimpleMetaData getAllMetaData(Invocation invocation)
    {
-      return (SimpleMetaData)metaData.get();
+      return metaData.get();
    }
    public void clear()
    {

Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/microcontainer/lifecycle/LifecycleCallbackBinding.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/microcontainer/lifecycle/LifecycleCallbackBinding.java	2008-03-24 03:08:33 UTC (rev 71183)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/microcontainer/lifecycle/LifecycleCallbackBinding.java	2008-03-24 03:41:24 UTC (rev 71184)
@@ -118,7 +118,7 @@
       return name.hashCode();
    }
 
-   public boolean matches(Advisor advisor, Class clazz)
+   public boolean matches(Advisor advisor, Class<?> clazz)
    {
       if (classes != null)
       {

Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/pointcut/AdvisorMatcherStrategy.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/pointcut/AdvisorMatcherStrategy.java	2008-03-24 03:08:33 UTC (rev 71183)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/pointcut/AdvisorMatcherStrategy.java	2008-03-24 03:41:24 UTC (rev 71184)
@@ -39,12 +39,12 @@
    {
    }
 
-   protected boolean checkIntroductions(Class clazz, ClassExpression instanceOf, Advisor advisor)
+   protected boolean checkIntroductions(Class<?> clazz, ClassExpression instanceOf, Advisor advisor)
    {
       return false;
    }
   
-   public Class getDeclaringClass(Advisor advisor, Method m)
+   public Class<?> getDeclaringClass(Advisor advisor, Method m)
    {
       return m.getDeclaringClass();
    }

Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/pointcut/AnnotationMatcher.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/pointcut/AnnotationMatcher.java	2008-03-24 03:08:33 UTC (rev 71183)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/pointcut/AnnotationMatcher.java	2008-03-24 03:41:24 UTC (rev 71184)
@@ -131,12 +131,12 @@
       return null;
    }
 
-   public Class getJavaDeclaringClass()
+   public Class<?> getJavaDeclaringClass()
    {
-      if (element instanceof Class) return (Class) element;
+      if (element instanceof Class) return (Class<?>) element;
       if (element instanceof Method) return ((Method) element).getDeclaringClass();
       if (element instanceof Field) return ((Field) element).getDeclaringClass();
-      if (element instanceof Constructor) return ((Constructor) element).getDeclaringClass();
+      if (element instanceof Constructor) return ((Constructor<?>) element).getDeclaringClass();
       return null;
    }
 
@@ -157,7 +157,7 @@
       }
       else
       {
-         Class clazz = getJavaDeclaringClass();
+         Class<?> clazz = getJavaDeclaringClass();
          if (n instanceof ASTMethod)
          {
             return new Boolean(Util.has(clazz, (ASTMethod) n, advisor));
@@ -180,7 +180,7 @@
       }
       else
       {
-         Class clazz = getJavaDeclaringClass();
+         Class<?> clazz = getJavaDeclaringClass();
          ASTField f = (ASTField) node.jjtGetChild(0);
          return new Boolean(Util.has(clazz, f, advisor));
       }
@@ -196,7 +196,7 @@
       }
       else
       {
-         Class clazz = (Class) element;
+         Class<?> clazz = (Class<?>) element;
          return new Boolean(Util.matchesClassExpr(node.getClazz(), clazz, advisor));
       }
 
@@ -238,7 +238,7 @@
       else
       {
          ConstructorMatcher conMatcher = null;
-         conMatcher = new ConstructorMatcher(advisor, (Constructor) element, null);
+         conMatcher = new ConstructorMatcher(advisor, (Constructor<?>) element, null);
          return conMatcher.matches(node);
       }
 

Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/pointcut/CFlow.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/pointcut/CFlow.java	2008-03-24 03:08:33 UTC (rev 71183)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/pointcut/CFlow.java	2008-03-24 03:41:24 UTC (rev 71184)
@@ -122,7 +122,7 @@
       else
       {
          // FIXME ClassLoader - why should the class be visible from the context classloader?
-         Class clazz = loadClass(element.getClassName());
+         Class<?> clazz = loadClass(element.getClassName());
          
          if (Untransformable.class.isAssignableFrom(clazz))
          {
@@ -138,7 +138,7 @@
       return true;
    }
    
-   private Class loadClass(String name)
+   private Class<?> loadClass(String name)
    {
       return SecurityActions.loadClass(name);
    }

Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/pointcut/CFlowStack.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/pointcut/CFlowStack.java	2008-03-24 03:08:33 UTC (rev 71183)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/pointcut/CFlowStack.java	2008-03-24 03:41:24 UTC (rev 71184)
@@ -33,7 +33,7 @@
 public class CFlowStack
 {
    private String name;
-   private ArrayList cflows = new ArrayList();
+   private ArrayList<CFlow> cflows = new ArrayList<CFlow>();
 
    public CFlowStack(String name)
    {
@@ -45,7 +45,7 @@
       return name;
    }
 
-   public void addCFlow(org.jboss.aop.pointcut.CFlow cflow)
+   public void addCFlow(CFlow cflow)
    {
       cflows.add(cflow);
    }
@@ -55,7 +55,7 @@
       int stackIndex = stack.length - 1;
       for (int i = 0; i < cflows.size(); i++)
       {
-         org.jboss.aop.pointcut.CFlow cflow = (org.jboss.aop.pointcut.CFlow)cflows.get(i);
+         CFlow cflow = cflows.get(i);
          stackIndex = cflow.matches(stack, stackIndex);
          if (stackIndex == org.jboss.aop.pointcut.CFlow.NOT_FOUND)
          {

Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/pointcut/CallMatcher.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/pointcut/CallMatcher.java	2008-03-24 03:08:33 UTC (rev 71183)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/pointcut/CallMatcher.java	2008-03-24 03:41:24 UTC (rev 71184)
@@ -47,10 +47,10 @@
 {
    Advisor advisor;
    AccessibleObject within;
-   Class calledClass;
+   Class<?> calledClass;
    Method calledMethod;
 
-   public CallMatcher(Advisor advisor, AccessibleObject within, Class calledClass, Method calledMethod, ASTStart start)
+   public CallMatcher(Advisor advisor, AccessibleObject within, Class<?> calledClass, Method calledMethod, ASTStart start)
    {
       super(start, advisor.getManager());
       this.advisor = advisor;

Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/pointcut/ConstructionMatcher.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/pointcut/ConstructionMatcher.java	2008-03-24 03:08:33 UTC (rev 71183)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/pointcut/ConstructionMatcher.java	2008-03-24 03:41:24 UTC (rev 71184)
@@ -47,7 +47,7 @@
       super(advisor, con, start);
    }
 
-   public ConstructionMatcher(Advisor advisor, Constructor con, ASTStart start)
+   public ConstructionMatcher(Advisor advisor, Constructor<?> con, ASTStart start)
    {
       super(advisor, con, start);
    }

Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/pointcut/ConstructorCallMatcher.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/pointcut/ConstructorCallMatcher.java	2008-03-24 03:08:33 UTC (rev 71183)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/pointcut/ConstructorCallMatcher.java	2008-03-24 03:41:24 UTC (rev 71184)
@@ -47,10 +47,10 @@
 {
    Advisor advisor;
    AccessibleObject within;
-   Class calledClass;
-   Constructor calledConstructor;
+   Class<?> calledClass;
+   Constructor<?> calledConstructor;
 
-   public ConstructorCallMatcher(Advisor advisor, AccessibleObject within, Class calledClass, Constructor calledCon, ASTStart start)
+   public ConstructorCallMatcher(Advisor advisor, AccessibleObject within, Class<?> calledClass, Constructor<?> calledCon, ASTStart start)
    {
       super(start, advisor.getManager());
       this.advisor = advisor;

Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/pointcut/ConstructorMatcher.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/pointcut/ConstructorMatcher.java	2008-03-24 03:08:33 UTC (rev 71183)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/pointcut/ConstructorMatcher.java	2008-03-24 03:41:24 UTC (rev 71184)
@@ -27,6 +27,7 @@
 import org.jboss.aop.pointcut.ast.ASTAll;
 import org.jboss.aop.pointcut.ast.ASTAttribute;
 import org.jboss.aop.pointcut.ast.ASTConstructor;
+import org.jboss.aop.pointcut.ast.ASTException;
 import org.jboss.aop.pointcut.ast.ASTStart;
 
 import javassist.CtConstructor;
@@ -42,7 +43,7 @@
 {
    protected Advisor advisor;
    protected CtConstructor ctCon;
-   protected Constructor refCon;
+   protected Constructor<?> refCon;
    protected int conModifiers;
    protected String classname;
 
@@ -56,7 +57,7 @@
       this.ctCon = con;
    }
 
-   public ConstructorMatcher(Advisor advisor, Constructor con, ASTStart start)
+   public ConstructorMatcher(Advisor advisor, Constructor<?> con, ASTStart start)
    {
       super(start, advisor.getManager());
       this.advisor = advisor;
@@ -126,7 +127,7 @@
       }
       
       //Match exceptions
-      ArrayList nodeExceptions = node.getExceptions();
+      ArrayList<ASTException> nodeExceptions = node.getExceptions();
       if (nodeExceptions.size() > 0)
       {
          if (ctCon != null)

Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/pointcut/DeclareDef.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/pointcut/DeclareDef.java	2008-03-24 03:08:33 UTC (rev 71183)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/pointcut/DeclareDef.java	2008-03-24 03:41:24 UTC (rev 71184)
@@ -120,7 +120,7 @@
       return ((Boolean) ast.jjtAccept(matcher, null)).booleanValue();
    }
 
-   public boolean matches(Advisor advisor, Class clazz)
+   public boolean matches(Advisor advisor, Class<?> clazz)
    {
       if (pointcut)return false;
       DeclareTypeMatcher matcher = new DeclareTypeMatcher(advisor, clazz);

Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/pointcut/DeclareTypeMatcher.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/pointcut/DeclareTypeMatcher.java	2008-03-24 03:08:33 UTC (rev 71183)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/pointcut/DeclareTypeMatcher.java	2008-03-24 03:41:24 UTC (rev 71184)
@@ -41,7 +41,7 @@
  */
 public class DeclareTypeMatcher extends TypeMatcher
 {
-   public DeclareTypeMatcher(Advisor advisor, Class clazz)
+   public DeclareTypeMatcher(Advisor advisor, Class<?> clazz)
    {
       super(advisor, clazz);
    }

Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/pointcut/ExecutionConstructorMatcher.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/pointcut/ExecutionConstructorMatcher.java	2008-03-24 03:08:33 UTC (rev 71183)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/pointcut/ExecutionConstructorMatcher.java	2008-03-24 03:41:24 UTC (rev 71184)
@@ -48,7 +48,7 @@
       super(advisor, con, start);
    }
 
-   public ExecutionConstructorMatcher(Advisor advisor, Constructor con, ASTStart start)
+   public ExecutionConstructorMatcher(Advisor advisor, Constructor<?> con, ASTStart start)
    {
       super(advisor, con, start);
    }

Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/pointcut/MatcherStrategy.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/pointcut/MatcherStrategy.java	2008-03-24 03:08:33 UTC (rev 71183)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/pointcut/MatcherStrategy.java	2008-03-24 03:41:24 UTC (rev 71184)
@@ -21,6 +21,7 @@
 */ 
 package org.jboss.aop.pointcut;
 
+import java.lang.annotation.Annotation;
 import java.lang.reflect.Method;
 
 import org.jboss.aop.Advisor;
@@ -54,7 +55,7 @@
       return ADVISOR_MATCHER_STRATEGY;
    }
 
-   public boolean subtypeOf(Class clazz, ClassExpression instanceOf, Advisor advisor)
+   public boolean subtypeOf(Class<?> clazz, ClassExpression instanceOf, Advisor advisor)
    {
       
       if (clazz == null) return false;
@@ -64,10 +65,13 @@
          try
          {
             // FIXME ClassLoader - why should the class be visible from the context classloader? 
-            Class annotation = SecurityActions.getContextClassLoader().loadClass(sub);
-            if (AnnotationElement.getAnyAnnotation(clazz, annotation) != null)
+            Class<?> annotation = SecurityActions.getContextClassLoader().loadClass(sub);
+            if (Annotation.class.isAssignableFrom(annotation))
             {
-               return true;
+               if (AnnotationElement.getAnyAnnotation(clazz, (Class<? extends Annotation>)annotation) != null)
+               {
+                  return true;
+               }
             }
          }
          catch (ClassNotFoundException e)
@@ -84,7 +88,7 @@
          return true;
       }
 
-      Class[] interfaces = clazz.getInterfaces();
+      Class<?>[] interfaces = clazz.getInterfaces();
       for (int i = 0; i < interfaces.length; i++)
       {
          if (subtypeOf(interfaces[i], instanceOf, advisor)) return true;
@@ -99,7 +103,7 @@
       return subtypeOf(clazz.getSuperclass(), instanceOf, advisor);
    }
 
-   protected abstract boolean checkIntroductions(Class clazz, ClassExpression instanceOf, Advisor advisor);
+   protected abstract boolean checkIntroductions(Class<?> clazz, ClassExpression instanceOf, Advisor advisor);
    
-   public abstract Class getDeclaringClass(Advisor advisor, Method m);
+   public abstract Class<?> getDeclaringClass(Advisor advisor, Method m);
 }

Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/pointcut/MethodMatcher.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/pointcut/MethodMatcher.java	2008-03-24 03:08:33 UTC (rev 71183)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/pointcut/MethodMatcher.java	2008-03-24 03:41:24 UTC (rev 71184)
@@ -30,6 +30,7 @@
 import org.jboss.aop.Advisor;
 import org.jboss.aop.pointcut.ast.ASTAll;
 import org.jboss.aop.pointcut.ast.ASTAttribute;
+import org.jboss.aop.pointcut.ast.ASTException;
 import org.jboss.aop.pointcut.ast.ASTMethod;
 import org.jboss.aop.pointcut.ast.ASTStart;
 import org.jboss.aop.pointcut.ast.ClassExpression;
@@ -49,7 +50,7 @@
    protected int methodModifiers;
    protected String classname;
    protected String methodName;
-   protected Class matchedClass;
+   protected Class<?> matchedClass;
    protected int matchLevel;//0 if matches the exact class, 1 if the direct superclass etc.
    protected boolean isInstanceof;
 
@@ -75,7 +76,7 @@
       this.methodName = refMethod.getName();
    }
 
-   public Class getMatchedClass()
+   public Class<?> getMatchedClass()
    {
       return matchedClass;
    }
@@ -126,14 +127,14 @@
       }
       else
       {
-         Class declaringClass = MatcherStrategy.getMatcher(advisor).getDeclaringClass(advisor, refMethod);
+         Class<?> declaringClass = MatcherStrategy.getMatcher(advisor).getDeclaringClass(advisor, refMethod);
          if (!advisor.chainOverridingForInheritedMethods())
          {
             matches = classMatchesAll(expr);
          }
          else
          {
-            Class advisedClass = advisor.getClazz();
+            Class<?> advisedClass = advisor.getClazz();
             matchedClass = advisedClass;
             while (matchedClass != null)
             {
@@ -231,7 +232,7 @@
       }
       else
       {
-         Class declaringClass = MatcherStrategy.getMatcher(advisor).getDeclaringClass(advisor, refMethod);
+         Class<?> declaringClass = MatcherStrategy.getMatcher(advisor).getDeclaringClass(advisor, refMethod);
          if (!advisor.chainOverridingForInheritedMethods())
          {
             if (Util.matchesClassExpr(node.getClazz(), declaringClass, advisor))
@@ -243,7 +244,7 @@
          }
          else
          {
-            Class advisedClass = advisor.getClazz();
+            Class<?> advisedClass = advisor.getClazz();
             if (advisor.getClazz() == null)
             {
                throw new RuntimeException("Advisor is null");
@@ -337,7 +338,7 @@
    protected boolean matchesExceptions(ASTMethod node)
    {
       //Match exceptions
-      ArrayList nodeExceptions = node.getExceptions();
+      ArrayList<ASTException> nodeExceptions = node.getExceptions();
       if (nodeExceptions.size() > 0)
       {
          if (ctMethod != null)

Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/pointcut/Pointcut.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/pointcut/Pointcut.java	2008-03-24 03:08:33 UTC (rev 71183)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/pointcut/Pointcut.java	2008-03-24 03:41:24 UTC (rev 71184)
@@ -54,12 +54,12 @@
    boolean matchesCall(Advisor callingAdvisor, NewExpr methodCall) throws NotFoundException;
 
    PointcutMethodMatch matchesExecution(Advisor advisor, Method m);
-   boolean matchesExecution(Advisor advisor, Constructor c);
-   boolean matchesConstruction(Advisor advisor, Constructor c);
+   boolean matchesExecution(Advisor advisor, Constructor<?> c);
+   boolean matchesConstruction(Advisor advisor, Constructor<?> c);
    boolean matchesGet(Advisor advisor, Field f);
    boolean matchesSet(Advisor advisor, Field f);
-   boolean matchesCall(Advisor advisor, AccessibleObject within, Class calledClass, Method calledMethod);
-   boolean matchesCall(Advisor advisor, AccessibleObject within, Class calledClass, Constructor calledCon);
+   boolean matchesCall(Advisor advisor, AccessibleObject within, Class<?> calledClass, Method calledMethod);
+   boolean matchesCall(Advisor advisor, AccessibleObject within, Class<?> calledClass, Constructor<?> calledCon);
 
    String getExpr();
 

Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/pointcut/PointcutExpression.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/pointcut/PointcutExpression.java	2008-03-24 03:08:33 UTC (rev 71183)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/pointcut/PointcutExpression.java	2008-03-24 03:41:24 UTC (rev 71184)
@@ -130,7 +130,7 @@
       return null;
    }
 
-   public boolean matchesExecution(Advisor advisor, Constructor c)
+   public boolean matchesExecution(Advisor advisor, Constructor<?> c)
    {
       if (stats == null || stats.isExecution())
       {
@@ -140,7 +140,7 @@
       return false;
    }
 
-   public boolean matchesConstruction(Advisor advisor, Constructor c)
+   public boolean matchesConstruction(Advisor advisor, Constructor<?> c)
    {
       if (stats == null || stats.isConstruction())
       {
@@ -228,7 +228,7 @@
       return false;
    }
 
-   public boolean matchesCall(Advisor advisor, AccessibleObject within, Class calledClass, Method calledMethod)
+   public boolean matchesCall(Advisor advisor, AccessibleObject within, Class<?> calledClass, Method calledMethod)
    {
       if (stats == null || stats.isWithin() || stats.isWithincode() || stats.isCall())
       {
@@ -239,7 +239,7 @@
    }
 
 
-   public boolean matchesCall(Advisor advisor, AccessibleObject within, Class calledClass, Constructor calledCon)
+   public boolean matchesCall(Advisor advisor, AccessibleObject within, Class<?> calledClass, Constructor<?> calledCon)
    {
       if (stats == null || stats.isWithin() || stats.isWithincode() || stats.isCall())
       {

Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/pointcut/PointcutMethodMatch.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/pointcut/PointcutMethodMatch.java	2008-03-24 03:08:33 UTC (rev 71183)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/pointcut/PointcutMethodMatch.java	2008-03-24 03:41:24 UTC (rev 71184)
@@ -30,10 +30,10 @@
 {
    private boolean matches;
    private int matchLevel;
-   private Class matchedClass;
+   private Class<?> matchedClass;
    private boolean isInstanceOf;
 
-   public PointcutMethodMatch(boolean matches, Class matchedClass, int matchLevel, boolean isInstanceOf)
+   public PointcutMethodMatch(boolean matches, Class<?> matchedClass, int matchLevel, boolean isInstanceOf)
    {
       this.matches = matches;
       this.matchLevel = matchLevel;
@@ -41,7 +41,7 @@
       this.isInstanceOf = isInstanceOf;
    }
 
-   public Class getMatchedClass()
+   public Class<?> getMatchedClass()
    {
       return matchedClass;
    }

Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/pointcut/ProxyMatcherStrategy.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/pointcut/ProxyMatcherStrategy.java	2008-03-24 03:08:33 UTC (rev 71183)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/pointcut/ProxyMatcherStrategy.java	2008-03-24 03:41:24 UTC (rev 71184)
@@ -23,7 +23,6 @@
 
 import java.lang.reflect.Method;
 import java.util.ArrayList;
-import java.util.Iterator;
 
 import org.jboss.aop.Advisor;
 import org.jboss.aop.introduction.InterfaceIntroduction;
@@ -45,7 +44,7 @@
    {
    }
    
-   protected boolean checkIntroductions(Class clazz, ClassExpression instanceOf, Advisor advisor)
+   protected boolean checkIntroductions(Class<?> clazz, ClassExpression instanceOf, Advisor advisor)
    {
       try
       {
@@ -53,33 +52,31 @@
          {
             // FIXME ClassLoader - why should the class be visible from the context classloader?
             ClassLoader cl = SecurityActions.getContextClassLoader();
-            ArrayList intros = advisor.getInterfaceIntroductions();
+            ArrayList<InterfaceIntroduction> intros = advisor.getInterfaceIntroductions();
             if (intros.size() > 0)
             {
-               for (Iterator itIntro = intros.iterator() ; itIntro.hasNext() ; )
+               for (InterfaceIntroduction intro :intros)
                {
-                  InterfaceIntroduction intro = (InterfaceIntroduction)itIntro.next();
                   String[] introductions = intro.getInterfaces();
                   if (introductions != null)
                   {
                      for (int i = 0 ; i < introductions.length ; i++)
                      {
-                        Class iface = cl.loadClass(introductions[i]);
+                        Class<?> iface = cl.loadClass(introductions[i]);
                         if (subtypeOf(iface, instanceOf, advisor)) return true;
                      }
                   }
-                  ArrayList mixins = intro.getMixins();
+                  ArrayList<InterfaceIntroduction.Mixin> mixins = intro.getMixins();
                   if (mixins.size() > 0)
                   {
-                     for (Iterator itMixin = mixins.iterator() ; itMixin.hasNext() ; )
+                     for (InterfaceIntroduction.Mixin mixin : mixins)
                      {
-                        InterfaceIntroduction.Mixin mixin = (InterfaceIntroduction.Mixin)itMixin.next();
                         String[] mixinInterfaces = mixin.getInterfaces();
                         if (mixinInterfaces != null)
                         {
                            for (int i = 0 ; i < mixinInterfaces.length ; i++)
                            {
-                              Class iface = cl.loadClass(mixinInterfaces[i]);
+                              Class<?> iface = cl.loadClass(mixinInterfaces[i]);
                               if (subtypeOf(iface, instanceOf, advisor)) return true;                              
                            }
                         }
@@ -101,10 +98,10 @@
     * Interface Introduced methods on the proxy will have the wrong declaring class for the matcher,
     * use the advisor class if it is an interface
     */
-   public Class getDeclaringClass(Advisor advisor, Method m)
+   public Class<?> getDeclaringClass(Advisor advisor, Method m)
    {
-      final Class methodClass = m.getDeclaringClass();
-      final Class advisorClass = advisor.getClazz();
+      final Class<?> methodClass = m.getDeclaringClass();
+      final Class<?> advisorClass = advisor.getClazz();
       
       if (advisorClass != null && methodClass.isInterface())
       {

Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/pointcut/SecurityActions.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/pointcut/SecurityActions.java	2008-03-24 03:08:33 UTC (rev 71183)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/pointcut/SecurityActions.java	2008-03-24 03:41:24 UTC (rev 71184)
@@ -21,7 +21,6 @@
 */ 
 package org.jboss.aop.pointcut;
 
-import java.lang.reflect.AccessibleObject;
 import java.security.AccessController;
 import java.security.PrivilegedAction;
 import java.security.PrivilegedActionException;
@@ -34,7 +33,7 @@
  */
 class SecurityActions
 {
-   static Class loadClass(String name)
+   static Class<?> loadClass(String name)
    {
       if (System.getSecurityManager() == null)
       {
@@ -48,17 +47,17 @@
 
    interface LoadClassAction
    {
-      Class loadClass(String name);
+      Class<?> loadClass(String name);
       
       LoadClassAction PRIVILEGED = new LoadClassAction()
       {
-         public Class loadClass(final String name)
+         public Class<?> loadClass(final String name)
          {
             try
             {
-               return AccessController.doPrivileged(new PrivilegedExceptionAction<Class>()
+               return AccessController.doPrivileged(new PrivilegedExceptionAction<Class<?>>()
                {
-                  public Class run() throws Exception
+                  public Class<?> run() throws Exception
                   {
                      return Thread.currentThread().getContextClassLoader().loadClass(name);
                   }
@@ -73,7 +72,7 @@
 
       LoadClassAction NON_PRIVILEGED = new LoadClassAction()
       {
-         public Class loadClass(String name)
+         public Class<?> loadClass(String name)
          {
             try
             {

Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/pointcut/SoftClassMatcher.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/pointcut/SoftClassMatcher.java	2008-03-24 03:08:33 UTC (rev 71183)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/pointcut/SoftClassMatcher.java	2008-03-24 03:41:24 UTC (rev 71184)
@@ -63,7 +63,7 @@
    protected Advisor advisor;
    protected String classname;
    protected boolean match = false;
-   protected Class clazz;
+   protected Class<?> clazz;
 
    public SoftClassMatcher(Advisor advisor, String classname, ASTStart start)
    {

Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/pointcut/TypeMatcher.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/pointcut/TypeMatcher.java	2008-03-24 03:08:33 UTC (rev 71183)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/pointcut/TypeMatcher.java	2008-03-24 03:41:24 UTC (rev 71184)
@@ -54,9 +54,9 @@
 {
    protected Advisor advisor;
    protected CtClass ctClass;
-   protected Class clazz;
+   protected Class<?> clazz;
 
-   public TypeMatcher(Advisor advisor, Class clazz)
+   public TypeMatcher(Advisor advisor, Class<?> clazz)
    {
       this.advisor = advisor;
       this.clazz = clazz;

Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/pointcut/Typedef.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/pointcut/Typedef.java	2008-03-24 03:08:33 UTC (rev 71183)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/pointcut/Typedef.java	2008-03-24 03:41:24 UTC (rev 71184)
@@ -32,5 +32,5 @@
    public abstract String getName();
    public abstract String getExpr();
 	public boolean matches(Advisor advisor, CtClass clazz);
-   public boolean matches(Advisor advisor, Class clazz);
+   public boolean matches(Advisor advisor, Class<?> clazz);
 }
\ No newline at end of file

Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/pointcut/TypedefExpression.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/pointcut/TypedefExpression.java	2008-03-24 03:08:33 UTC (rev 71183)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/pointcut/TypedefExpression.java	2008-03-24 03:41:24 UTC (rev 71184)
@@ -67,7 +67,7 @@
       return ((Boolean) ast.jjtAccept(matcher, null)).booleanValue();
    }
 
-   public boolean matches(Advisor advisor, Class clazz)
+   public boolean matches(Advisor advisor, Class<?> clazz)
    {
       TypeMatcher matcher = new TypeMatcher(advisor, clazz);
       return ((Boolean) ast.jjtAccept(matcher, null)).booleanValue();

Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/pointcut/Util.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/pointcut/Util.java	2008-03-24 03:08:33 UTC (rev 71183)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/pointcut/Util.java	2008-03-24 03:41:24 UTC (rev 71184)
@@ -100,12 +100,12 @@
 
    }
 
-   public static boolean matchesClassExpr(ClassExpression classExpr, Class clazz)
+   public static boolean matchesClassExpr(ClassExpression classExpr, Class<?> clazz)
    {
       return matchesClassExpr(classExpr, clazz, null);
    }
    
-   public static boolean matchesClassExpr(ClassExpression classExpr, Class clazz, Advisor advisor)
+   public static boolean matchesClassExpr(ClassExpression classExpr, Class<?> clazz, Advisor advisor)
    {
       try
       {
@@ -157,7 +157,7 @@
       return exists;
    }
    
-   private static boolean methodExistsInSuperClassOrInterface(long hash, ClassExpression expr, Class clazz, boolean exactSuper) throws Exception
+   private static boolean methodExistsInSuperClassOrInterface(long hash, ClassExpression expr, Class<?> clazz, boolean exactSuper) throws Exception
    {
       if (clazz == null) return false;
       
@@ -174,7 +174,7 @@
           if (classHasMethod(clazz, hash, exactSuper)) return true;
        }
 
-       Class[] interfaces = clazz.getInterfaces();
+       Class<?>[] interfaces = clazz.getInterfaces();
        for (int i = 0; i < interfaces.length; i++)
        {
           if (methodExistsInSuperClassOrInterface(hash, expr, interfaces[i], exactSuper)) return true;
@@ -193,15 +193,14 @@
    {
       if (advisor != null)
       {
-         ArrayList intros = advisor.getInterfaceIntroductions();
+         ArrayList<InterfaceIntroduction> intros = advisor.getInterfaceIntroductions();
          if (intros.size() > 0)
          {
             ClassLoader tcl = Thread.currentThread().getContextClassLoader();
             ClassPool pool = advisor.getManager().findClassPool(tcl);
-            HashSet doneClasses = new HashSet();
-            for (Iterator it = intros.iterator() ; it.hasNext() ; )
+            HashSet<String> doneClasses = new HashSet<String>();
+            for (InterfaceIntroduction intro : intros)
             {
-               InterfaceIntroduction intro = (InterfaceIntroduction)it.next();
                String[] ifs = intro.getInterfaces();
                for (int i = 0 ; ifs != null && i < ifs.length ; i++)
                {
@@ -212,12 +211,11 @@
                   }
                }
                
-               ArrayList mixins = intro.getMixins();
+               ArrayList<InterfaceIntroduction.Mixin> mixins = intro.getMixins();
                if (mixins != null && mixins.size() > 0)
                {
-                  for (Iterator mit = mixins.iterator() ; mit.hasNext() ; )
+                  for (InterfaceIntroduction.Mixin mixin : mixins)
                   {
-                     InterfaceIntroduction.Mixin mixin = (InterfaceIntroduction.Mixin)mit.next();
                      String[] mifs = mixin.getInterfaces();
                      for (int i = 0 ; mifs != null && i < mifs.length ; i++)
                      {
@@ -235,7 +233,7 @@
       return false;
    }
    
-   private static boolean classHasMethod(Class clazz, long hash, boolean exactSuper)throws Exception
+   private static boolean classHasMethod(Class<?> clazz, long hash, boolean exactSuper)throws Exception
    {
       Method m = MethodHashing.findMethodByHash(clazz, hash);
       if (m != null)
@@ -267,7 +265,6 @@
    private static boolean methodExistsInSuperClassOrInterface(ClassPool pool, long hash, ClassExpression expr, String className, boolean exactSuper) throws Exception
    {
       CtClass clazz = pool.get(className);
-      HashMap map = JavassistMethodHashing.getMethodMap(clazz);
       return methodExistsInSuperClassOrInterface(hash, expr, clazz, exactSuper);
    }
    
@@ -300,8 +297,8 @@
    
    private static boolean classHasMethod(CtClass clazz, long hash, boolean exactSuper)throws Exception
    {
-      HashMap methods = JavassistMethodHashing.getMethodMap(clazz);
-      CtMethod m = (CtMethod)methods.get(new Long(hash));
+      HashMap<Long, CtMethod> methods = JavassistMethodHashing.getMethodMap(clazz);
+      CtMethod m = methods.get(new Long(hash));
       if (m != null)
       {
          if (exactSuper)
@@ -369,33 +366,31 @@
          {
             // FIXME ClassLoader - why should the class be visible from the context classloader?
             ClassLoader cl = SecurityActions.getContextClassLoader();
-            ArrayList intros = advisor.getInterfaceIntroductions();
+            ArrayList<InterfaceIntroduction> intros = advisor.getInterfaceIntroductions();
             if (intros.size() > 0)
             {
-               for (Iterator itIntro = intros.iterator() ; itIntro.hasNext() ; )
+               for (InterfaceIntroduction intro : intros)
                {
-                  InterfaceIntroduction intro = (InterfaceIntroduction)itIntro.next();
                   String[] introductions = intro.getInterfaces();
                   if (introductions != null)
                   {
                      for (int i = 0 ; i < introductions.length ; i++)
                      {
-                        Class iface = cl.loadClass(introductions[i]);
+                        Class<?> iface = cl.loadClass(introductions[i]);
                         if (subtypeOf(iface, instanceOf, advisor)) return true;
                      }
                   }
-                  ArrayList mixins = intro.getMixins();
+                  ArrayList<InterfaceIntroduction.Mixin> mixins = intro.getMixins();
                   if (mixins.size() > 0)
                   {
-                     for (Iterator itMixin = mixins.iterator() ; itMixin.hasNext() ; )
+                     for (InterfaceIntroduction.Mixin mixin : mixins)
                      {
-                        InterfaceIntroduction.Mixin mixin = (InterfaceIntroduction.Mixin)itMixin.next();
                         String[] mixinInterfaces = mixin.getInterfaces();
                         if (mixinInterfaces != null)
                         {
                            for (int i = 0 ; i < mixinInterfaces.length ; i++)
                            {
-                              Class iface = cl.loadClass(mixinInterfaces[i]);
+                              Class<?> iface = cl.loadClass(mixinInterfaces[i]);
                               if (subtypeOf(iface, instanceOf, advisor)) return true;                              
                            }
                         }
@@ -413,7 +408,7 @@
       return false;
    }
    
-   public static boolean subtypeOf(Class clazz, ClassExpression instanceOf, Advisor advisor)
+   public static boolean subtypeOf(Class<?> clazz, ClassExpression instanceOf, Advisor advisor)
    {
       return MatcherStrategy.getMatcher(advisor).subtypeOf(clazz, instanceOf, advisor);
    }
@@ -494,12 +489,12 @@
       return false;
    }
 
-   public static boolean has(Class target, ASTMethod method, Advisor advisor)
+   public static boolean has(Class<?> target, ASTMethod method, Advisor advisor)
    {
       return has(target, method, advisor, true);
    }
    
-   public static boolean has(Class target, ASTMethod method, Advisor advisor, boolean checkSuper)
+   public static boolean has(Class<?> target, ASTMethod method, Advisor advisor, boolean checkSuper)
    {
       Method[] methods = advisor.getAllMethods();
       if (methods == null)
@@ -512,18 +507,18 @@
       
       if (checkSuper)
       {
-         Class superClass = target.getSuperclass();
+         Class<?> superClass = target.getSuperclass();
          if (superClass != null) return has(superClass, method, advisor, checkSuper);
       }
       return false;
    }
 
-   public static boolean has(Class target, ASTField field, Advisor advisor)
+   public static boolean has(Class<?> target, ASTField field, Advisor advisor)
    {
       return has(target, field, advisor, true);
    }
    
-   public static boolean has(Class target, ASTField field, Advisor advisor, boolean checkSuper)
+   public static boolean has(Class<?> target, ASTField field, Advisor advisor, boolean checkSuper)
    {
       Field[] fields = target.getDeclaredFields();
       for (int i = 0; i < fields.length; i++)
@@ -534,15 +529,15 @@
       
       if (checkSuper)
       {
-         Class superClass = target.getSuperclass();
+         Class<?> superClass = target.getSuperclass();
          if (superClass != null) return has(superClass, field, advisor, checkSuper);
       }
       return false;
    }
 
-   public static boolean has(Class target, ASTConstructor con, Advisor advisor)
+   public static boolean has(Class<?> target, ASTConstructor con, Advisor advisor)
    {
-      Constructor[] cons = target.getDeclaredConstructors();
+      Constructor<?>[] cons = target.getDeclaredConstructors();
       for (int i = 0; i < cons.length; i++)
       {
          ConstructorMatcher matcher = new ConstructorMatcher(advisor, cons[i], null);
@@ -561,7 +556,7 @@
       return typedef.matches(advisor, clazz);
    }
 
-   public static boolean matchesTypedef(Class clazz, ClassExpression classExpr, Advisor advisor)
+   public static boolean matchesTypedef(Class<?> clazz, ClassExpression classExpr, Advisor advisor)
    {
       String original = classExpr.getOriginal();
       String typedefName = original.substring("$typedef{".length(), original.lastIndexOf("}"));
@@ -633,20 +628,22 @@
    {
       if (nodeExceptions.size() == 0) return true;
       if (nodeExceptions.size() > foundExceptions.length) return false;
-      for (Iterator it = nodeExceptions.iterator(); it.hasNext();)
+      if (nodeExceptions.size() > 0)
       {
-         boolean found = false;
-         ASTException ex = (ASTException) it.next();
-         for (int i = 0; i < foundExceptions.length; i++)
+         for (ASTException ex : nodeExceptions)
          {
-            if (ex.getType().matches(foundExceptions[i].getName()))
+            boolean found = false;
+            for (int i = 0; i < foundExceptions.length; i++)
             {
-               found = true;
-               break;
+               if (ex.getType().matches(foundExceptions[i].getName()))
+               {
+                  found = true;
+                  break;
+               }
             }
+   
+            if (!found) return false;
          }
-
-         if (!found) return false;
       }
 
       return true;
@@ -656,7 +653,7 @@
     * @param nodeExceptions  ArrayList of ASTException entries for a given ASTMethod or ASTConstructor
     * @param foundExceptions Array of Exceptions found for a method/constructor
     */
-   public static boolean matchExceptions(Collection<ASTException> nodeExceptions, Class[] foundExceptions)
+   public static boolean matchExceptions(Collection<ASTException> nodeExceptions, Class<?>[] foundExceptions)
    {
       if (nodeExceptions.size() > foundExceptions.length) return false;
       for (Iterator<ASTException> it = nodeExceptions.iterator(); it.hasNext();)
@@ -698,16 +695,14 @@
       return matchesParameters(advisor, node.hasAnyZeroOrMoreParameters(), node.getParameters(), method.getParameterTypes());
    }
 
-   public static boolean matchesParameters(Advisor advisor, ASTConstructor node, Constructor con) 
+   public static boolean matchesParameters(Advisor advisor, ASTConstructor node, Constructor<?> con) 
    {
       if (node.isAnyParameters()) return true;
-      
-      Class[] params = con.getParameterTypes();
-      
+
       return matchesParameters(advisor, node.hasAnyZeroOrMoreParameters(), node.getParameters(), con.getParameterTypes());
    }
 
-   private static boolean matchesParameters(Advisor advisor, boolean hasAnyZeroOrMoreParameters, ArrayList<ASTParameter> parameters, Class[] params)
+   private static boolean matchesParameters(Advisor advisor, boolean hasAnyZeroOrMoreParameters, ArrayList<ASTParameter> parameters, Class<?>[] params)
    {
       RefParameterMatcher matcher = new RefParameterMatcher(advisor, parameters, params);
       return matcher.matches();
@@ -769,7 +764,7 @@
       
       private boolean isAnyZeroOrMoreParameters(int index)
       {
-         return (astParameters.get(index)).isAnyZeroOrMoreParameters();
+         return astParameters.get(index).isAnyZeroOrMoreParameters();
       }
       
       abstract boolean doMatch(int astIndex, int actualIndex);
@@ -826,8 +821,8 @@
    
    private static class RefParameterMatcher extends ParameterMatcher
    {
-      Class[] params;
-      public RefParameterMatcher(Advisor advisor, ArrayList<ASTParameter> parameters, Class[] params)
+      Class<?>[] params;
+      public RefParameterMatcher(Advisor advisor, ArrayList<ASTParameter> parameters, Class<?>[] params)
       {
          super(advisor, parameters, params);
          this.params = params;

Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/pointcut/WithinMatcher.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/pointcut/WithinMatcher.java	2008-03-24 03:08:33 UTC (rev 71183)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/pointcut/WithinMatcher.java	2008-03-24 03:41:24 UTC (rev 71184)
@@ -67,10 +67,10 @@
       throw new RuntimeException("NOT REACHABLE");
    }
 
-   public Class getDeclaringClass()
+   public Class<?> getDeclaringClass()
    {
       if (accessible instanceof Constructor)
-         return ((Constructor) accessible).getDeclaringClass();
+         return ((Constructor<?>) accessible).getDeclaringClass();
       else if (accessible instanceof Method) return ((Method) accessible).getDeclaringClass();
       return null;
    }
@@ -123,7 +123,7 @@
          }
       }
       if (accessible instanceof Method) return Boolean.FALSE;
-      ConstructorMatcher matcher = new ConstructorMatcher(advisor, (Constructor) accessible, null);
+      ConstructorMatcher matcher = new ConstructorMatcher(advisor, (Constructor<?>) accessible, null);
       return matcher.matches(node);
 
    }

Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/pointcut/ast/ASTConstructor.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/pointcut/ast/ASTConstructor.java	2008-03-24 03:08:33 UTC (rev 71183)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/pointcut/ast/ASTConstructor.java	2008-03-24 03:41:24 UTC (rev 71184)
@@ -21,7 +21,7 @@
  */
 package org.jboss.aop.pointcut.ast;
 
-
+ at SuppressWarnings("unchecked")
 public class ASTConstructor extends ASTBehavior
 {
    public ASTConstructor(int id)

Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/pointcut/ast/ASTField.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/pointcut/ast/ASTField.java	2008-03-24 03:08:33 UTC (rev 71183)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/pointcut/ast/ASTField.java	2008-03-24 03:41:24 UTC (rev 71184)
@@ -24,6 +24,7 @@
 
 import java.util.ArrayList;
 
+ at SuppressWarnings("unchecked")
 public class ASTField extends SimpleNode
 {
    public ASTField(int id)

Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/pointcut/ast/ASTMethod.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/pointcut/ast/ASTMethod.java	2008-03-24 03:08:33 UTC (rev 71183)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/pointcut/ast/ASTMethod.java	2008-03-24 03:41:24 UTC (rev 71184)
@@ -22,6 +22,7 @@
 package org.jboss.aop.pointcut.ast;
 
 
+ at SuppressWarnings("unchecked")
 public class ASTMethod extends ASTBehavior
 {
    public ASTMethod(int id)

Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/pointcut/ast/ClassExpression.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/pointcut/ast/ClassExpression.java	2008-03-24 03:08:33 UTC (rev 71183)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/pointcut/ast/ClassExpression.java	2008-03-24 03:41:24 UTC (rev 71184)
@@ -147,12 +147,12 @@
       return original;
    }
 
-   public static String simpleType(Class type)
+   public static String simpleType(Class<?> type)
    {
-      Class ret = type;
+      Class<?> ret = type;
       if (ret.isArray())
       {
-         Class arr = ret;
+         Class<?> arr = ret;
          String array = "";
          while (arr.isArray())
          {

Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/pointcut/ast/JJTPointcutExpressionParserState.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/pointcut/ast/JJTPointcutExpressionParserState.java	2008-03-24 03:08:33 UTC (rev 71183)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/pointcut/ast/JJTPointcutExpressionParserState.java	2008-03-24 03:41:24 UTC (rev 71184)
@@ -22,6 +22,7 @@
 
 package org.jboss.aop.pointcut.ast;
 
+ at SuppressWarnings("unchecked")
 class JJTPointcutExpressionParserState {
   private java.util.Stack nodes;
   private java.util.Stack marks;

Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/pointcut/ast/JJTTypeExpressionParserState.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/pointcut/ast/JJTTypeExpressionParserState.java	2008-03-24 03:08:33 UTC (rev 71183)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/pointcut/ast/JJTTypeExpressionParserState.java	2008-03-24 03:41:24 UTC (rev 71184)
@@ -22,6 +22,7 @@
 
 package org.jboss.aop.pointcut.ast;
 
+ at SuppressWarnings("unchecked")
 class JJTTypeExpressionParserState {
   private java.util.Stack nodes;
   private java.util.Stack marks;

Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/pointcut/ast/ParseException.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/pointcut/ast/ParseException.java	2008-03-24 03:08:33 UTC (rev 71183)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/pointcut/ast/ParseException.java	2008-03-24 03:41:24 UTC (rev 71184)
@@ -10,6 +10,7 @@
  * You can modify this class to customize your error reporting
  * mechanisms so long as you retain the public fields.
  */
+ at SuppressWarnings("serial")
 public class ParseException extends Exception {
 
   /**

Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/pointcut/ast/PointcutExpressionParser.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/pointcut/ast/PointcutExpressionParser.java	2008-03-24 03:08:33 UTC (rev 71183)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/pointcut/ast/PointcutExpressionParser.java	2008-03-24 03:41:24 UTC (rev 71184)
@@ -3,6 +3,7 @@
 
 import java.lang.reflect.Modifier;
 
+ at SuppressWarnings({"unused", "unchecked"})
 public class PointcutExpressionParser/*@bgen(jjtree)*/implements PointcutExpressionParserTreeConstants, PointcutExpressionParserConstants {/*@bgen(jjtree)*/
   protected JJTPointcutExpressionParserState jjtree = new JJTPointcutExpressionParserState();public static void main(String args[]) {
     System.out.println("Reading from standard input...");
@@ -3152,7 +3153,8 @@
     throw generateParseException();
   }
 
-  static private final class LookaheadSuccess extends java.lang.Error { }
+  @SuppressWarnings("serial")
+static private final class LookaheadSuccess extends java.lang.Error { }
   final private LookaheadSuccess jj_ls = new LookaheadSuccess();
   final private boolean jj_scan_token(int kind) {
     if (jj_scanpos == jj_lastpos) {

Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/pointcut/ast/PointcutExpressionParserTokenManager.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/pointcut/ast/PointcutExpressionParserTokenManager.java	2008-03-24 03:08:33 UTC (rev 71183)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/pointcut/ast/PointcutExpressionParserTokenManager.java	2008-03-24 03:41:24 UTC (rev 71184)
@@ -1,6 +1,7 @@
 /* Generated By:JJTree&JavaCC: Do not edit this line. PointcutExpressionParserTokenManager.java */
 package org.jboss.aop.pointcut.ast;
 
+ at SuppressWarnings({"unchecked", "unused"})
 public class PointcutExpressionParserTokenManager implements PointcutExpressionParserConstants
 {
   public  java.io.PrintStream debugStream = System.out;

Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/pointcut/ast/TokenMgrError.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/pointcut/ast/TokenMgrError.java	2008-03-24 03:08:33 UTC (rev 71183)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/pointcut/ast/TokenMgrError.java	2008-03-24 03:41:24 UTC (rev 71184)
@@ -1,6 +1,7 @@
 /* Generated By:JavaCC: Do not edit this line. TokenMgrError.java Version 3.0 */
 package org.jboss.aop.pointcut.ast;
 
+ at SuppressWarnings("serial")
 public class TokenMgrError extends Error
 {
    /*

Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/pointcut/ast/TypeExpressionParser.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/pointcut/ast/TypeExpressionParser.java	2008-03-24 03:08:33 UTC (rev 71183)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/pointcut/ast/TypeExpressionParser.java	2008-03-24 03:41:24 UTC (rev 71184)
@@ -3,6 +3,7 @@
 
 import java.lang.reflect.Modifier;
 
+ at SuppressWarnings({"unchecked", "unused"})
 public class TypeExpressionParser/*@bgen(jjtree)*/implements TypeExpressionParserTreeConstants, TypeExpressionParserConstants {/*@bgen(jjtree)*/
   protected JJTTypeExpressionParserState jjtree = new JJTTypeExpressionParserState();
 
@@ -2083,6 +2084,7 @@
     throw generateParseException();
   }
 
+  @SuppressWarnings("serial")
   static private final class LookaheadSuccess extends java.lang.Error { }
   final private LookaheadSuccess jj_ls = new LookaheadSuccess();
   final private boolean jj_scan_token(int kind) {

Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/pointcut/ast/TypeExpressionParserTokenManager.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/pointcut/ast/TypeExpressionParserTokenManager.java	2008-03-24 03:08:33 UTC (rev 71183)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/pointcut/ast/TypeExpressionParserTokenManager.java	2008-03-24 03:41:24 UTC (rev 71184)
@@ -1,6 +1,7 @@
 /* Generated By:JJTree&JavaCC: Do not edit this line. TypeExpressionParserTokenManager.java */
 package org.jboss.aop.pointcut.ast;
 
+ at SuppressWarnings("unused")
 public class TypeExpressionParserTokenManager implements TypeExpressionParserConstants
 {
   public  java.io.PrintStream debugStream = System.out;

Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/proxy/ClassProxyFactory.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/proxy/ClassProxyFactory.java	2008-03-24 03:08:33 UTC (rev 71183)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/proxy/ClassProxyFactory.java	2008-03-24 03:41:24 UTC (rev 71184)
@@ -57,39 +57,39 @@
 public class ClassProxyFactory
 {
    private static Object maplock = new Object();
-   private static WeakValueHashMap classnameMap = new WeakValueHashMap();
-   private static WeakHashMap proxyCache = new WeakHashMap();
+   private static WeakValueHashMap<String, Class<?>> classnameMap = new WeakValueHashMap<String, Class<?>>();
+   private static WeakHashMap<Class<?>, WeakReference<Class<?>>> proxyCache = new WeakHashMap<Class<?>, WeakReference<Class<?>>>();
    private static WeakHashMap methodMapCache = new WeakHashMap();
 
-   public static ClassProxy newInstance(Class clazz) throws Exception
+   public static ClassProxy newInstance(Class<?> clazz) throws Exception
    {
       return newInstance(clazz, null);
    }
 
-   public static ClassProxy newInstance(Class clazz, ProxyMixin[] mixins) throws Exception
+   public static ClassProxy newInstance(Class<?> clazz, ProxyMixin[] mixins) throws Exception
    {
       return newInstance(clazz, mixins, new ClassInstanceAdvisor());
    }
 
-   private static Class getProxyClass(Class clazz, ProxyMixin[] mixins)
+   private static Class<?> getProxyClass(Class<?> clazz, ProxyMixin[] mixins)
    throws Exception
    {
       // Don't make a proxy of a proxy !
       if (ClassProxy.class.isAssignableFrom(clazz)) clazz = clazz.getSuperclass();
 
-      Class proxyClass = null;
+      Class<?> proxyClass = null;
       synchronized (maplock)
       {
-         WeakReference ref = (WeakReference) proxyCache.get(clazz);
+         WeakReference<Class<?>> ref = proxyCache.get(clazz);
          if (ref != null)
          {
-            proxyClass = (Class)ref.get();
+            proxyClass = ref.get();
          }
          if (proxyClass == null)
          {
             proxyClass = generateProxy(clazz, mixins);
             classnameMap.put(clazz.getName(), proxyClass);
-            proxyCache.put(clazz, new WeakReference(proxyClass));
+            proxyCache.put(clazz, new WeakReference<Class<?>>(proxyClass));
             HashMap map = methodMap(clazz);
             methodMapCache.put(proxyClass, map);
          }
@@ -318,7 +318,7 @@
       return proxyClass;
    }
 
-   private static void populateMethodTables(HashMap advised, List ignoredHash, Class superclass)
+   private static void populateMethodTables(HashMap<Long, MethodPersistentReference> advised, List ignoredHash, Class superclass)
    throws Exception
    {
       if (superclass == null) return;
@@ -350,10 +350,10 @@
 
    }
 
-   public static HashMap methodMap(Class clazz)
+   public static HashMap<Long, MethodPersistentReference> methodMap(Class<?> clazz)
    throws Exception
    {
-      HashMap methods = new HashMap();
+      HashMap<Long, MethodPersistentReference> methods = new HashMap<Long, MethodPersistentReference>();
       List ignoredHash = new ArrayList();
       populateMethodTables(methods, ignoredHash, clazz);
       return methods;

Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/proxy/container/AOPProxyFactoryMixin.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/proxy/container/AOPProxyFactoryMixin.java	2008-03-24 03:08:33 UTC (rev 71183)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/proxy/container/AOPProxyFactoryMixin.java	2008-03-24 03:41:24 UTC (rev 71184)
@@ -21,22 +21,26 @@
 */ 
 package org.jboss.aop.proxy.container;
 
+import java.io.IOException;
+import java.io.Serializable;
 import java.lang.ref.WeakReference;
 
-public class AOPProxyFactoryMixin
+public class AOPProxyFactoryMixin implements Serializable
 {
+   private static final long serialVersionUID = 1L;
+   
    private String construction;
-   private WeakReference mixinClassRef;
-   private WeakReference[] interfaceClassRefs;
+   private WeakReference<Class<?>> mixinClassRef;
+   private WeakReference<Class<?>>[] interfaceClassRefs;
    private int hashcode;
 
-   public AOPProxyFactoryMixin(Class mixin, Class[] interfaces)
+   public AOPProxyFactoryMixin(Class<?> mixin, Class<?>[] interfaces)
    {
-      mixinClassRef = new WeakReference(mixin);
+      mixinClassRef = new WeakReference<Class<?>>(mixin);
       interfaceClassRefs = ContainerCacheUtil.getSortedWeakReferenceForInterfaces(interfaces);
    }
 
-   public AOPProxyFactoryMixin(Class mixin, Class[] interfaces, String parameters)
+   public AOPProxyFactoryMixin(Class<?> mixin, Class<?>[] interfaces, String parameters)
    {
       this(mixin, interfaces);
       StringBuffer construction = new StringBuffer(" new ");
@@ -62,23 +66,23 @@
    }
 
 
-   public Class[] getInterfaces()
+   public Class<?>[] getInterfaces()
    {
       if (interfaceClassRefs != null)
       {
-         Class[] interfaces = new Class[interfaceClassRefs.length];
+         Class<?>[] interfaces = new Class[interfaceClassRefs.length];
          for (int i = 0 ; i < interfaces.length ; i++)
          {
-            interfaces[i] = (Class)interfaceClassRefs[i].get();
+            interfaces[i] = interfaceClassRefs[i].get();
          }
          return interfaces;
       }
       return null;
    }
 
-   public Class getMixin()
+   public Class<?> getMixin()
    {
-      return (Class)mixinClassRef.get();
+      return mixinClassRef.get();
    }
 
    public boolean equals(Object obj)
@@ -115,7 +119,7 @@
       if (hashcode == 0)
       {
          
-         Class clazz = (Class)mixinClassRef.get();
+         Class<?> clazz = mixinClassRef.get();
          StringBuffer sb = new StringBuffer();
          
          if (clazz != null)
@@ -128,7 +132,7 @@
             for (int i = 0 ; i < interfaceClassRefs.length ; i++)
             {
                sb.append(";");
-               sb.append(((Class)interfaceClassRefs[i].get()).getName());
+               sb.append((interfaceClassRefs[i].get()).getName());
             }
          }
          hashcode = sb.toString().hashCode();
@@ -165,4 +169,26 @@
       }
       return true;
    }
+   
+   private void writeObject(java.io.ObjectOutputStream out) throws IOException
+   {
+      out.writeObject(construction);
+      out.writeObject(mixinClassRef.get());
+      out.writeObject(getInterfaces());
+      out.writeInt(hashCode());
+   }
+   
+   private void readObject(java.io.ObjectInputStream in) throws IOException, ClassNotFoundException
+   {
+      construction = (String)in.readObject();
+      mixinClassRef = new WeakReference<Class<?>>((Class<?>)in.readObject());
+      Class<?>[] ifs = (Class[])in.readObject();
+      interfaceClassRefs = new WeakReference[ifs.length];
+      for (int i = 0 ; i < ifs.length ; i++)
+      {
+         interfaceClassRefs[i] = new WeakReference<Class<?>>(ifs[i]);
+      }
+      hashcode = in.readInt();
+   }
+   
 }
\ No newline at end of file

Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/proxy/container/AOPProxyFactoryParameters.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/proxy/container/AOPProxyFactoryParameters.java	2008-03-24 03:08:33 UTC (rev 71183)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/proxy/container/AOPProxyFactoryParameters.java	2008-03-24 03:41:24 UTC (rev 71184)
@@ -31,11 +31,11 @@
  */
 public class AOPProxyFactoryParameters
 {
-   private Class proxiedClass;
+   private Class<?> proxiedClass;
    private Object target;
    private MetaData metaData;
    private boolean metaDataHasInstanceLevelData;
-   private Class[] interfaces;
+   private Class<?>[] interfaces;
    private AOPProxyFactoryMixin[] mixins; 
    private boolean objectAsSuperClass;
    private SimpleMetaData simpleMetaData;
@@ -47,16 +47,16 @@
    }
 
    public AOPProxyFactoryParameters(
-         Class proxiedClass, 
+         Class<?> proxiedClass, 
          Object target, 
-         Class[] interfaces,
+         Class<?>[] interfaces,
          AOPProxyFactoryMixin[] mixins,
          MetaData metaData, 
          boolean metaDataHasInstanceLevelData,
          boolean objectAsSuperClass,
          SimpleMetaData simpleMetaData,
          ContainerCache containerCache,
-         Class[] ctorSignature,
+         Class<?>[] ctorSignature,
          Object[] ctorArguments)
    {
       this.proxiedClass = proxiedClass;
@@ -71,12 +71,12 @@
       setCtor(ctorSignature, ctorArguments);      
    }
 
-   public Class[] getInterfaces()
+   public Class<?>[] getInterfaces()
    {
       return interfaces;
    }
 
-   public void setInterfaces(Class[] interfaces)
+   public void setInterfaces(Class<?>[] interfaces)
    {
       this.interfaces = interfaces;
    }
@@ -101,12 +101,12 @@
       this.objectAsSuperClass = objectAsSuperClass;
    }
 
-   public Class getProxiedClass()
+   public Class<?> getProxiedClass()
    {
       return proxiedClass;
    }
 
-   public void setProxiedClass(Class proxiedClass)
+   public void setProxiedClass(Class<?> proxiedClass)
    {
       this.proxiedClass = proxiedClass;
    }
@@ -166,7 +166,7 @@
       this.metaDataHasInstanceLevelData = metaDataHasInstanceLevelData;
    }
 
-   public void setCtor(Class[] ctorSignature, Object[] ctorArguments)
+   public void setCtor(Class<?>[] ctorSignature, Object[] ctorArguments)
    {
       boolean haveSig = (ctorSignature != null && ctorSignature.length > 0);
       boolean haveArgs = (ctorArguments != null && ctorArguments.length > 0);
@@ -187,10 +187,10 @@
    
    public static class Ctor
    {
-      Class[] signature;
+      Class<?>[] signature;
       Object[] arguments;
       
-      public Ctor(Class[] signature, Object[] arguments)
+      public Ctor(Class<?>[] signature, Object[] arguments)
       {
          this.signature = signature;
          this.arguments = arguments;
@@ -201,7 +201,7 @@
          return arguments;
       }
 
-      public Class[] getSignature()
+      public Class<?>[] getSignature()
       {
          return signature;
       }

Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/proxy/container/AspectManaged.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/proxy/container/AspectManaged.java	2008-03-24 03:08:33 UTC (rev 71183)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/proxy/container/AspectManaged.java	2008-03-24 03:41:24 UTC (rev 71184)
@@ -24,6 +24,7 @@
 import org.jboss.aop.Advisor;
 import org.jboss.aop.InstanceAdvisor;
 import org.jboss.aop.metadata.SimpleMetaData;
+import org.jboss.util.id.GUID;
 
 /**
  * comment
@@ -32,6 +33,7 @@
  */
 public interface AspectManaged
 {
+   GUID GUID = new GUID();
    public Advisor getAdvisor();
    public void setAdvisor(Advisor advisor);
    public InstanceAdvisor getInstanceAdvisor();

Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/proxy/container/ClassProxyContainer.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/proxy/container/ClassProxyContainer.java	2008-03-24 03:08:33 UTC (rev 71183)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/proxy/container/ClassProxyContainer.java	2008-03-24 03:41:24 UTC (rev 71184)
@@ -25,13 +25,13 @@
 import java.security.PrivilegedAction;
 import java.util.ArrayList;
 import java.util.Arrays;
-import java.util.Iterator;
 import java.lang.reflect.Method;
 
 import org.jboss.aop.Advisor;
 import org.jboss.aop.ClassContainer;
 import org.jboss.aop.AspectManager;
 import org.jboss.aop.ClassAdvisor;
+import org.jboss.aop.MethodInfo;
 import org.jboss.aop.advice.AspectDefinition;
 import org.jboss.aop.introduction.InterfaceIntroduction;
 import org.jboss.aop.util.ConstructorComparator;
@@ -56,15 +56,15 @@
 
    protected void createConstructorTables()
    {
-      Class useClass = clazz;
+      Class<?> useClass = clazz;
       if (clazz.getName().startsWith(ContainerProxyFactory.PROXY_NAME_PREFIX) && clazz != null && clazz.getSuperclass() != null)
       {
          useClass = clazz.getSuperclass();
       }
       if (useClass != null)
       {
-         final Class theUseClass = useClass;
-         AccessController.doPrivileged(new PrivilegedAction()
+         final Class<?> theUseClass = useClass;
+         AccessController.doPrivileged(new PrivilegedAction<Object>()
          {
             public Object run()
             {
@@ -88,7 +88,7 @@
       {
          Method[] declaredMethods = clazz.getMethods();
 
-         Class superclass = clazz.getSuperclass();
+         Class<?> superclass = clazz.getSuperclass();
          for (int i = 0; i < declaredMethods.length; i++)
          {
             Method method = declaredMethods[i];
@@ -110,16 +110,15 @@
 
          for (int i = 0; i < interfaceIntroductions.size(); ++i)
          {
-            InterfaceIntroduction ii = (InterfaceIntroduction) interfaceIntroductions.get(i);
+            InterfaceIntroduction ii = interfaceIntroductions.get(i);
             String[] intf = ii.getInterfaces();
             addMethodsFromInterfaces(intf);
 
-            ArrayList mixins = ii.getMixins();
+            ArrayList<InterfaceIntroduction.Mixin> mixins = ii.getMixins();
             if (mixins.size() > 0)
             {
-               for (Iterator it = mixins.iterator() ; it.hasNext() ;)
+               for (InterfaceIntroduction.Mixin mixin : mixins)
                {
-                  InterfaceIntroduction.Mixin mixin = (InterfaceIntroduction.Mixin)it.next();
                   String[] mintf = mixin.getInterfaces();
                   addMethodsFromInterfaces(mintf);
                }
@@ -138,7 +137,7 @@
       for (int j = 0; intf != null && j < intf.length; ++j)
       {
          // FIXME ClassLoader - why should the class be visible from the context classloader?
-         Class iface = cl.loadClass(intf[j]);
+         Class<?> iface = cl.loadClass(intf[j]);
          Method[] ifaceMethods = iface.getMethods();
          for (int k = 0; k < ifaceMethods.length; k++)
          {
@@ -164,7 +163,7 @@
       return ia;
    }
 
-   public void initialise(Class proxiedClass)
+   public void initialise(Class<?> proxiedClass)
    {
       setClass(proxiedClass);
       ((ProxyAdvisorDomain)manager).attachAdvisor();
@@ -214,4 +213,16 @@
    {
       return true;
    }
+
+   public MethodInfo[] getMethodInfos()
+   {
+      long[] keys = methodInfos.keys();
+      MethodInfo[] minfos = new MethodInfo[keys.length];
+      for (int i = 0 ; i < keys.length ; i++)
+      {
+         minfos[i] = methodInfos.getMethodInfo(keys[i]);
+         
+      }
+      return minfos;
+   }
 }

Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/proxy/container/ContainerCache.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/proxy/container/ContainerCache.java	2008-03-24 03:08:33 UTC (rev 71183)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/proxy/container/ContainerCache.java	2008-03-24 03:41:24 UTC (rev 71184)
@@ -41,7 +41,7 @@
 {
    private static volatile int counter;
    public static final Object mapLock = new Object();
-   private static WeakHashMap containerCache = new WeakHashMap();
+   private static WeakHashMap<Class<?>, HashMap<String, ClassProxyContainer>> containerCache = new WeakHashMap<Class<?>, HashMap<String, ClassProxyContainer>>();
 
    private AspectManager manager;
    private ContainerProxyCacheKey key;
@@ -49,14 +49,14 @@
    private Advisor classAdvisor;
    private InstanceProxyContainer instanceContainer;
    boolean isClassProxyContainer;
-   Class[] interfaces;
+   Class<?>[] interfaces;
    AOPProxyFactoryMixin[] mixins;
 
    MetaData metaData;
    boolean metaDataHasInstanceLevelData;
    SimpleMetaData simpleMetaData;
 
-   private ContainerCache(AspectManager manager, Class proxiedClass, Class[] interfaces, AOPProxyFactoryMixin[] mixins, MetaData metaData, boolean metaDataHasInstanceLevelData, SimpleMetaData simpleMetaData)
+   private ContainerCache(AspectManager manager, Class<?> proxiedClass, Class<?>[] interfaces, AOPProxyFactoryMixin[] mixins, MetaData metaData, boolean metaDataHasInstanceLevelData, SimpleMetaData simpleMetaData)
    {
       this.manager = manager;
       this.interfaces = interfaces;
@@ -67,7 +67,7 @@
       key = new ContainerProxyCacheKey(manager.getManagerFQN(), proxiedClass, interfaces, mixins, metaData);
    }
 
-   public static ContainerCache initialise(AspectManager manager, Class proxiedClass, MetaData metaData, boolean metaDataHasInstanceLevelData)
+   public static ContainerCache initialise(AspectManager manager, Class<?> proxiedClass, MetaData metaData, boolean metaDataHasInstanceLevelData)
    {
       return initialise(manager, proxiedClass, null, null, metaData, metaDataHasInstanceLevelData, null);
    }
@@ -84,7 +84,7 @@
             params.getSimpleMetaData());
    }
 
-   private static ContainerCache initialise(AspectManager manager, Class proxiedClass, Class[] interfaces, AOPProxyFactoryMixin[] mixins, MetaData metaData, boolean metaDataHasInstanceLevelData, SimpleMetaData simpleMetaData)
+   private static ContainerCache initialise(AspectManager manager, Class<?> proxiedClass, Class<?>[] interfaces, AOPProxyFactoryMixin[] mixins, MetaData metaData, boolean metaDataHasInstanceLevelData, SimpleMetaData simpleMetaData)
    {
       ContainerCache factory = new ContainerCache(manager, proxiedClass, interfaces, mixins, metaData, metaDataHasInstanceLevelData, simpleMetaData);
       synchronized (mapLock)
@@ -161,12 +161,22 @@
       }
    }
 
+   public static ClassProxyContainer getCachedContainer(ContainerProxyCacheKey key)
+   {
+      HashMap<String, ClassProxyContainer> managerContainers = containerCache.get(key.getClazz());
+      if (managerContainers != null)
+      {
+         return managerContainers.get(key.getManagerFQN());
+      }
+      return null;
+   }
+   
    private ClassProxyContainer getCachedContainer(AspectManager manager)
    {
-      HashMap managerContainers = (HashMap)containerCache.get(key.getClazz());
+      HashMap<String, ClassProxyContainer> managerContainers = containerCache.get(key.getClazz());
       if (managerContainers != null)
       {
-         return (ClassProxyContainer)managerContainers.get(manager.getManagerFQN());
+         return managerContainers.get(manager.getManagerFQN());
       }
       return null;
    }
@@ -192,10 +202,10 @@
 
    private void cacheContainer(ContainerProxyCacheKey key, ClassProxyContainer container)
    {
-      HashMap managerContainers = (HashMap)containerCache.get(key.getClazz());
+      HashMap<String, ClassProxyContainer> managerContainers = containerCache.get(key.getClazz());
       if (managerContainers == null)
       {
-         managerContainers = new HashMap();
+         managerContainers = new HashMap<String, ClassProxyContainer>();
          containerCache.put(key.getClazz(), managerContainers);
       }
       managerContainers.put(key.getManagerFQN(), container);
@@ -211,7 +221,7 @@
          return null;
       }
 
-      Class proxiedClass = classAdvisor.getClazz();
+      Class<?> proxiedClass = classAdvisor.getClazz();
       if (proxiedClass == null)
       {
          proxiedClass = Object.class;
@@ -231,8 +241,8 @@
    {
       for (int i = 0 ; i < mixins.length && mixins != null; i++)
       {
-         Class[] mixinInterfaces = mixins[i].getInterfaces();
-         Class mixinClass = mixins[i].getMixin();
+         Class<?>[] mixinInterfaces = mixins[i].getInterfaces();
+         Class<?> mixinClass = mixins[i].getMixin();
 
          if (mixinInterfaces == null)
          {
@@ -249,7 +259,7 @@
       }
    }
 
-   private String[] getClassNames(Class[] classes)
+   private String[] getClassNames(Class<?>[] classes)
    {
       if (classes == null)
       {

Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/proxy/container/ContainerCacheUtil.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/proxy/container/ContainerCacheUtil.java	2008-03-24 03:08:33 UTC (rev 71183)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/proxy/container/ContainerCacheUtil.java	2008-03-24 03:41:24 UTC (rev 71184)
@@ -37,28 +37,28 @@
     * Takes a Class[] containing interface classes, and returns an array of weak references to thos class
     * objects, sorted alphabetically by name.
     */
-   public static WeakReference[] getSortedWeakReferenceForInterfaces(Class[] ifaces)
+   public static WeakReference<Class<?>>[] getSortedWeakReferenceForInterfaces(Class<?>[] ifaces)
    {
       if (ifaces == null)
       {
          return null;
       }
       
-      WeakReference[] interfaces = new WeakReference[ifaces.length];
+      WeakReference<Class<?>>[] interfaces = new WeakReference[ifaces.length];
       
       for (int i = 0 ; i < ifaces.length ; i++)
       {
-         interfaces[i] = new WeakReference(ifaces[i]);
+         interfaces[i] = new WeakReference<Class<?>>(ifaces[i]);
       }
       
       Arrays.sort(interfaces, Alphabetical.singleton);
       return interfaces;
    }
 
-   public static boolean compareClassRefs(WeakReference my, WeakReference other)
+   public static boolean compareClassRefs(WeakReference<Class<?>> my, WeakReference<Class<?>> other)
    {
-      Class myClass = (Class)my.get();
-      Class otherClass = (Class)other.get(); 
+      Class<?> myClass = my.get();
+      Class<?> otherClass = other.get(); 
       
       if (myClass == null || otherClass == null)
       {
@@ -72,7 +72,7 @@
       return true;
    }
    
-   public static boolean compareInterfaceRefs(WeakReference[] my, WeakReference[] other)
+   public static boolean compareInterfaceRefs(WeakReference<Class<?>>[] my, WeakReference<Class<?>>[] other)
    {
       if ((my == null && other != null) ||
             (my == null && other != null))
@@ -89,8 +89,8 @@
          
          for (int i = 0 ; i < my.length ; i++)
          {
-            Class myIf = (Class)my[i].get();
-            Class otherIf = (Class)other[i].get();
+            Class<?> myIf = my[i].get();
+            Class<?> otherIf = other[i].get();
             
             if (!myIf.equals(otherIf))
             {
@@ -102,14 +102,14 @@
       return true;
    }
 
-   static class Alphabetical implements Comparator
+   static class Alphabetical implements Comparator<WeakReference<Class<?>>>
    {
       static Alphabetical singleton = new Alphabetical();
       
-      public int compare(Object o1, Object o2)
+      public int compare(WeakReference<Class<?>> o1, WeakReference<Class<?>> o2)
       {
-         String name1 = ((Class)((WeakReference)o1).get()).getName();
-         String name2 = ((Class)((WeakReference)o2).get()).getName();
+         String name1 = o1.get().getName();
+         String name2 = o2.get().getName();
          return (name1).compareTo(name2);
       }
    }

Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/proxy/container/ContainerProxyCacheKey.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/proxy/container/ContainerProxyCacheKey.java	2008-03-24 03:08:33 UTC (rev 71183)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/proxy/container/ContainerProxyCacheKey.java	2008-03-24 03:41:24 UTC (rev 71184)
@@ -21,12 +21,14 @@
 */ 
 package org.jboss.aop.proxy.container;
 
+import java.io.IOException;
 import java.io.Serializable;
 import java.lang.ref.WeakReference;
 import java.util.Arrays;
 import java.util.Comparator;
 
 import org.jboss.metadata.spi.MetaData;
+import org.jboss.util.id.GUID;
 
 /**
  * 
@@ -36,37 +38,40 @@
 public class ContainerProxyCacheKey implements Serializable
 {
    private static final long serialVersionUID = 8758283842273747310L;
-   private static final WeakReference[] EMTPY_WR_ARRAY = new WeakReference[0];
+   private static final WeakReference<Class<?>>[] EMTPY_WR_ARRAY = new WeakReference[0];
    private static final AOPProxyFactoryMixin[] EMPTY_MIXIN_ARRAY = new AOPProxyFactoryMixin[0];
    
    private String managerFqn;
-   private WeakReference clazzRef;
-   private WeakReference[] addedInterfaces = EMTPY_WR_ARRAY;
+   private WeakReference<Class<?>> clazzRef;
+   private WeakReference<Class<?>>[] addedInterfaces = EMTPY_WR_ARRAY;
    
    private MetaData metaData;
+   /** In case we are serializing with an unserializable MetaData in the same JVM, give a chance to make sure that the metaData is the same */
+   private long metaDataIdentityHashCode; 
    
    private AOPProxyFactoryMixin[] addedMixins = EMPTY_MIXIN_ARRAY;
    private int hashcode = 0;
+   private GUID guid = MarshalledContainerProxy.GUID;
    
-   public ContainerProxyCacheKey(String managerFqn, Class clazz)
+   public ContainerProxyCacheKey(String managerFqn, Class<?> clazz)
    {
-      this.clazzRef = new WeakReference(clazz);
+      this.clazzRef = new WeakReference<Class<?>>(clazz);
       this.managerFqn = managerFqn;
    }
    
-   public ContainerProxyCacheKey(Class clazz)
+   public ContainerProxyCacheKey(Class<?> clazz)
    {
       this("/", clazz);
    }
    
-   public ContainerProxyCacheKey(String managerFqn, Class clazz, Class[] addedInterfaces, MetaData metaData)
+   public ContainerProxyCacheKey(String managerFqn, Class<?> clazz, Class<?>[] addedInterfaces, MetaData metaData)
    {
       this(managerFqn, clazz); 
       this.addedInterfaces = ContainerCacheUtil.getSortedWeakReferenceForInterfaces(addedInterfaces);
       this.metaData = metaData; 
    }
 
-   public ContainerProxyCacheKey(String managerFqn, Class clazz, Class[] addedInterfaces, AOPProxyFactoryMixin[] addedMixins, MetaData metaData)
+   public ContainerProxyCacheKey(String managerFqn, Class<?> clazz, Class<?>[] addedInterfaces, AOPProxyFactoryMixin[] addedMixins, MetaData metaData)
    {
       this(managerFqn, clazz, addedInterfaces, metaData);
       
@@ -77,17 +82,21 @@
       }
    }
 
-   public Class getClazz()
+   public Class<?> getClazz()
    {
-      Class clazz = (Class)clazzRef.get();
-      return clazz; 
+      return clazzRef.get();
    }
    
    public String getManagerFQN()
    {
       return managerFqn;
    }
-   
+ 
+   protected GUID getGuid()
+   {
+      return guid;
+   }
+
    public boolean equals(Object obj)
    {
       if (this == obj)
@@ -122,6 +131,10 @@
       {
          return false;
       }
+      if(!guid.equals(other.guid))
+      {
+         return false;
+      }
       
       return true;
    }
@@ -131,7 +144,7 @@
       if (hashcode == 0)
       {
          
-         Class clazz = (Class)clazzRef.get();
+         Class<?> clazz = clazzRef.get();
          StringBuffer sb = new StringBuffer();
          sb.append(managerFqn);
          if (clazz != null)
@@ -144,7 +157,7 @@
             for (int i = 0 ; i < addedInterfaces.length ; i++)
             {
                sb.append(";");
-               sb.append(((Class)addedInterfaces[i].get()).getName());
+               sb.append((addedInterfaces[i].get()).getName());
             }
          }
          
@@ -162,7 +175,7 @@
    public String toString()
    {
       StringBuffer buf = new StringBuffer("ContainerProxyCache");
-      buf.append(((Class)clazzRef.get()).getName());
+      buf.append((clazzRef.get()).getName());
       buf.append(";interfaces=");
       if (addedInterfaces == null)
       {
@@ -186,21 +199,42 @@
    
    private boolean compareMetadataContext(ContainerProxyCacheKey other)
    {
-      if (this.metaData == null && other.metaData == null)
+      if (this.metaData == null && this.metaDataIdentityHashCode == 0 && other.metaData == null && other.metaDataIdentityHashCode == 0)
       {
+         return true;
       }
-      else if ((this.metaData != null && other.metaData != null))
+      
+      if (this.metaData != null && other.metaData != null)
       {
-         if (!this.metaData.equals(other.metaData))
+         return this.metaData.equals(other.metaData);
+      }
+      
+      if (this.metaDataIdentityHashCode != 0 && other.metaDataIdentityHashCode != 0)
+      {
+         return this.metaDataIdentityHashCode == other.metaDataIdentityHashCode;
+      }
+      
+      if (this.metaData != null && other.metaData == null && other.metaDataIdentityHashCode != 0)
+      {
+         long oneHashCode = System.identityHashCode(this.metaData);
+         if (oneHashCode == other.metaDataIdentityHashCode)
          {
-            return false;
+            other.metaData = this.metaData;
+            return true;
          }
       }
-      else
+      
+      if (other.metaData != null && this.metaData == null && this.metaDataIdentityHashCode != 0)
       {
-         return false;
+         long twoHashCode = System.identityHashCode(other.metaData);
+         if (twoHashCode == this.metaDataIdentityHashCode)
+         {
+            this.metaData = other.metaData;
+            return true;
+         }
       }
-      return true;
+      
+      return false;
    }
    
    private boolean compareClass(ContainerProxyCacheKey other)
@@ -240,14 +274,63 @@
       return true;
    }
    
-   static class MixinAlphabetical implements Comparator
+    private void writeObject(java.io.ObjectOutputStream out) throws IOException
+    {
+       out.writeUTF(managerFqn);
+       out.writeObject(guid);
+       out.writeObject(clazzRef.get());
+       Class<?>[] ifs = null;
+       if (addedInterfaces != null)
+       {
+          ifs = new Class[addedInterfaces.length];
+          for (int i = 0 ; i < addedInterfaces.length ; i++)
+          {
+             ifs[i] = addedInterfaces[i].get();
+          }
+       }
+       out.writeObject(ifs);
+       if (metaData instanceof Serializable)
+       {
+          out.writeObject(metaData);   
+       }
+       else
+       {
+          out.writeObject(null);
+       }
+       out.writeLong(System.identityHashCode(metaData));
+       
+       out.writeObject(addedMixins);
+       out.writeInt(hashCode());
+    }
+    
+    private void readObject(java.io.ObjectInputStream in) throws IOException, ClassNotFoundException
+    {
+       managerFqn = in.readUTF();
+       guid = (GUID)in.readObject();
+       clazzRef = new WeakReference<Class<?>>((Class<?>)in.readObject());
+       Class<?>[] ifs = (Class[])in.readObject();
+       if (ifs != null)
+       {
+          addedInterfaces = new WeakReference[ifs.length];
+          for (int i = 0 ; i < ifs.length ; i++)
+          {
+             addedInterfaces[i] = new WeakReference<Class<?>>(ifs[i]);
+          }
+       }
+       metaData = (MetaData)in.readObject();
+       metaDataIdentityHashCode = in.readLong();
+       addedMixins = (AOPProxyFactoryMixin[])in.readObject();
+       hashcode = in.readInt();
+    }
+   
+   static class MixinAlphabetical implements Comparator<AOPProxyFactoryMixin>
    {
       static MixinAlphabetical singleton = new MixinAlphabetical();
       
-      public int compare(Object o1, Object o2)
+      public int compare(AOPProxyFactoryMixin o1, AOPProxyFactoryMixin o2)
       {
-         String name1 = ((AOPProxyFactoryMixin)o1).getMixin().getName();
-         String name2 = ((AOPProxyFactoryMixin)o2).getMixin().getName();
+         String name1 = o1.getMixin().getName();
+         String name2 = o2.getMixin().getName();
          return (name1).compareTo(name2);
       }
    }

Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/proxy/container/ContainerProxyFactory.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/proxy/container/ContainerProxyFactory.java	2008-03-24 03:08:33 UTC (rev 71183)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/proxy/container/ContainerProxyFactory.java	2008-03-24 03:41:24 UTC (rev 71184)
@@ -21,9 +21,12 @@
   */
 package org.jboss.aop.proxy.container;
 
+import java.io.Externalizable;
+import java.io.Serializable;
 import java.lang.reflect.Method;
 import java.security.ProtectionDomain;
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Iterator;
@@ -57,6 +60,7 @@
 import org.jboss.aop.instrument.TransformerCommon;
 import org.jboss.aop.introduction.InterfaceIntroduction;
 import org.jboss.aop.util.JavassistMethodHashing;
+import org.jboss.aop.util.MethodHashing;
 
 
 /**
@@ -71,7 +75,7 @@
    public static final String PROXY_NAME_PREFIX = "AOPContainerProxy$";
    
    private static Object maplock = new Object();
-   private static WeakHashMap proxyCache = new WeakHashMap();
+   private static WeakHashMap<Class, Map<ContainerProxyCacheKey, Class>> proxyCache = new WeakHashMap<Class, Map<ContainerProxyCacheKey, Class>>();
    private static volatile int counter = 0;
    
    private static CtMethod setDelegateMethod;
@@ -92,13 +96,15 @@
    /** The class pool for the proxy (i.e for the class we are proxying */
    private ClassPool pool;
    
-   /** The interface introductions and mixins that should be used for this proxy*/
-   private ArrayList mixins;
-   
    /** True if we are proxying a class already woven by jboss aop, false otherwise */
    private boolean isAdvised;
    
+   ProxyStrategy proxyStrategy;
+   
    private CtConstructor defaultCtor;
+
+   /** Methods hardcoded in createBasics */
+   private HashSet<Long> hardcodedMethods = new HashSet<Long>();
    
    public static Class getProxyClass(Class clazz, AspectManager manager) throws Exception
    {
@@ -110,6 +116,12 @@
    public static Class getProxyClass(boolean objectAsSuper, ContainerProxyCacheKey key, Advisor advisor)
            throws Exception
    {
+      return getProxyClass(objectAsSuper, key, advisor, null);
+   }
+   
+   public static Class getProxyClass(boolean objectAsSuper, ContainerProxyCacheKey key, Advisor advisor, MarshalledContainerProxy outOfVmProxy)
+   throws Exception
+   {   
       Class clazz = key.getClazz();
       // Don't make a proxy of a proxy !
       if (Delegate.class.isAssignableFrom(clazz)) clazz = clazz.getSuperclass();
@@ -117,30 +129,30 @@
       Class proxyClass = null;
       synchronized (maplock)
       {
-         Map map = (Map)proxyCache.get(clazz);
+         Map<ContainerProxyCacheKey, Class> map = proxyCache.get(clazz);
          if (map == null)
          {
-            map = new HashMap();
+            map = new HashMap<ContainerProxyCacheKey, Class>();
             proxyCache.put(clazz, map);
          }
          else
          {
-            proxyClass = (Class) map.get(key);
+            proxyClass = map.get(key);
          }
          
          if (proxyClass == null)
          {
-            proxyClass = generateProxy(objectAsSuper, clazz, advisor);
+            proxyClass = generateProxy(objectAsSuper, clazz, advisor, outOfVmProxy);
             map.put(key, proxyClass);
          }
       }
       return proxyClass;
    }
 
-   private static Class generateProxy(boolean objectAsSuper, Class clazz, Advisor advisor) throws Exception
+   private static Class generateProxy(boolean objectAsSuper, Class clazz, Advisor advisor, MarshalledContainerProxy outOfVmProxy) throws Exception
    {
       ArrayList introductions = advisor.getInterfaceIntroductions();
-      CtClass proxy = createProxyCtClass(objectAsSuper, introductions, clazz, advisor);
+      CtClass proxy = createProxyCtClass(objectAsSuper, introductions, clazz, advisor, outOfVmProxy);
       ProtectionDomain pd = clazz.getProtectionDomain();
       Class proxyClass = TransformerCommon.toClass(proxy, pd);
       return proxyClass;
@@ -164,21 +176,35 @@
       return container;
    }
    
-   public static CtClass createProxyCtClass(boolean objectAsSuper, ArrayList mixins, Class clazz, Advisor advisor)
+   private static CtClass createProxyCtClass(boolean objectAsSuper, ArrayList mixins, Class clazz, Advisor advisor)
+   throws Exception
+   {
+      return createProxyCtClass(objectAsSuper, mixins, clazz, advisor, null);
+   }
+   
+   private static CtClass createProxyCtClass(boolean objectAsSuper, ArrayList mixins, Class clazz, Advisor advisor, MarshalledContainerProxy outOfVmProxy)
            throws Exception
    {
-      ContainerProxyFactory factory = new ContainerProxyFactory(objectAsSuper, mixins, clazz, advisor);
+      ContainerProxyFactory factory = new ContainerProxyFactory(objectAsSuper, mixins, clazz, advisor, outOfVmProxy);
       return factory.createProxyCtClass();
    }
 
    
-   private ContainerProxyFactory(boolean objectAsSuper, ArrayList mixins, Class clazz, Advisor advisor)
+   private ContainerProxyFactory(boolean objectAsSuper, ArrayList mixins, Class clazz, Advisor advisor, MarshalledContainerProxy outOfVmProxy)
    {
       this.objectAsSuper = objectAsSuper;
-      this.mixins = mixins;
       this.clazz = clazz;
       this.advisor = advisor;
       isAdvised = Advised.class.isAssignableFrom(clazz);
+      
+      if (outOfVmProxy == null)
+      {
+         proxyStrategy = new OriginalProxyStrategy(mixins);
+      }
+      else
+      {
+         proxyStrategy = new UnmarshalledInRemoteJVMProxyStrategy(outOfVmProxy);
+      }
    }
   
    
@@ -226,6 +252,10 @@
       addMethodFromTemplate(template, "getDelegate", "{ return delegate; }");
       setDelegateMethod = addMethodFromTemplate(template, "setDelegate", "{ this.delegate = (" + proxySuper.getName() + ")$1; }");
 
+      addFieldFromTemplate(template, "key");
+      addMethodFromTemplate(template, "setContainerProxyCacheKey", "{this.key=$1;}");
+      
+      
       //Add methods/fields needed for AspectManaged interface 
       proxy.addInterface(pool.get("org.jboss.aop.proxy.container.AspectManaged"));
 
@@ -241,8 +271,9 @@
       addMethodFromTemplate(template, "setInstanceAdvisor", instanceAdvisorSetterBody());
       addMethodFromTemplate(template, "getInstanceAdvisor", instanceAdvisorGetterBody());
       
-      addMethodFromTemplate(template, "writeObject", writeObjectBody());
-      addMethodFromTemplate(template, "readObject", readObjectBody(superclass));
+      addMethodFromTemplate(template, "writeReplace", writeReplaceObjectBody());
+      addMethodFromTemplate(template, "localUnmarshal", localUnmarshalObjectBody(superclass));
+      addMethodFromTemplate(template, "remoteUnmarshal", remoteUnmarshalObjectBody(superclass));
       
       if (objectAsSuper)
       {
@@ -254,7 +285,7 @@
 
       copyAnnotations(superclass, proxy);
       copySignature(superclass, proxy);
-      
+
       return proxy;
    }
    
@@ -294,33 +325,57 @@
          "}";
    }
 
-   private String writeObjectBody()
+   private String writeReplaceObjectBody()
    {
       return 
          "{" +
-         "   $1.writeObject(delegate);" +
-         "   $1.writeObject(mixins);" +
-         "   $1.writeObject(metadata);"+
-         "   $1.writeObject(classAdvisor.getClazz());" +
+         "   return new " + MarshalledContainerProxy.class.getName() + "(" +
+         "      this," +
+         "      this.key," +
+         "      this.mixins," +
+         "      this.delegate," +
+         "      this.currentAdvisor," +
+         "      this.metadata);" +
          "}";
-//       TODO add support for the instance advisors
    }
    
-   private String readObjectBody(CtClass superclass)
+   private String localUnmarshalObjectBody(CtClass superclass)
    {
       return 
          "{" +
-         "   delegate = (" + superclass.getName() + ")$1.readObject();" +
-         "   mixins = (Object[])$1.readObject();" +
-         "   metadata = (org.jboss.aop.metadata.SimpleMetaData)$1.readObject();" +
-         "   java.lang.Class clazz = (java.lang.Class)$1.readObject();" + 
-         "   org.jboss.aop.AspectManager manager = org.jboss.aop.AspectManager.getTopLevelAspectManager();" +
-         "   classAdvisor = manager.findAdvisor(clazz);" +
-         "   currentAdvisor = classAdvisor;" +
+//         "   try{" +
+         "      this.delegate = (" + superclass.getName() + ")$1.getDelegate();" +
+         "      this.mixins = $1.getMixins();" +
+         "      this.metadata = $1.getMetadata();" +
+         "      this.key = $1.getKey();" +
+         "      java.lang.Class clazz = $1.getClazz();" +
+         "      this.classAdvisor = org.jboss.aop.proxy.container.ContainerCache.getCachedContainer(this.key);" +
+         "      this.currentAdvisor = classAdvisor;" +
+         "      if ($1.getInstanceAdvisorDomainName() != null)" +
+         "      {" +
+         "         org.jboss.aop.proxy.container.ProxyAdvisorDomain domain = (org.jboss.aop.proxy.container.ProxyAdvisorDomain)org.jboss.aop.AspectManager.getTopLevelAspectManager().findManagerByName($1.getInstanceAdvisorDomainName());" +
+         "         this.currentAdvisor = domain.getAdvisor();" +
+         "         this.instanceAdvisor = this.currentAdvisor;" +
+         "      }" +
+//         "  }catch(java.lang.Exception e){throw e;}" +
          "}";
-       //TODO add support for instance advisors
    }
    
+   private String remoteUnmarshalObjectBody(CtClass superclass)
+   {
+      return 
+         "{" +
+         "   this.delegate = (" + superclass.getName() + ")$1.getDelegate();" +
+         "   this.mixins = $1.getMixins();" +
+         "   this.metadata = $1.getMetadata();" +
+         "   this.key = $1.getKey();" +
+         "   java.lang.Class clazz = $1.getClazz();" +
+         "   this.classAdvisor = $2;" +
+         "   this.currentAdvisor = $2;" +
+         "   this.instanceAdvisor = $2;" +
+         "}";
+   }
+   
    private String equalsBody()
    {
       return 
@@ -362,7 +417,7 @@
    {
       return addFieldFromTemplate(template, name, null);
    }
-
+   
    private CtField addFieldFromTemplate(CtClass template, String name, CtClass type) throws Exception
    {
       CtField templateField = template.getField(name);
@@ -379,6 +434,7 @@
       CtMethod method = CtNewMethod.make(templateMethod.getReturnType(), name, templateMethod.getParameterTypes(), templateMethod.getExceptionTypes(), body, proxy);
       method.setModifiers(templateMethod.getModifiers());
       proxy.addMethod(method);
+      hardcodedMethods.add(JavassistMethodHashing.methodHash(method));
       return method;
    }
    
@@ -464,41 +520,22 @@
    
    private void addMethodsAndMixins()throws Exception
    {
-      HashSet addedMethods = new HashSet();
+      HashSet<Long> addedMethods = new HashSet<Long>();
       createMixinsAndIntroductions(addedMethods);
       createProxyMethods(addedMethods);
    }
 
-   private void createMixinsAndIntroductions(HashSet addedMethods) throws Exception
+   private void createMixinsAndIntroductions(HashSet<Long> addedMethods) throws Exception
    {
-      HashSet addedInterfaces = new HashSet();
-      Set implementedInterfaces = interfacesAsSet();
+      HashSet<String> addedInterfaces = new HashSet<String>();
+      Set<String> implementedInterfaces = interfacesAsSet();
       
-      if (mixins != null)
+      if (proxyStrategy.hasIntroductions())
       {
-         HashMap intfs = new HashMap();
-         HashMap mixinIntfs = new HashMap();
-         ArrayList mixes = new ArrayList();
-         for (int i = 0; i < mixins.size(); i++)
-         {
-            InterfaceIntroduction introduction = (InterfaceIntroduction) mixins.get(i);
-            getIntroductionInterfaces(introduction, intfs, mixinIntfs, mixes, i);
-         }
-         if (mixes.size() > 0)
-         {
-            defaultCtor.insertAfter("mixins = new Object[" + mixes.size() + "];");
-            for (int i = 0; i < mixes.size(); i++)
-            {
-               //If using a constructor and passing "this" as the parameters, the proxy gets used. The delegate (instance wrapped by proxy) is not 
-               //set in the proxy until later, and if the mixin implements Delegate it will get set with the "real" instance at this point.
-               InterfaceIntroduction.Mixin mixin = (InterfaceIntroduction.Mixin) mixes.get(i);
-               String initializer = (mixin.getConstruction() == null) ? ("new " + mixin.getClassName() + "()") : mixin.getConstruction();
-               String code = "mixins[" + i + "] = " + initializer + ";";
-               defaultCtor.insertAfter(code);
-               setDelegateMethod.insertAfter("{if (org.jboss.aop.proxy.container.Delegate.class.isAssignableFrom(mixins[" + i + "].getClass())) " +
-                     "((org.jboss.aop.proxy.container.Delegate)mixins[" + i + "]).setDelegate($1);}");
-            }
-         }
+         HashMap<String, Integer> intfs = new HashMap<String, Integer>();
+         HashMap<String, Integer> mixinIntfs = new HashMap<String, Integer>();
+         ArrayList<MixinInfo> mixes = new ArrayList<MixinInfo>();
+         proxyStrategy.getMixins(intfs, mixinIntfs, mixes);
          
          //Now that we have added the mixins, add all the proxies methods to the added methods set
          HashMap allMethods = JavassistMethodHashing.getDeclaredMethodMap(proxy);
@@ -509,57 +546,13 @@
       }
    }
    
-   /**
-    * Split the interface introduction into something we can work with
-    * 
-    * @param intro The InterfaceIntroduction
-    * @param intfs receives the interfaces from plain interface introductions
-    * @param mixins receives the interfaces from mixins
-    * @param mixes receives the actual InterfaceIntroduction.Mixin objects
-    * @@param the index interface introduction this data comes from 
-    */
-   private void getIntroductionInterfaces(InterfaceIntroduction intro, HashMap intfs, HashMap mixins, ArrayList mixes, int idx)
+   
+   
+   private void createMixins(HashSet<Long> addedMethods, ArrayList<MixinInfo> mixes, HashSet<String> addedInterfaces, Set<String> implementedInterfaces) throws Exception
    {
-      Iterator it = intro.getMixins().iterator();
-      while (it.hasNext())
-      {
-         InterfaceIntroduction.Mixin mixin = (InterfaceIntroduction.Mixin) it.next();
-         mixes.add(mixin);
-         for (int i = 0; i < mixin.getInterfaces().length; i++)
-         {
-            if (intfs.containsKey(mixin.getInterfaces()[i]))
-            {
-               intfs.remove(mixin.getInterfaces()[i]);
-               
-            }
-            if (mixins.containsKey(mixin.getInterfaces()[i]))
-            {
-               throw new RuntimeException("cannot have an IntroductionInterface that introduces several mixins with the same interfaces " + mixin.getInterfaces()[i]);
-            }
-            mixins.put(mixin.getInterfaces()[i], new Integer(idx));
-         }
-      }
-      if (intro.getInterfaces() != null)
-      {
-         for (int i = 0; i < intro.getInterfaces().length; i++)
-         {
-            if (intfs.containsKey(intro.getInterfaces()[i]) || mixins.containsKey(intro.getInterfaces()[i])) 
-            {
-               //Do nothing
-            }
-            else
-            {
-               intfs.put(intro.getInterfaces()[i], new Integer(idx));
-            }
-         }
-      }
-   }
-
-   private void createMixins(HashSet addedMethods, ArrayList mixes, HashSet addedInterfaces, Set implementedInterfaces) throws Exception
-   {
       for (int mixinId = 0 ; mixinId < mixes.size() ; mixinId++)
       {
-         InterfaceIntroduction.Mixin mixin = (InterfaceIntroduction.Mixin)mixes.get(mixinId);
+         MixinInfo mixin = mixes.get(mixinId);
          
          String[] intfs = mixin.getInterfaces();
          
@@ -614,7 +607,7 @@
       }
    }
 
-   private void createProxyMethods(HashSet addedMethods) throws Exception
+   private void createProxyMethods(HashSet<Long> addedMethods) throws Exception
    {
       HashMap allMethods = JavassistMethodHashing.getMethodMap(proxy.getSuperclass());
 
@@ -627,6 +620,8 @@
 
          Long hash = (Long) entry.getKey();
          if (addedMethods.contains(hash)) continue;
+         if (hardcodedMethods.contains(hash)) continue;
+         
          addedMethods.add(hash);
          String aopReturnStr = (m.getReturnType().equals(CtClass.voidType)) ? "" : "return ($r)";
          String returnStr = (m.getReturnType().equals(CtClass.voidType)) ? "" : "return ";
@@ -678,7 +673,7 @@
       }
    }
    
-   private void createIntroductions(HashSet addedMethods, HashMap intfs, HashSet addedInterfaces, Set implementedInterfaces) throws Exception
+   private void createIntroductions(HashSet<Long> addedMethods, HashMap<String, Integer> intfs, HashSet<String> addedInterfaces, Set<String> implementedInterfaces) throws Exception
    {
       Iterator it = intfs.keySet().iterator();
       while (it.hasNext())
@@ -733,9 +728,9 @@
       }
    }
 
-   private Set interfacesAsSet() throws NotFoundException
+   private Set<String> interfacesAsSet() throws NotFoundException
    {
-      HashSet set = new HashSet();
+      HashSet<String> set = new HashSet<String>();
       CtClass[] interfaces = proxy.getInterfaces();
       
       for (int i = 0 ; i < interfaces.length ; i++)
@@ -893,4 +888,208 @@
          destFile.addAttribute(sig.copy(destFile.getConstPool(), new HashMap()));
       }
    }
+   
+   private interface ProxyStrategy
+   {
+      /**
+       * Whether the proxy has introductions and/or mixins
+       * @return true if we have introductions and/or mixins
+       */
+      boolean hasIntroductions();
+      
+      /**
+       * @param intfs receives the interfaces from plain interface introductions
+       * @param mixinInterfaces receives the interfaces from mixins
+       * @param mixes receives the actual InterfaceIntroduction.Mixin objects
+       */
+      void getMixins(HashMap<String, Integer>  intfs, HashMap<String, Integer>  mixins, ArrayList<MixinInfo> mixes) throws Exception;
+   }
+   
+   private class OriginalProxyStrategy implements ProxyStrategy
+   {
+      ArrayList<InterfaceIntroduction> mixins;
+      
+      OriginalProxyStrategy(ArrayList<InterfaceIntroduction> mixins)
+      {
+         this.mixins = mixins;
+      }
+      
+      public boolean hasIntroductions()
+      {
+         if (mixins == null)
+         {
+            return false;
+         }
+         return mixins.size() > 0;
+      }
+
+      public void getMixins(HashMap<String, Integer>  intfs, HashMap<String, Integer>  mixinInterfaces, ArrayList<MixinInfo> mixes) throws Exception
+      {
+         if (mixins != null)
+         {
+            HashMap mixinIntfs = new HashMap();
+            for (int i = 0; i < mixins.size(); i++)
+            {
+               InterfaceIntroduction introduction = mixins.get(i);
+               getIntroductionInterfaces(introduction, intfs, mixinIntfs, mixes, i);
+            }
+            if (mixes.size() > 0)
+            {
+               defaultCtor.insertAfter("mixins = new Object[" + mixes.size() + "];");
+               for (int i = 0; i < mixes.size(); i++)
+               {
+                  //If using a constructor and passing "this" as the parameters, the proxy gets used. The delegate (instance wrapped by proxy) is not 
+                  //set in the proxy until later, and if the mixin implements Delegate it will get set with the "real" instance at this point.
+                  MixinInfo mixin = mixes.get(i);
+                  String initializer = (mixin.getConstruction() == null) ? ("new " + mixin.getClassName() + "()") : mixin.getConstruction();
+                  String code = "mixins[" + i + "] = " + initializer + ";";
+                  defaultCtor.insertAfter(code);
+                  setDelegateMethod.insertAfter("{if (org.jboss.aop.proxy.container.Delegate.class.isAssignableFrom(mixins[" + i + "].getClass())) " +
+                        "((org.jboss.aop.proxy.container.Delegate)mixins[" + i + "]).setDelegate($1);}");
+               }
+            }
+         }
+      }
+      
+      /**
+       * Split the interface introduction into something we can work with
+       * 
+       * @param intro The InterfaceIntroduction
+       * @param intfs receives the interfaces from plain interface introductions
+       * @param mixinInterfaces receives the interfaces from mixins
+       * @param mixes receives the actual InterfaceIntroduction.Mixin objects
+       * @@param the index interface introduction this data comes from 
+       */
+      private void getIntroductionInterfaces(InterfaceIntroduction intro, 
+            HashMap<String, Integer> intfs, 
+            HashMap<String, Integer> mixinInterfaces, 
+            ArrayList<MixinInfo> mixes, 
+            int idx)
+      {
+         Iterator it = intro.getMixins().iterator();
+         while (it.hasNext())
+         {
+            InterfaceIntroduction.Mixin mixin = (InterfaceIntroduction.Mixin) it.next();
+            mixes.add(new MixinInfo(mixin));
+            for (int i = 0; i < mixin.getInterfaces().length; i++)
+            {
+               if (intfs.containsKey(mixin.getInterfaces()[i]))
+               {
+                  intfs.remove(mixin.getInterfaces()[i]);
+                  
+               }
+               if (mixinInterfaces.containsKey(mixin.getInterfaces()[i]))
+               {
+                  throw new RuntimeException("cannot have an IntroductionInterface that introduces several mixins with the same interfaces " + mixin.getInterfaces()[i]);
+               }
+               mixinInterfaces.put(mixin.getInterfaces()[i], new Integer(idx));
+            }
+         }
+         if (intro.getInterfaces() != null)
+         {
+            for (int i = 0; i < intro.getInterfaces().length; i++)
+            {
+               if (intfs.containsKey(intro.getInterfaces()[i]) || mixinInterfaces.containsKey(intro.getInterfaces()[i])) 
+               {
+                  //Do nothing
+               }
+               else
+               {
+                  intfs.put(intro.getInterfaces()[i], new Integer(idx));
+               }
+            }
+         }
+      }
+   }
+   
+   private class UnmarshalledInRemoteJVMProxyStrategy implements ProxyStrategy
+   {
+      MarshalledContainerProxy outOfVmProxy;
+      
+      UnmarshalledInRemoteJVMProxyStrategy(MarshalledContainerProxy outOfVmProxy)
+      {
+         this.outOfVmProxy = outOfVmProxy;
+      }
+      
+      public boolean hasIntroductions()
+      {
+         if (outOfVmProxy == null)
+         {
+            return false;
+         }
+         return outOfVmProxy.getIntroducedInterfaces().length > 0;
+      }
+      
+      public void getMixins(HashMap<String, Integer>  intfs, HashMap<String, Integer>  mixinInterfaces, ArrayList<MixinInfo> mixes) throws Exception
+      {
+         HashSet<String> allInterfaces = new HashSet<String>();
+         String[] introducedInterfaces = outOfVmProxy.getIntroducedInterfaces();
+         allInterfaces.addAll(Arrays.asList(introducedInterfaces));
+         
+         Set<String> targetInterfaces = outOfVmProxy.getTargetInterfaces();
+         Object[] mixins = outOfVmProxy.getMixins();
+         int i = 0;
+         for ( ; i < mixins.length ; i++)
+         {
+            Class clazz = mixins[i].getClass();
+            Class[] ifs = clazz.getInterfaces(); 
+            ArrayList<String> interfaces = new ArrayList<String>(ifs.length);
+            for (Class iface : ifs)
+            {
+               String name = iface.getName();
+               if (name.equals(Serializable.class.getName()) || 
+                     name.equals(Externalizable.class.getName()) || 
+                     targetInterfaces.contains(name))
+               {
+                  continue;
+               }
+               interfaces.add(name);
+               allInterfaces.remove(name);
+               mixinInterfaces.put(name, i);
+            }
+            MixinInfo info = new MixinInfo(clazz.getName(), interfaces);
+            mixes.add(info);
+         }
+         
+         for (String iface : allInterfaces)
+         {
+            intfs.put(iface, ++i);
+         }
+      }
+   }
+   
+   private static class MixinInfo
+   {
+      String[] interfaces;
+      String className;
+      String construction;
+      
+      MixinInfo(InterfaceIntroduction.Mixin mixin)
+      {
+         this.interfaces = mixin.getInterfaces();
+         this.className = mixin.getClassName();
+         this.construction = mixin.getConstruction();
+      }
+      
+      MixinInfo(String className, ArrayList<String> interfaces)
+      {
+         this.className = className;
+         this.interfaces = interfaces.toArray(new String[interfaces.size()]);
+      }
+      
+      protected String[] getInterfaces()
+      {
+         return interfaces;
+      }
+
+      protected String getClassName()
+      {
+         return className;
+      }
+
+      protected String getConstruction()
+      {
+         return construction;
+      }
+   }
 }   

Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/proxy/container/Delegate.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/proxy/container/Delegate.java	2008-03-24 03:08:33 UTC (rev 71183)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/proxy/container/Delegate.java	2008-03-24 03:41:24 UTC (rev 71184)
@@ -28,6 +28,9 @@
  */
 public interface Delegate
 {
-   public Object getDelegate();
-   public void setDelegate(Object delegate);
+   Object getDelegate();
+   void setDelegate(Object delegate);
+   void setContainerProxyCacheKey(ContainerProxyCacheKey key);
+   void localUnmarshal(MarshalledContainerProxy proxy);
+   void remoteUnmarshal(MarshalledContainerProxy proxy, MarshalledProxyAdvisor advisor);
 }

Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/proxy/container/GeneratedAOPProxyFactory.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/proxy/container/GeneratedAOPProxyFactory.java	2008-03-24 03:08:33 UTC (rev 71183)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/proxy/container/GeneratedAOPProxyFactory.java	2008-03-24 03:41:24 UTC (rev 71184)
@@ -89,7 +89,7 @@
    {
       try
       {
-         Class proxyClass = null;
+         Class<?> proxyClass = null;
 
          boolean isAdvised = Advised.class.isAssignableFrom(params.getProxiedClass());
 
@@ -125,20 +125,19 @@
       }
    }
 
-   private Class generateProxy(AOPProxyFactoryParameters params) throws Exception
+   private Class<?> generateProxy(AOPProxyFactoryParameters params) throws Exception
    {
-      Class proxyClass = ContainerProxyFactory.getProxyClass(params.isObjectAsSuperClass(), params.getContainerCache().getKey(), params.getContainerCache().getAdvisor());
+      Class<?> proxyClass = ContainerProxyFactory.getProxyClass(params.isObjectAsSuperClass(), params.getContainerCache().getKey(), params.getContainerCache().getAdvisor());
 
       return proxyClass;
    }
 
-//   private Object instantiateAndConfigureProxy(Class proxyClass, ContainerCache cache, SimpleMetaData metadata, Object target, Constructor ctor, Object[] ctorArguments) throws Exception
-   private Object instantiateAndConfigureProxy(Class proxyClass, AOPProxyFactoryParameters params) throws Exception
+   private Object instantiateAndConfigureProxy(Class<?> proxyClass, AOPProxyFactoryParameters params) throws Exception
    {
       AspectManaged proxy;
       if (params.getCtor() != null)
       {
-         Constructor ctor = proxyClass.getConstructor(params.getCtor().getSignature());
+         Constructor<?> ctor = proxyClass.getConstructor(params.getCtor().getSignature());
          proxy = (AspectManaged)ctor.newInstance(params.getCtor().getArguments());
       }
       else
@@ -166,6 +165,7 @@
       {
          ((Delegate)proxy).setDelegate(new Object());
       }
+      ((Delegate)proxy).setContainerProxyCacheKey(params.getContainerCache().getKey());
 
       return proxy;
    }

Copied: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/proxy/container/MarshalledAdvice.java (from rev 71182, projects/aop/trunk/aop/src/main/org/jboss/aop/proxy/container/MarshalledAdvice.java)
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/proxy/container/MarshalledAdvice.java	                        (rev 0)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/proxy/container/MarshalledAdvice.java	2008-03-24 03:41:24 UTC (rev 71184)
@@ -0,0 +1,94 @@
+/*
+* JBoss, Home of Professional Open Source.
+* Copyright 2006, Red Hat Middleware LLC, and individual contributors
+* as indicated by the @author tags. See the copyright.txt file in the
+* distribution for a full listing of individual contributors. 
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/ 
+package org.jboss.aop.proxy.container;
+
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.Serializable;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+
+import org.jboss.aop.advice.AbstractAdvice;
+import org.jboss.aop.joinpoint.Invocation;
+
+class MarshalledAdvice extends AbstractAdvice implements Serializable
+{
+   private Object aspect;
+   private String name;
+   private volatile boolean initialised = false;
+
+   public MarshalledAdvice(Object aspect, String name, String adviceName)
+   {
+      this.aspect = aspect;
+      this.name = name;
+      super.adviceName = adviceName;
+      super.aspectClass = aspect.getClass();
+   }
+   
+   @Override
+   public Object getAspectInstance()
+   {
+      return aspect;
+   }
+
+   public String getName()
+   {
+      return name;
+   }
+
+   public Object invoke(Invocation invocation) throws Throwable
+   {
+      if (!initialised)
+      {
+         super.init(adviceName, aspect.getClass());
+         initialised = true;
+      }
+      Method advice = resolveAdvice(invocation);
+      Object[] args = {invocation};
+      
+      try
+      {
+         return advice.invoke(aspect, args);
+      }
+      catch (InvocationTargetException e)
+      {
+         throw e.getCause();  //To change body of catch statement use Options | File Templates.
+      }
+   }
+   
+   private void writeObject(ObjectOutputStream out) throws IOException
+   {
+      out.writeUTF(name);
+      out.writeUTF(super.adviceName);
+      out.writeObject(aspect);
+      out.writeObject(super.aspectClass);
+   }
+   
+   private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException
+   {
+      name = in.readUTF();
+      super.adviceName = in.readUTF();
+      aspect = in.readObject();
+      super.aspectClass = (Class)in.readObject();
+   }
+}
\ No newline at end of file

Copied: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/proxy/container/MarshalledContainerProxy.java (from rev 71182, projects/aop/trunk/aop/src/main/org/jboss/aop/proxy/container/MarshalledContainerProxy.java)
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/proxy/container/MarshalledContainerProxy.java	                        (rev 0)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/proxy/container/MarshalledContainerProxy.java	2008-03-24 03:41:24 UTC (rev 71184)
@@ -0,0 +1,474 @@
+/*
+* JBoss, Home of Professional Open Source.
+* Copyright 2006, Red Hat Middleware LLC, and individual contributors
+* as indicated by the @author tags. See the copyright.txt file in the
+* distribution for a full listing of individual contributors. 
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/ 
+package org.jboss.aop.proxy.container;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InvalidObjectException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.ObjectStreamException;
+import java.io.Serializable;
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.jboss.aop.Advisor;
+import org.jboss.aop.AspectManager;
+import org.jboss.aop.InstanceAdvisor;
+import org.jboss.aop.MethodInfo;
+import org.jboss.aop.advice.AbstractAdvice;
+import org.jboss.aop.advice.Interceptor;
+import org.jboss.aop.advice.PerInstanceAdvice;
+import org.jboss.aop.advice.PerInstanceInterceptor;
+import org.jboss.aop.advice.PerJoinpointAdvice;
+import org.jboss.aop.advice.PerJoinpointInterceptor;
+import org.jboss.aop.instrument.Untransformable;
+import org.jboss.aop.metadata.SimpleMetaData;
+import org.jboss.aop.util.MethodHashing;
+import org.jboss.util.id.GUID;
+
+/**
+ * 
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public class MarshalledContainerProxy implements Serializable
+{
+   private static final long serialVersionUID = 1L;
+
+   //Fields to check if we are unmarshalling in the same JVM
+   public final static GUID GUID = new GUID();
+   
+   private transient AspectManaged proxyInstance;
+   
+   //Fields from the proxy, used when unmarshalling in the same JVM
+   private String proxyClassName;
+   private ContainerProxyCacheKey key;
+   private Object mixins[];
+   private Object delegate;
+   private Class clazz;
+   private SimpleMetaData metadata;
+   
+   //Interfaces resulting from a mixin or interface introduction
+   private String[] introducedInterfaces;
+   
+   //Interfaces implemented by mixins that are already implemented by the target class
+   private Set<String> targetInterfaces = new HashSet<String>();
+   
+   //The interceptor chains for each method used when unmarshalling in a different JVM
+   MarshalledInterceptors marshalledInterceptors;
+
+   //The instanceAdvisor domain name used when unmarshalling in a different JVM
+   private String instanceAdvisorDomainName;
+   
+   public MarshalledContainerProxy(AspectManaged proxyInstance, ContainerProxyCacheKey key, Object[] mixins, Object delegate, Advisor currentAdvisor, SimpleMetaData metadata)
+   {
+      this.proxyInstance = proxyInstance;
+      Class proxyClass = proxyInstance.getClass();
+      this.proxyClassName = proxyClass.getName();
+      this.key = key;
+      this.mixins = mixins;
+      this.delegate = delegate;
+      this.clazz = currentAdvisor.getClazz();
+
+      checkInstanceAdvisor(currentAdvisor);
+      this.metadata = metadata;
+
+      marshalledInterceptors = new MarshalledInterceptors(currentAdvisor, mixins);
+      
+      Class[] proxyInterfaces = proxyClass.getInterfaces();
+      ArrayList<String> ifs = new ArrayList<String>();
+      for (int i = 0 ; i < proxyInterfaces.length ; i++)
+      {
+         String name = proxyInterfaces[i].getName();
+         if (name.equals(Untransformable.class.getName()) || 
+               name.equals(Delegate.class.getName()) ||
+               name.equals(AspectManaged.class.getName()))
+         {
+            continue;
+         }
+         if (proxyInterfaces[i].isAssignableFrom(clazz))
+         {
+            targetInterfaces.add(clazz.getName());
+            continue;
+         }
+         ifs.add(proxyInterfaces[i].getName());
+      }
+      introducedInterfaces = ifs.toArray(new String[ifs.size()]);
+   }
+   
+   private void checkInstanceAdvisor(Advisor advisor)
+   {
+      if (advisor instanceof InstanceProxyContainer)
+      {
+         AspectManager manager = advisor.getManager();
+         instanceAdvisorDomainName = manager.getManagerFQN();
+      }
+   }
+   
+   public Object readResolve() throws ObjectStreamException
+   {
+      try
+      {
+         if (isLocal())
+         {
+            return localReadResolve();
+         }
+         return remoteReadResolve();
+      }
+      catch (Exception e)
+      {
+         InvalidObjectException ex = new InvalidObjectException(e.getMessage());
+         ex.setStackTrace(e.getStackTrace());
+         ex.initCause(e);
+         throw ex;
+      }
+   }   
+   
+   private Object localReadResolve() throws Exception
+   {
+      ClassLoader tcl = SecurityActions.getContextClassLoader();
+      Class proxyClass = tcl.loadClass(proxyClassName);
+      Object proxy = proxyClass.newInstance();
+      Delegate delegate = (Delegate)proxy;
+      delegate.localUnmarshal(this);
+      return proxy;
+   }
+   
+   private Object remoteReadResolve() throws Exception
+   {
+      if (marshalledInterceptors.getException() != null)
+      {
+         throw new Exception("Could not read object, an error happened when writing it on the server", marshalledInterceptors.getException());
+      }
+      
+      MarshalledProxyAdvisor advisor = marshalledInterceptors.getMarshalledAdvisor();
+      advisor.setClazz(clazz);
+
+      boolean objectAsSuper = key.getClazz().equals(Object.class);
+      Class proxyClass = ContainerProxyFactory.getProxyClass(objectAsSuper, key, advisor, this);
+   
+      Delegate proxy = (Delegate)proxyClass.newInstance();
+      proxy.remoteUnmarshal(this, advisor);
+      return proxy;
+   }
+   
+   private boolean isLocal()
+   {
+      return key.getGuid().equals(GUID);
+   }
+
+   public ContainerProxyCacheKey getKey()
+   {
+      return key;
+   }
+   
+   public Object[] getMixins()
+   {
+      return mixins;
+   }
+
+   public Object getDelegate()
+   {
+      return delegate;
+   }
+
+   public Class getClazz()
+   {
+      return clazz;
+   }
+
+   public SimpleMetaData getMetadata()
+   {
+      return metadata;
+   }
+
+   public String getInstanceAdvisorDomainName()
+   {
+      return instanceAdvisorDomainName;
+   }
+
+   protected String[] getIntroducedInterfaces()
+   {
+      return introducedInterfaces;
+   }
+
+   protected Set<String> getTargetInterfaces()
+   {
+      return targetInterfaces;
+   }
+   
+   private class MarshalledInterceptors implements Serializable
+   {
+      private static final long serialVersionUID = 1L;
+      transient Advisor currentAdvisor;
+      Object[] mixins;
+      private Exception exception;
+
+      public MarshalledInterceptors(Advisor currentAdvisor, Object[] mixins)
+      {
+         this.currentAdvisor = currentAdvisor;
+         this.mixins = mixins;
+      }
+      
+      public Exception getException()
+      {
+         return exception;
+      }
+      
+      public MarshalledProxyAdvisor getMarshalledAdvisor()
+      {
+         return (MarshalledProxyAdvisor)currentAdvisor;
+      }
+      
+      private void writeObject(ObjectOutputStream out) throws IOException
+      {
+         ObjectOutputStream test = new ObjectOutputStream(new ByteArrayOutputStream());
+         try
+         {
+            MethodInfo[] methodInfos = getMethodInfos();
+            MarshalledMethodInfo[] marshalledInfos = new MarshalledMethodInfo[methodInfos.length];
+
+            boolean requiresInstanceAdvisor = false;
+            for (int i = 0 ; i < methodInfos.length ; i++)
+            {
+               MarshalledMethodInfo info = new MarshalledMethodInfo(MarshalledContainerProxy.this, methodInfos[i]);
+
+               marshalledInfos[i] = info;
+               try
+               {
+                  test.writeObject(info);
+                  continue;
+               }
+               catch (Exception e)
+               {
+                  IOException ex = new IOException("An error happened serializing the info for " + getExceptionExpression(methodInfos[i]));
+                  ex.initCause(e);
+                  out.writeObject(ex);
+                  return;
+               }
+            }
+            out.writeObject(marshalledInfos);
+         }
+         finally
+         {
+            try
+            {
+               test.close();
+            }
+            catch (Exception e)
+            {
+            }
+         }
+      }
+      
+      private MethodInfo[] getMethodInfos()
+      {
+         if (currentAdvisor instanceof MarshalledProxyAdvisor)
+         {
+            return ((MarshalledProxyAdvisor)currentAdvisor).getMethodInfos();
+         }
+         return ((ClassProxyContainer)currentAdvisor).getMethodInfos();
+      }
+      
+      private String getExceptionExpression(MethodInfo info)
+      {
+         Method m = info.getMethod();
+         StringBuilder expr = new StringBuilder();
+         if (m == null)
+         {
+            expr.append("a method");
+         }
+         else
+         {
+            expr.append(m.getDeclaringClass().getName());
+            expr.append(".");
+            expr.append(m.getName());
+            expr.append("(");
+            boolean first = true;
+            for (Class c : m.getParameterTypes())
+            {
+               if (first)
+               {
+                  first = false;
+               }
+               else
+               {
+                  expr.append(", ");
+               }
+               expr.append(c.getName());
+            }
+            expr.append(")");
+         }
+         return expr.toString();
+      }
+      
+      private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException
+      {
+          Object o = in.readObject();
+          if (o instanceof IOException)
+          {
+             exception = (IOException)o;
+             return;
+          }
+          
+          MarshalledProxyAdvisor advisor = new MarshalledProxyAdvisor("Unmarshalled", AspectManager.getTopLevelAspectManager());
+          MarshalledMethodInfo[] marshalledInfos = (MarshalledMethodInfo[])o;
+          MethodInfo[] methodInfos = new MethodInfo[marshalledInfos.length];
+          for (int i = 0 ; i < marshalledInfos.length ; i++)
+          {
+             methodInfos[i] = marshalledInfos[i].getMethodInfo(advisor);
+             advisor.addMethodInfo(methodInfos[i]);
+          }
+          currentAdvisor = advisor;
+      }
+   }
+      
+      
+   private static class MarshalledMethodInfo implements Serializable
+   {
+      transient MarshalledContainerProxy proxy;
+      long advisedHash;
+      long unadvisedHash;
+      Interceptor[] interceptors;
+      Class clazz;
+      transient boolean requiresInstanceAdvisor;
+      
+      public MarshalledMethodInfo(MarshalledContainerProxy proxy, MethodInfo info) throws IOException
+      {
+         this.proxy = proxy;
+         try
+         {
+            this.advisedHash = MethodHashing.methodHash(info.getMethod());
+            this.unadvisedHash = MethodHashing.methodHash(info.getUnadvisedMethod());
+         }
+         catch (Exception e)
+         {
+            throw new MethodHashingException(e);
+         }
+         clazz = info.getMethod().getDeclaringClass();
+         populateInterceptors(info);
+      }
+      
+      public boolean getRequiresInstanceAdvisor()
+      {
+         return requiresInstanceAdvisor;
+      }
+      
+      private void populateInterceptors(MethodInfo info)
+      {
+         Interceptor[] icptrs = info.getInterceptors();
+         if (icptrs != null)
+         {
+            ArrayList<Interceptor> allIcptrs = new ArrayList<Interceptor>(icptrs.length);
+            
+            for (int i = 0 ; i < icptrs.length ; i++)
+            {
+               if (icptrs[i] instanceof AbstractAdvice == false)
+               {
+                  Interceptor icptr = null;
+                  if (icptrs[i] instanceof PerInstanceInterceptor && !Modifier.isStatic(info.getMethod().getModifiers()))
+                  {
+                     requiresInstanceAdvisor = true;
+                     InstanceAdvisor ia = getProxyInstanceAdvisor();
+                     icptr = ((PerInstanceInterceptor)icptrs[i]).getAspectInstance(ia);
+                  }
+                  else if (icptrs[i] instanceof PerJoinpointInterceptor && !Modifier.isStatic(info.getMethod().getModifiers()))
+                  {
+                     requiresInstanceAdvisor = true;
+                     InstanceAdvisor ia = getProxyInstanceAdvisor();
+                     icptr = ((PerJoinpointInterceptor)icptrs[i]).getAspectInstance(ia);
+                  }
+                  else
+                  {
+                     icptr = icptrs[i];
+                  }
+                  allIcptrs.add(icptr);
+               }
+               else
+               {
+                  AbstractAdvice advice = (AbstractAdvice)icptrs[i];
+                  Object aspectInstance = null;
+                  if (icptrs[i] instanceof PerInstanceAdvice && !Modifier.isStatic(info.getMethod().getModifiers()))
+                  {
+                     requiresInstanceAdvisor = true;
+                     InstanceAdvisor ia = getProxyInstanceAdvisor();
+                     aspectInstance = ((PerInstanceAdvice)advice).getAspectInstance(ia);
+                  }
+                  else if (icptrs[i] instanceof PerJoinpointAdvice && !Modifier.isStatic(info.getMethod().getModifiers()))
+                  {
+                     requiresInstanceAdvisor = true;
+                     InstanceAdvisor ia = getProxyInstanceAdvisor();
+                     aspectInstance = ((PerJoinpointAdvice)advice).getAspectInstance(ia);
+                  } 
+                  else 
+                  {
+                     aspectInstance = advice.getAspectInstance();
+                  }
+                  
+                  if (aspectInstance != null)
+                  {
+                     MarshalledAdvice ma = new MarshalledAdvice(aspectInstance, icptrs[i].getName(), advice.getAdviceName());
+                     allIcptrs.add(ma);
+                  }
+               }
+            }
+            interceptors = allIcptrs.toArray(new Interceptor[allIcptrs.size()]);
+         }
+      }
+      
+      private InstanceAdvisor getProxyInstanceAdvisor()
+      {
+         InstanceAdvisor ia = proxy.proxyInstance.getInstanceAdvisor();
+         proxy.checkInstanceAdvisor((InstanceProxyContainer)ia);
+         return ia;
+      }
+      
+      public MethodInfo getMethodInfo(Advisor advisor)
+      {
+         MethodInfo info = new MethodInfo(clazz, advisedHash, unadvisedHash, advisor);
+         info.setInterceptors(interceptors);
+         return info;
+      }
+      
+      public String toString()
+      {
+         return advisedHash + " " + ((interceptors == null) ? "null" : Arrays.asList(interceptors));
+      }
+   }
+      
+   private static class MethodHashingException extends IOException
+   {
+      private static final long serialVersionUID = 1L;
+
+      MethodHashingException(Exception e)
+      {
+         super("Error hashing method");
+         super.initCause(e);
+      }
+   }
+
+}
\ No newline at end of file

Deleted: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/proxy/container/MarshalledProxy.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/proxy/container/MarshalledProxy.java	2008-03-24 03:08:33 UTC (rev 71183)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/proxy/container/MarshalledProxy.java	2008-03-24 03:41:24 UTC (rev 71184)
@@ -1,63 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/ 
-package org.jboss.aop.proxy.container;
-
-import java.io.ObjectStreamException;
-import java.io.Serializable;
-
-import org.jboss.aop.InstanceAdvisor;
-
-/**
- * 
- * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
- * @version $Revision$
- */
-public class MarshalledProxy implements Serializable
-{
-   private ContainerProxyCacheKey key;
-   private InstanceAdvisor instanceAdvisor;
-
-   public MarshalledProxy()
-   {
-   }
-   
-   public MarshalledProxy(ContainerProxyCacheKey key, InstanceAdvisor instanceAdvisor)
-   {
-      this.key = key;
-      this.instanceAdvisor = instanceAdvisor;
-   }
-
-   public Object readResolve() throws ObjectStreamException
-   {
-      try
-      {
-         //TODO Eventually we should get the correct domain, and not use the aspect manager instance
-         return ContainerProxyFactory.getProxyClass(false, key, null);
-      }
-      catch (Exception e)
-      {
-         throw new RuntimeException(e);
-      }
-   }
-
-
-}

Copied: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/proxy/container/MarshalledProxyAdvisor.java (from rev 71182, projects/aop/trunk/aop/src/main/org/jboss/aop/proxy/container/MarshalledProxyAdvisor.java)
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/proxy/container/MarshalledProxyAdvisor.java	                        (rev 0)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/proxy/container/MarshalledProxyAdvisor.java	2008-03-24 03:41:24 UTC (rev 71184)
@@ -0,0 +1,190 @@
+/*
+* JBoss, Home of Professional Open Source.
+* Copyright 2006, Red Hat Middleware LLC, and individual contributors
+* as indicated by the @author tags. See the copyright.txt file in the
+* distribution for a full listing of individual contributors. 
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/ 
+package org.jboss.aop.proxy.container;
+
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+
+import gnu.trove.TLongObjectHashMap;
+
+import org.jboss.aop.Advisor;
+import org.jboss.aop.AspectManager;
+import org.jboss.aop.Domain;
+import org.jboss.aop.InstanceAdvisor;
+import org.jboss.aop.MethodInfo;
+import org.jboss.aop.advice.AbstractAdvice;
+import org.jboss.aop.advice.AspectDefinition;
+import org.jboss.aop.advice.Interceptor;
+import org.jboss.aop.joinpoint.Invocation;
+import org.jboss.aop.joinpoint.Joinpoint;
+import org.jboss.aop.metadata.ClassMetaDataBinding;
+import org.jboss.aop.metadata.SimpleMetaData;
+
+/**
+ * The advisor used by a container proxy that is unmarshalled in a remote jvm
+ * 
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public class MarshalledProxyAdvisor extends Advisor implements InstanceAdvisor
+{
+   TLongObjectHashMap methodInfos = new TLongObjectHashMap();
+   Object instance;
+   
+   public MarshalledProxyAdvisor(String name, AspectManager manager)
+   {
+      super(name, manager);
+   }
+
+   public void setClazz(Class clazz)
+   {
+      super.clazz = clazz;
+   }
+   
+   public void addMethodInfo(MethodInfo info)
+   {
+      methodInfos.put(info.getHash(), info);
+   }
+   
+   public void setInstance(Object instance)
+   {
+      this.instance = instance;
+   }
+   
+   @Override
+   public void addClassMetaData(ClassMetaDataBinding data)
+   {
+      throw new RuntimeException("Not yet implemented");
+   }
+
+   @Override
+   protected void rebuildInterceptors()
+   {
+      //Noop, all interceptors are added via addMethodInfo
+   }
+
+   @Override
+   public void removeClassMetaData(ClassMetaDataBinding data)
+   {
+      throw new RuntimeException("Not yet implemented");
+   }
+   
+   @Override
+   public MethodInfo getMethodInfo(long hash)
+   {
+      MethodInfo info = (MethodInfo)methodInfos.get(hash);
+      return info;
+   }
+   
+   public MethodInfo[] getMethodInfos()
+   {
+      Object[] vals = methodInfos.getValues();
+      MethodInfo[] infos = new MethodInfo[vals.length];
+      System.arraycopy(vals, 0, infos, 0, vals.length);
+      return infos;
+   }
+
+   public void appendInterceptor(Interceptor interceptor)
+   {
+      throw new RuntimeException("Not yet implemented");
+   }
+
+   public void appendInterceptor(int index, Interceptor interceptor) throws IndexOutOfBoundsException
+   {
+      throw new RuntimeException("Not yet implemented");
+   }
+
+   public void appendInterceptorStack(String stackName)
+   {
+      throw new RuntimeException("Not yet implemented");
+   }
+
+   public Domain getDomain()
+   {
+      return null;
+   }
+
+   public Object getInstance()
+   {
+      return instance;
+   }
+
+   public Interceptor[] getInterceptors()
+   {
+      throw new RuntimeException("Not yet implemented");
+   }
+
+   public Interceptor[] getInterceptors(Interceptor[] baseChain)
+   {
+      throw new RuntimeException("Not yet implemented");
+   }
+
+   public SimpleMetaData getMetaData()
+   {
+      return null;
+   }
+
+   public Object getPerInstanceAspect(String aspectName)
+   {
+      throw new RuntimeException("Not yet implemented");
+   }
+
+   public Object getPerInstanceAspect(AspectDefinition def)
+   {
+      throw new RuntimeException("Not yet implemented");
+   }
+
+   public Object getPerInstanceJoinpointAspect(Joinpoint joinpoint, AspectDefinition def)
+   {
+      throw new RuntimeException("Not yet implemented");
+   }
+
+   public boolean hasInterceptors()
+   {
+      return false;
+   }
+
+   public void insertInterceptor(Interceptor interceptor)
+   {
+      throw new RuntimeException("Not yet implemented");
+   }
+
+   public void insertInterceptor(int index, Interceptor interceptor) throws IndexOutOfBoundsException
+   {
+      throw new RuntimeException("Not yet implemented");
+   }
+
+   public void insertInterceptorStack(String stackName)
+   {
+      throw new RuntimeException("Not yet implemented");
+   }
+
+   public void removeInterceptor(String name)
+   {
+      throw new RuntimeException("Not yet implemented");
+   }
+
+   public void removeInterceptorStack(String name)
+   {
+      throw new RuntimeException("Not yet implemented");
+   }
+}

Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/proxy/container/ProxyTemplate.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/proxy/container/ProxyTemplate.java	2008-03-24 03:08:33 UTC (rev 71183)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/proxy/container/ProxyTemplate.java	2008-03-24 03:41:24 UTC (rev 71184)
@@ -22,11 +22,13 @@
 package org.jboss.aop.proxy.container;
 
 import java.io.IOException;
+import java.io.ObjectStreamException;
 
 import org.jboss.aop.Advisor;
 import org.jboss.aop.AspectManager;
 import org.jboss.aop.InstanceAdvisor;
 import org.jboss.aop.metadata.SimpleMetaData;
+import org.jboss.util.id.GUID;
 
 /**
  * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
@@ -46,8 +48,8 @@
    private Object delegate;
    private Object[] mixins; // Do not remove this
    private SimpleMetaData metadata;
+   private ContainerProxyCacheKey key;
 
-
    public Object getDelegate()
    {
       return delegate;
@@ -58,6 +60,11 @@
       this.delegate = delegate;
    }
 
+   public void setContainerProxyCacheKey(ContainerProxyCacheKey key)
+   {
+      this.key = key;
+   }
+   
    public Advisor getAdvisor()
    {
       return currentAdvisor;
@@ -134,34 +141,44 @@
          return super.toString() + "(empty proxy of " + this.getClass().getSuperclass().getName() + ")";
    }
    
-//   "{" +
-//   "   if (delegate != null)" +
-//   "      return delegate.toString() + \" (proxied by \" + this.getClass().getName() + \"@\" + java.lang.Integer.toHexString(java.lang.System.identityHashCode(this)) + \")\";" +
-//   "   else" +
-//   "      return super.toString() + \" (empty proxy of \" + this.getClass().getSuperclass().getName() + \")\";" +
-//   "}";
-
+   private Object writeReplace() throws ObjectStreamException
+   {
+      return new MarshalledContainerProxy(
+            this, 
+            this.key,
+            this.mixins, 
+            this.delegate, 
+            this.currentAdvisor,
+            this.metadata);
+   }
    
-   private void writeObject(java.io.ObjectOutputStream out) throws IOException
+   public void localUnmarshal(MarshalledContainerProxy proxy) 
    {
-      out.writeObject(delegate);
-      out.writeObject(mixins);
-      out.writeObject(metadata);
-      out.writeObject(classAdvisor.getClazz());
-      //TODO add support for the instance advisors
+      this.delegate = proxy.getDelegate();
+      this.mixins = proxy.getMixins();
+      this.metadata = proxy.getMetadata();
+      this.key = proxy.getKey();
+
+      Class clazz = proxy.getClazz();
+      this.classAdvisor = ContainerCache.getCachedContainer(this.key);
+      this.currentAdvisor = classAdvisor;
+      
+      if (proxy.getInstanceAdvisorDomainName() != null)
+      {
+         ProxyAdvisorDomain domain = (ProxyAdvisorDomain)AspectManager.getTopLevelAspectManager().findManagerByName(proxy.getInstanceAdvisorDomainName());
+         this.currentAdvisor = domain.getAdvisor();
+      }
    }
    
-   private void readObject(java.io.ObjectInputStream in) throws IOException, ClassNotFoundException
+   public void remoteUnmarshal(MarshalledContainerProxy proxy, MarshalledProxyAdvisor advisor)
    {
-      delegate = in.readObject();
-      mixins = (Object[])in.readObject();
-      metadata = (SimpleMetaData)in.readObject();
+      this.delegate = proxy.getDelegate();
+      this.mixins = proxy.getMixins();
+      this.metadata = proxy.getMetadata();
+      this.key = proxy.getKey();
       
-      Class clazz = (Class)in.readObject();
-      AspectManager manager = AspectManager.getTopLevelAspectManager();
-      classAdvisor = manager.findAdvisor(clazz);
-      currentAdvisor = classAdvisor;
-      //TODO add support for instance advisors
-      
+      this.classAdvisor = advisor;
+      this.currentAdvisor = advisor;
+      this.instanceAdvisor = advisor;
    }
 }

Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/proxy/container/SecurityActions.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/proxy/container/SecurityActions.java	2008-03-24 03:08:33 UTC (rev 71183)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/proxy/container/SecurityActions.java	2008-03-24 03:41:24 UTC (rev 71184)
@@ -33,7 +33,7 @@
 class SecurityActions
 {
    
-   public static class GetContextClassLoaderAction implements PrivilegedAction<ClassLoader>
+   static class GetContextClassLoaderAction implements PrivilegedAction<ClassLoader>
    {
       public static GetContextClassLoaderAction INSTANCE = new GetContextClassLoaderAction();
       

Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/reflection/ReflectionAspect.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/reflection/ReflectionAspect.java	2008-03-24 03:08:33 UTC (rev 71183)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/reflection/ReflectionAspect.java	2008-03-24 03:41:24 UTC (rev 71184)
@@ -36,6 +36,7 @@
 import org.jboss.aop.joinpoint.MethodCalledByConstructorInvocation;
 import org.jboss.aop.joinpoint.MethodCalledByMethodInvocation;
 import org.jboss.aop.util.MethodHashing;
+import org.jboss.aop.util.ReflectUtils;
 
 import java.lang.reflect.Constructor;
 import java.lang.reflect.Field;
@@ -81,8 +82,6 @@
    private static Pattern fieldSetPattern =
    Pattern.compile("set(|Boolean|Byte|Char|Double|Float|Int|Long|Short)?");
 
-   private static Pattern accessMethodPattern = Pattern.compile("access[$](\\d)+");
-   
    // Constructors --------------------------------------------------
    
    public ReflectionAspect()
@@ -874,7 +873,7 @@
          for (int i = 0; i < advisedMethods.length; i++)
          {
             Method m = (Method) advisedMethods[i];
-            if (clazz.equals(m.getDeclaringClass()) && isNotAccessMethod(m) && isNotJavassistWrappedMethod(m))
+            if (clazz.equals(m.getDeclaringClass()) && ReflectUtils.isNotAccessMethod(m) && isNotJavassistWrappedMethod(m))
             {
                methods.add(m);
             }
@@ -901,7 +900,7 @@
          for (int i = 0; i < advisedMethods.length; i++)
          {
             Method m = (Method) advisedMethods[i];
-            if (m.equals(method) && isNotAccessMethod(m) && isNotJavassistWrappedMethod(m))
+            if (m.equals(method) && ReflectUtils.isNotAccessMethod(m) && isNotJavassistWrappedMethod(m))
             {
                return method;
             }
@@ -911,30 +910,6 @@
       throw new NoSuchMethodException();
    }
 
-   
-   /**
-    * Java adds a few static void methods called access$0, access$1 etc. when inner classes are used
-    *
-    * @return true if this method is static, void, has package access and has a name like access$0, access$1 etc.
-    */
-   private boolean isNotAccessMethod(Method m)
-   {
-
-      //TODO: Normally access methods should return void, but having optimised field invocation
-      //it seems that javassist occasionally creates these methods with other return types
-
-      if (Modifier.isStatic(m.getModifiers()))
-      {
-         Matcher match = accessMethodPattern.matcher(m.getName());
-         if (match.matches())
-         {
-            return false;
-         }
-      }
-
-      return true;
-   }
-
    private boolean isNotJavassistWrappedMethod(Method m)
    {
       if (Modifier.isPrivate(m.getModifiers()) && !Modifier.isStatic(m.getModifiers()))

Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/standalone/AOPTransformer.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/standalone/AOPTransformer.java	2008-03-24 03:08:33 UTC (rev 71183)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/standalone/AOPTransformer.java	2008-03-24 03:41:24 UTC (rev 71184)
@@ -37,7 +37,7 @@
 {
    public boolean isNonAdvisableClassName(String classname)
    {
-      return (classname.startsWith("org.jboss.aop") ||
+      return (classname.startsWith("org.jboss.aop.") ||
       classname.endsWith("$aop") ||
       classname.startsWith("javassist") ||
       classname.startsWith("org.jboss.util.") ||

Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/standalone/Compiler.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/standalone/Compiler.java	2008-03-24 03:08:33 UTC (rev 71183)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/standalone/Compiler.java	2008-03-24 03:41:24 UTC (rev 71184)
@@ -258,6 +258,22 @@
    
    private void addFile(File file)throws Exception
    {
+      int index = file.getName().indexOf('$');
+      if (index != -1)
+      {
+         String fileName = file.getName().substring(0, index) + ".class";
+         File superClassFile = new File(fileName);
+         // checking last modified date is not enough
+         // because these values can differ in some miliseconds sometimes
+         if (superClassFile.lastModified() > file.lastModified()
+         // so, check this class has been recompiled and, hence,
+         // is not Advised anymore
+               && !loadFile(superClassFile))
+         {
+            file.delete();
+            return;
+         }
+      }
       ClassFile cf = createClassFile(file);
       String className = cf.getName();
       String superClassName = cf.getSuperclass();
@@ -300,7 +316,13 @@
       }
    }
 
-   public void loadFile(File file) throws Exception
+   /**
+    * Loads the file and, if it is an advised class, sets its advisor field as
+    * accessible.
+    * @param file the file of the class to be loaded
+    * @return {@code true} is {@code file} contains an advised class.
+    */
+   public boolean loadFile(File file) throws Exception
    {
       DataInputStream is = new DataInputStream(new FileInputStream(file));
       ClassFile cf = new ClassFile(is);
@@ -311,7 +333,9 @@
          Field f = clazz.getDeclaredField("aop$classAdvisor$aop");
          f.setAccessible(true);
          f.get(null);
+         return true;
       }
+      return false;
    }
 
    public void compileFile(CompilerClassInfo info) throws Exception

Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/standalone/SystemClassLoader.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/standalone/SystemClassLoader.java	2008-03-24 03:08:33 UTC (rev 71183)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/standalone/SystemClassLoader.java	2008-03-24 03:41:24 UTC (rev 71184)
@@ -174,7 +174,7 @@
          if (state == INITIALIZED)
          {
             final Object[] args = {this, name, null, null, origBytes.bytes};
-            if (!name.startsWith("org.jboss.aop"))
+            if (!name.startsWith("org.jboss.aop."))
             {
                classBytes.bytes = (byte[]) transform.invoke(aspectManager, args);
                classBytes.protectionDomain = origBytes.protectionDomain;

Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/util/JavassistMethodHashing.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/util/JavassistMethodHashing.java	2008-03-24 03:08:33 UTC (rev 71183)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/util/JavassistMethodHashing.java	2008-03-24 03:41:24 UTC (rev 71184)
@@ -141,7 +141,7 @@
       }
    }
    
-   private static void addDeclaredMethods(HashMap advised, CtClass superclass) throws Exception
+   private static void addDeclaredMethods(HashMap<Long, CtMethod> advised, CtClass superclass) throws Exception
    {
       CtMethod[] declaredMethods = superclass.getDeclaredMethods();
       for (int i = 0; i < declaredMethods.length; i++)
@@ -160,7 +160,7 @@
          }
       }
    }
-   private static void populateMethodTables(HashMap advised, CtClass superclass)
+   private static void populateMethodTables(HashMap<Long, CtMethod> advised, CtClass superclass)
       throws Exception
    {
       if (superclass == null) return;
@@ -181,16 +181,16 @@
       }
    }
 
-   public static HashMap getMethodMap(CtClass clazz) throws Exception
+   public static HashMap<Long, CtMethod> getMethodMap(CtClass clazz) throws Exception
    {
-      HashMap map = new HashMap();
+      HashMap<Long, CtMethod> map = new HashMap<Long, CtMethod>();
       populateMethodTables(map, clazz);
       return map;
    }
 
-   public static HashMap getDeclaredMethodMap(CtClass clazz) throws Exception
+   public static HashMap<Long, CtMethod> getDeclaredMethodMap(CtClass clazz) throws Exception
    {
-      HashMap map = new HashMap();
+      HashMap<Long, CtMethod> map = new HashMap<Long, CtMethod>();
       addDeclaredMethods(map, clazz);
       return map;
    }

Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/util/ReflectUtils.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/util/ReflectUtils.java	2008-03-24 03:08:33 UTC (rev 71183)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/util/ReflectUtils.java	2008-03-24 03:41:24 UTC (rev 71184)
@@ -22,7 +22,10 @@
 package org.jboss.aop.util;
 
 import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
 import java.util.ArrayList;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
 
 /**
  * 
@@ -32,6 +35,7 @@
 public class ReflectUtils
 {
    public static Class[] EMPTY_CLASS_ARRAY = new Class[0];
+   private static Pattern accessMethodPattern = Pattern.compile("access[$](\\d)+");
    
    public static Method[] getMethodsWithName(Class clazz, String name)
    {
@@ -58,4 +62,26 @@
       return (Method[])foundMethods.toArray(new Method[foundMethods.size()]);
    }
    
+   /**
+    * Java adds a few static void methods called access$0, access$1 etc. when inner classes are used
+    *
+    * @return false if this method is static, void, has package access and has a name like access$0, access$1 etc.
+    */
+   public static boolean isNotAccessMethod(Method m)
+   {
+
+      //TODO: Normally access methods should return void, but having optimised field invocation
+      //it seems that javassist occasionally creates these methods with other return types
+      if (Modifier.isStatic(m.getModifiers()))
+      {
+         Matcher match = accessMethodPattern.matcher(m.getName());
+         if (match.matches())
+         {
+            return false;
+         }
+      }
+
+      return true;
+   }
+   
 }

Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/util/XmlHelper.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/util/XmlHelper.java	2008-03-24 03:08:33 UTC (rev 71183)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/util/XmlHelper.java	2008-03-24 03:41:24 UTC (rev 71184)
@@ -44,7 +44,7 @@
     * @param tagName    The name of the desired child
     * @return           An interator of children or null if element is null.
     */
-   public static Iterator getChildrenByTagName(Element element,
+   public static Iterator<Element> getChildrenByTagName(Element element,
                                                String tagName)
    {
       if (element == null) return null;
@@ -52,12 +52,12 @@
       // descendance. We want only children
 
       NodeList children = element.getChildNodes();
-      ArrayList goodChildren = new ArrayList();
+      ArrayList<Element> goodChildren = new ArrayList<Element>();
       for (int i=0; i<children.getLength(); i++) {
          Node currentChild = children.item(i);
          if (currentChild.getNodeType() == Node.ELEMENT_NODE && 
              ((Element)currentChild).getTagName().equals(tagName)) {
-            goodChildren.add(currentChild);
+            goodChildren.add((Element)currentChild);
          }
       }
       return goodChildren.iterator();
@@ -77,10 +77,10 @@
    public static Element getUniqueChild(Element element, String tagName)
       throws Exception
    {
-      Iterator goodChildren = getChildrenByTagName(element, tagName);
+      Iterator<Element> goodChildren = getChildrenByTagName(element, tagName);
 
       if (goodChildren != null && goodChildren.hasNext()) {
-         Element child = (Element)goodChildren.next();
+         Element child = goodChildren.next();
          if (goodChildren.hasNext()) {
             throw new Exception
                ("expected only one " + tagName + " tag");
@@ -123,10 +123,10 @@
                                           Element defaultElement)
       throws Exception
    {
-      Iterator goodChildren = getChildrenByTagName(element, tagName);
+      Iterator<Element> goodChildren = getChildrenByTagName(element, tagName);
 
       if (goodChildren != null && goodChildren.hasNext()) {
-         Element child = (Element)goodChildren.next();
+         Element child = goodChildren.next();
          if (goodChildren.hasNext()) {
             throw new Exception
                ("expected only one " + tagName + " tag");

Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/util/reference/ArgumentPersistentReference.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/util/reference/ArgumentPersistentReference.java	2008-03-24 03:08:33 UTC (rev 71183)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/util/reference/ArgumentPersistentReference.java	2008-03-24 03:41:24 UTC (rev 71184)
@@ -33,22 +33,22 @@
  */
 public abstract class ArgumentPersistentReference extends PersistentReference 
 {
-	public ArgumentPersistentReference(Class clazz, Object referencedObject, int referenceType) {
+	public ArgumentPersistentReference(Class<?> clazz, Object referencedObject, int referenceType) {
 		super(clazz, referencedObject, referenceType);
 	}
 
-	WeakReference[] arguments;
+	WeakReference<Class<?>>[] arguments;
 	
-	public void setArguments(Class[] parguments)
+	public void setArguments(Class<?>[] parguments)
 	{
 		this.arguments = new WeakReference[parguments.length];
 		for (int i=0;i<arguments.length;i++)
 		{
-			this.arguments[i] = new WeakReference(parguments[i]);
+			this.arguments[i] = new WeakReference<Class<?>>(parguments[i]);
 		}
 	}
 	
-	public Class[] getArguments()
+	public Class<?>[] getArguments()
 	{
 		if (arguments==null)
 		{
@@ -56,10 +56,10 @@
 		}
 		else
 		{
-			Class argumentsReturn[] = new Class[arguments.length];
+			Class<?> argumentsReturn[] = new Class[arguments.length];
 			for (int i=0;i<arguments.length;i++)
 			{
-				argumentsReturn[i] = (Class)arguments[i].get();
+				argumentsReturn[i] = arguments[i].get();
 			}
 			return argumentsReturn;
 		}

Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/util/reference/ConstructorPersistentReference.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/util/reference/ConstructorPersistentReference.java	2008-03-24 03:08:33 UTC (rev 71183)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/util/reference/ConstructorPersistentReference.java	2008-03-24 03:41:24 UTC (rev 71184)
@@ -30,7 +30,7 @@
  */
 public class ConstructorPersistentReference extends ArgumentPersistentReference
 {
-   public ConstructorPersistentReference (Constructor constructor, int referenceType)
+   public ConstructorPersistentReference (Constructor<?> constructor, int referenceType)
    {
       super(constructor !=null ? constructor.getDeclaringClass() : null, constructor, referenceType);
       if (constructor != null)
@@ -46,13 +46,13 @@
       Object returnValue = null;
       if ((returnValue = internalGet())!=null) return returnValue;
       
-      Constructor constructor = getMappedClass().getDeclaredConstructor(getArguments());
+      Constructor<?> constructor = getMappedClass().getDeclaredConstructor(getArguments());
       buildReference(constructor);
       return constructor;
    }
 
-   public Constructor getConstructor()
+   public Constructor<?> getConstructor()
    {
-      return (Constructor) get();
+      return (Constructor<?>) get();
    }
 }

Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/util/reference/PersistentReference.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/util/reference/PersistentReference.java	2008-03-24 03:08:33 UTC (rev 71183)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/util/reference/PersistentReference.java	2008-03-24 03:41:24 UTC (rev 71184)
@@ -40,8 +40,8 @@
 	public static final int REFERENCE_WEAK=1;
 	public static final int REFERENCE_SOFT=2;
 
-   private WeakReference classReference;
-  	private Reference referencedObject;
+   private WeakReference<Class<?>> classReference;
+  	private Reference<Object> referencedObject;
 	private int referenceType=0;
 
    	/**
@@ -50,12 +50,12 @@
    	 * @param referencedObject  The reflection object being used
    	 * @param referenceType if REFERENCE_WEAK will use a WeakReference, and if REFERENCE_SOFT will use a SoftReference for referencedObject
    	 */
-   	public PersistentReference(Class clazz, Object referencedObject, int referenceType)
+   	public PersistentReference(Class<?> clazz, Object referencedObject, int referenceType)
 	{
    		this.referenceType=referenceType;
 		if (clazz!=null)
 		{
-			classReference = new WeakReference(clazz);
+			classReference = new WeakReference<Class<?>>(clazz);
 		}
 		buildReference(referencedObject);
 	}
@@ -104,24 +104,24 @@
 		{
 			if (referenceType==REFERENCE_WEAK)
 			{
-				referencedObject = new WeakReference(obj);
+				referencedObject = new WeakReference<Object>(obj);
 			}
 			else
 			{
-				referencedObject = new SoftReference(obj);
+				referencedObject = new SoftReference<Object>(obj);
 			}
 		}
 	}
 	
-	public Class getMappedClass()
+	public Class<?> getMappedClass()
 	{
 		if (classReference==null) return null;
-		Class returnClass = (Class)classReference.get();
+		Class<?> returnClass = classReference.get();
 		if (returnClass==null)
 		{
 			throw new RuntimeException("Class was already unloaded");
 		}
-		return (Class)returnClass;
+		return returnClass;
 	}
 	
 }




More information about the jboss-cvs-commits mailing list