From a1bb5dae64e5e5bc3541d426d9a160ffb5fbec35 Mon Sep 17 00:00:00 2001 From: jhugunin Date: Wed, 23 Jul 2003 01:05:55 +0000 Subject: [PATCH] added test to try to investigate size issues, but can't reproduce for any number of loops in BasicCommandTestCase.testSizeChanges() --- .../testdata/src1/SizeIssues.java | 21 +++++++++++++++++ .../testdata/src1/SizeIssuesAspect.java | 14 +++++++++++ .../compiler/batch/BasicCommandTestCase.java | 23 +++++++++++++++++++ 3 files changed, 58 insertions(+) create mode 100644 org.aspectj.ajdt.core/testdata/src1/SizeIssues.java create mode 100644 org.aspectj.ajdt.core/testdata/src1/SizeIssuesAspect.java diff --git a/org.aspectj.ajdt.core/testdata/src1/SizeIssues.java b/org.aspectj.ajdt.core/testdata/src1/SizeIssues.java new file mode 100644 index 000000000..18612e289 --- /dev/null +++ b/org.aspectj.ajdt.core/testdata/src1/SizeIssues.java @@ -0,0 +1,21 @@ +public class SizeIssues { + + public static void main(String[] argv) { + int foo1 = 1; + String foo2 = "2"; + Integer foo3 = new Integer(3); + String foo4 = "4"; + callfoo(foo1,foo2,foo3,foo4); + } + + public static void callfoo(int input1,String input2, Integer input3,String input4) { + bar_1(input1); + bar_2(input2); + bar_1(input3.intValue()); + bar_2(input4); + } + + public static void bar_1(int i) {} + public static void bar_2(String s) {} + +} \ No newline at end of file diff --git a/org.aspectj.ajdt.core/testdata/src1/SizeIssuesAspect.java b/org.aspectj.ajdt.core/testdata/src1/SizeIssuesAspect.java new file mode 100644 index 000000000..ca181a5a9 --- /dev/null +++ b/org.aspectj.ajdt.core/testdata/src1/SizeIssuesAspect.java @@ -0,0 +1,14 @@ +aspect SizeIssuesAspect { + + public pointcut rasScope() : within(*); + + pointcut toStringMethod() : execution(* *.toString()); + + pointcut publicMethods() : rasScope() && + execution( public * *(..)) && !toStringMethod(); + + after() returning: publicMethods() { + System.err.println(thisJoinPointStaticPart.getSignature().toLongString()); + } +} + diff --git a/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/compiler/batch/BasicCommandTestCase.java b/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/compiler/batch/BasicCommandTestCase.java index dff6f8144..824a85f43 100644 --- a/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/compiler/batch/BasicCommandTestCase.java +++ b/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/compiler/batch/BasicCommandTestCase.java @@ -170,4 +170,27 @@ public class BasicCommandTestCase extends CommandTestCase { } + + public void testSizeChanges() { + File f1 = new File("out/SizeIssues.class"); + + List args = new ArrayList(); + + args.add("-d"); + args.add("out"); + + args.add("-classpath"); + args.add("../runtime/bin;../lib/junit/junit.jar;../testing-client/bin"); + + args.add("testdata/src1/SizeIssuesAspect.java"); + args.add("testdata/src1/SizeIssues.java"); + + runCompiler(args, NO_ERRORS); + long size = f1.length(); + for (int i=0; i < 1; i++) { + f1.delete(); + runCompiler(args, NO_ERRORS); + assertEquals(size, f1.length()); + } + } } -- 2.39.5