return ret;
}
-
public void postParse(TypeDeclaration typeDec) {
+ int adviceSequenceNumberInType = ((AspectDeclaration)typeDec).adviceCounter++;
+
+ StringBuffer stringifiedPointcut = new StringBuffer(30);
+ pointcutDesignator.print(0,stringifiedPointcut);
this.selector =
- NameMangler.adviceName(EclipseFactory.fromBinding(typeDec.binding), kind, sourceStart).toCharArray();
+ NameMangler.adviceName(
+ EclipseFactory.fromBinding(typeDec.binding),
+ kind,
+ adviceSequenceNumberInType,
+ stringifiedPointcut.toString().hashCode()).toCharArray();
if (arguments != null) {
baseArgumentCount = arguments.length;
}
public EclipseFactory factory; //??? should use this consistently
+ public int adviceCounter = 1; // Used as a part of the generated name for advice methods
// for better error messages in 1.0 to 1.1 transition
public TypePattern dominatesPattern;
Object instance = Reflection.getStaticField(Class.forName("AroundA"),
"ajc$perSingletonInstance");
- Reflection.invoke(Class.forName("AroundA"), instance, "ajc$around$AroundA$46",
+ Reflection.invoke(Class.forName("AroundA"), instance, "ajc$around$AroundA$1$73ebb943", // was $AroundA$46
new Integer(10), new Boolean(true), closure);
- Reflection.invoke(Class.forName("AroundA"), instance, "ajc$around$AroundA$c5",
+ Reflection.invoke(Class.forName("AroundA"), instance, "ajc$around$AroundA$2$a758212d", // Was $AroundA$c5
"hello there", closure);
- Reflection.invoke(Class.forName("AroundA"), instance, "ajc$around$AroundA$150",
+ Reflection.invoke(Class.forName("AroundA"), instance, "ajc$around$AroundA$3$a758212d", // Was $AroundA$150
new String[1], closure);
}
<run class="HandlerSig"/>
</ajc-test>
+
<ajc-test dir="new" pr="42668"
title="after returning with parameter: matching rules">
<compile files="AfterReturningParamMatching.java" />
<run class="AfterReturningParamMatching"/>
</ajc-test>
+
+ <ajc-test dir="bugs/binaryCompat" pr="50641"
+ title="binary compatibility of advice method names - expect no error">
+ <compile files="Main.java,TraceV1.aj"/>
+ <run class="Main"/>
+ <compile files="TraceV2.aj"/>
+ <run class="Main"/>
+ </ajc-test>
+
+ <ajc-test dir="bugs/binaryCompat" pr="50641"
+ title="binary compatibility of advice method names - expect error">
+ <compile files="Main.java,TraceV1.aj"/>
+ <run class="Main"/>
+ <compile files="TraceRE.aj"/>
+ <run class="Main"/>
+ </ajc-test>
+
+ <ajc-test dir="bugs/binaryCompat" pr="50641"
+ title="binary compatibility of advice method names - expect no error">
+ <compile files="Main.java,TraceWithInnerV1.aj"/>
+ <run class="Main"/>
+ <compile files="TraceWithInnerV2.aj"/>
+ <run class="Main"/>
+ </ajc-test>
</suite>
<run class="InterfaceMethodDeclarationNonPublic"/>
</ajc-test>
- <ajc-test dir="bugs/binaryCompat" pr="50641"
- title="binary compatibility of advice method names - expect no error">
- <compile files="Main.java,TraceV1.aj"/>
- <run class="Main"/>
- <compile files="TraceV2.aj"/>
- <run class="Main"/>
- </ajc-test>
-
- <ajc-test dir="bugs/binaryCompat" pr="50641"
- title="binary compatibility of advice method names - expect error">
- <compile files="Main.java,TraceV1.aj"/>
- <run class="Main"/>
- <compile files="TraceRE.aj"/>
- <run class="Main"/>
- </ajc-test>
-
<ajc-test dir="bugs" pr="36787"
title="interface initialization order">
<compile files="InterfaceInitializerOrder.java"/>
private static void doit() {
System.out.println("hello world");
}
-}
\ No newline at end of file
+}
\r
before(): execution(void doit(..)) {\r
System.out.println("entering");\r
+ \r
}\r
\r
+ \r
after() returning: execution(void doit(..)) {\r
System.out.println("exiting");\r
}\r
--- /dev/null
+aspect Trace {\r
+ public static boolean expectNoSuchMethodError = false;\r
+ \r
+ before(): execution(void doit(..)) {\r
+ System.out.println("enter");\r
+ }\r
+\r
+ static aspect InnerTrace {\r
+ before(): execution(void doit(..)) {\r
+ System.out.println("Inner enter");\r
+ }\r
+ \r
+ after() returning: execution(void doit(..)) {\r
+ System.out.println("Inner exit");\r
+ }\r
+ \r
+ after() throwing: execution(void doit(..)) {\r
+ System.out.println("Inner after throwing");\r
+ }\r
+ }\r
+ after() returning: execution(void doit(..)) {\r
+ System.out.println("exit");\r
+ }\r
+}
\ No newline at end of file
--- /dev/null
+aspect Trace {\r
+ public static boolean expectNoSuchMethodError = false;\r
+ \r
+ before(): execution(void doit(..)) {\r
+ System.out.println("entering");\r
+ \r
+ }\r
+\r
+ public void method() {\r
+ // Extra method to do nothing but test if the numbering still behaves \r
+ }\r
+\r
+ static aspect InnerTrace {\r
+ before(): execution(void doit(..)) {\r
+ System.out.println("Inner entering");\r
+ }\r
+ \r
+ after() returning: execution(void doit(..)) {\r
+ System.out.println("Inner exiting");\r
+ }\r
+ \r
+ after() throwing: execution(void doit(..)) {\r
+ System.out.println("Inner chucking");\r
+ }\r
+ \r
+ before(): execution(* noMatch(..)) {\r
+ System.out.println("This doesn't match anything, but checks the sequence number for the next bit of advice is OK");\r
+ }\r
+ }\r
+ \r
+ after() returning: execution(void doit(..)) {\r
+ System.out.println("exiting");\r
+ }\r
+}
\ No newline at end of file
}
-
/**
* The name of methods corresponding to advice declarations
+ * Of the form: "ajc$[AdviceKind]$[AspectName]$[NumberOfAdviceInAspect]$[PointcutHash]"
*/
- public static String adviceName(TypeX aspectType, AdviceKind kind, int position) {
- return makeName(kind.getName(), aspectType.getNameAsIdentifier(),
- Integer.toHexString(position));
+ public static String adviceName(TypeX aspectType, AdviceKind kind, int adviceSeqNumber,int pcdHash) {
+ String newname = makeName(
+ kind.getName(),
+ aspectType.getNameAsIdentifier(),
+ Integer.toString(adviceSeqNumber),
+ Integer.toHexString(pcdHash));
+ return newname;
}
/**