Index: src/org/aspectj/systemtest/ajc152/Ajc152Tests.java =================================================================== RCS file: /home/technology/org.aspectj/modules/tests/src/org/aspectj/systemtest/ajc152/Ajc152Tests.java,v retrieving revision 1.56 diff -u -r1.56 Ajc152Tests.java --- src/org/aspectj/systemtest/ajc152/Ajc152Tests.java 27 Jun 2006 11:34:45 -0000 1.56 +++ src/org/aspectj/systemtest/ajc152/Ajc152Tests.java 27 Jun 2006 20:09:52 -0000 @@ -341,6 +341,14 @@ runTest("weaveinfo messages with include and exclude"); } + public void testInliningAtBuildTime() { + runTest("inline build time"); + } + + public void testInliningAtLoadTime() { + runTest("inline load time"); + } + // tests that can't be included for some reason // Not valid whilst the ajc compiler forces debug on (ignores -g:none) - it will be green but is invalid, trust me Index: src/org/aspectj/systemtest/ajc152/ajc152.xml =================================================================== RCS file: /home/technology/org.aspectj/modules/tests/src/org/aspectj/systemtest/ajc152/ajc152.xml,v retrieving revision 1.51 diff -u -r1.51 ajc152.xml --- src/org/aspectj/systemtest/ajc152/ajc152.xml 27 Jun 2006 11:34:45 -0000 1.51 +++ src/org/aspectj/systemtest/ajc152/ajc152.xml 27 Jun 2006 20:09:53 -0000 @@ -792,4 +792,22 @@ + + + + + + + + + + + + + + + + + + \ No newline at end of file Index: bugs152/pr148880/TestMain.aj =================================================================== RCS file: bugs152/pr148880/TestMain.aj diff -N bugs152/pr148880/TestMain.aj --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ bugs152/pr148880/TestMain.aj 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,25 @@ +public class TestMain { + public Object foo() { + return null; + } + public static void main(String argz[]) throws Exception { + System.out.println("total closures = "+countClosures("TestMain")); + } + + public static int countClosures(String base) { + int count = 0; + for (int i=0; i<99; i++) { + // somewhat brittle way to detect closures, i.e., where advice wasn't inlined: + // if I can't resolve TestMain$AjcClosuren, then I've inlined that advice + try { + Class.forName(base+"$AjcClosure"+i); + count++; + } catch (ClassNotFoundException _) { + // inlined it or not present + ; + } + } + return count; + } +} + Index: bugs152/pr148880/SimpleCaching.aj =================================================================== RCS file: bugs152/pr148880/SimpleCaching.aj diff -N bugs152/pr148880/SimpleCaching.aj --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ bugs152/pr148880/SimpleCaching.aj 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,24 @@ +public aspect SimpleCaching { + public pointcut cache() : execution(* foo(..)); + + // can inline + Object around() : cache() { + return proceed(); + } + + // can't inline + private static aspect CantInline { + declare precedence: CantInline, SimpleCaching; + Object around() : cache() { + return new Worker() { + public Object doProceed() { + return proceed(); + } + }.doProceed(); + } + } + + private static abstract class Worker { + public abstract Object doProceed(); + } +}