--- /dev/null
+import org.aspectj.testing.Tester;
+
+public class pr100195 {
+ public static void main(String[] args) {
+ new Foo().foo();
+ AroundCasting.main(new String[0]);
+ }
+}
+
+class Foo {
+
+ static int x;
+
+ private String myString = "A String";
+
+ public static void main(String[] args) {
+ new Foo().foo();
+ AroundCasting.main(new String[0]);
+ }
+
+ public void foo() {
+ String myLocal = myString;
+ x = 5;
+ System.out.println(myLocal); // breakpoint here
+ bar(x);
+ }
+
+ public void bar(int y) {}
+}
+// Test.aj
+aspect Test {
+ void around() : ( execution(* Foo.foo(..) ) ) {
+ int y = 4;
+ System.out.println("before");
+ proceed();
+ System.out.println("after");
+ }
+}
+
+class AroundCasting {
+ public static void main(String[] args) {
+ bar(x);
+ //Tester.checkEqual(x, 1003);
+ }
+ static int x;
+
+ static void bar(int y) {}
+}
+
+
+aspect A {
+ static boolean test() { return true; }
+
+ int around(): if (test()) && get(int AroundCasting.x) {
+ return proceed() + 1000;
+ }
+
+ void around(): execution(void AroundCasting.main(String[])) {
+ Tester.event("enter main");
+ proceed();
+ }
+}
runTest("array clone call join points in 1.4 vs 1.3");
}
+ public void testDebugInfoForAroundAdvice() {
+ runTest("debug info in around advice inlining");
+ }
+
// helper methods.....
public SyntheticRepository createRepos(File cpentry) {
</compile>
</ajc-test>
+ <ajc-test dir="bugs150" pr="100195" title="debug info in around advice inlining">
+ <compile files="pr100195.aj">
+ </compile>
+ <run class="pr100195"/>
+ </ajc-test>
<!-- ============================================================================ -->
<!-- ============================================================================ -->
for (int j = sources.length - 1; j >= 0; j--) {
InstructionTargeter source = sources[j];
if (source instanceof LocalVariableTag) {
- // XXX destroying local variable info
- source.updateTarget(oldIh, null);
+ Shadow.Kind kind = getKind();
+ if (kind == Shadow.AdviceExecution ||
+ kind == Shadow.ConstructorExecution ||
+ kind == Shadow.MethodExecution ||
+ kind == Shadow.PreInitialization ||
+ kind == Shadow.Initialization ||
+ kind == Shadow.StaticInitialization) {
+ // if we're extracting a whole block we can do this...
+ source.updateTarget(oldIh, freshIh);
+ } else {
+ // XXX destroying local variable info
+ // but only for a call or get join point, so no big deal
+ source.updateTarget(oldIh, null);
+ }
} else if (source instanceof Range) {
// exceptions and shadows are just moved
((Range)source).updateTarget(oldIh, freshIh, freshBody);