[jboss-cvs] JBossAS SVN: r74556 - projects/aop/trunk/aop/src/main/org/jboss/aop/instrument.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Fri Jun 13 22:51:29 EDT 2008
Author: flavia.rainone at jboss.com
Date: 2008-06-13 22:51:29 -0400 (Fri, 13 Jun 2008)
New Revision: 74556
Modified:
projects/aop/trunk/aop/src/main/org/jboss/aop/instrument/Instrumentor.java
Log:
[JBAOP-598] Now Instrumentor.convertReferences uses the advisor available, instead of creating a new one,
when the reference is the class being transformed itself.
Modified: projects/aop/trunk/aop/src/main/org/jboss/aop/instrument/Instrumentor.java
===================================================================
--- projects/aop/trunk/aop/src/main/org/jboss/aop/instrument/Instrumentor.java 2008-06-14 01:09:12 UTC (rev 74555)
+++ projects/aop/trunk/aop/src/main/org/jboss/aop/instrument/Instrumentor.java 2008-06-14 02:51:29 UTC (rev 74556)
@@ -610,7 +610,7 @@
* Find all classes that this class references. If any of those classes are advised and have field and/or constructor
* interception, do instrumentation on this class so that those fields and constructors are instrumented
*/
- protected boolean convertReferences(CtClass clazz) throws Exception
+ protected boolean convertReferences(CtClass clazz, ClassAdvisor clazzAdvisor) throws Exception
{
boolean converted = false;
String ref = null;
@@ -632,30 +632,37 @@
}
// Only need a temporary advisor for resolving metadata
CtClass ctRef = null;
- try
+ ClassAdvisor advisor = null;
+ if (ref.equals(clazz.getName()))
{
- ctRef = pool.get(ref);
+ ctRef = clazz;
+ advisor = clazzAdvisor;
}
- catch (NotFoundException e)
+ else
{
- if (AspectManager.suppressReferenceErrors)
+ try
{
- System.err.println("[warn] Could not find class " + ref + " that " + clazz.getName() + " references. It may not be in your classpath and you may not be getting field and constructor weaving for this class.");
- if (AspectManager.verbose) e.printStackTrace();
- continue;
+ ctRef = pool.get(ref);
}
- else
+ catch (NotFoundException e)
{
- throw e;
+ if (AspectManager.suppressReferenceErrors)
+ {
+ System.err.println("[warn] Could not find class " + ref + " that " + clazz.getName() + " references. It may not be in your classpath and you may not be getting field and constructor weaving for this class.");
+ if (AspectManager.verbose) e.printStackTrace();
+ continue;
+ }
+ else
+ {
+ throw e;
+ }
}
+ if (!isTransformable(ctRef)) continue;
+ advisor = manager.getTempClassAdvisor(ctRef);
}
- if (!isTransformable(ctRef)) continue;
-
it.addSuperClass(ctRef);
-
- ClassAdvisor advisor = manager.getTempClassAdvisor(ctRef);
-
-
+ //converted = false;
+
if (!manager.getInterceptionMarkers().shouldSkipFieldAccess(ref) && !ref.equals(clazz.getName()))
{
List<CtField> fields = getAdvisableFields(ctRef);
@@ -746,7 +753,7 @@
instrumentIntroductions(clazz, advisor);
- converted = convertReferences(clazz) || converted;
+ converted = convertReferences(clazz, advisor) || converted;
boolean shouldReplaceArrayAccess = replaceArrayAccess(clazz, advisor);
converted = converted || shouldReplaceArrayAccess;
More information about the jboss-cvs-commits
mailing list