]> source.dussan.org Git - aspectj.git/commitdiff
these tests are now for 1.5.4, not 1.6.0
authoraclement <aclement>
Thu, 18 Oct 2007 11:01:47 +0000 (11:01 +0000)
committeraclement <aclement>
Thu, 18 Oct 2007 11:01:47 +0000 (11:01 +0000)
tests/src/org/aspectj/systemtest/ajc154/Ajc154Tests.java [new file with mode: 0644]
tests/src/org/aspectj/systemtest/ajc154/AllTestsAspectJ154.java [new file with mode: 0644]
tests/src/org/aspectj/systemtest/ajc154/ajc154.xml [new file with mode: 0644]
tests/src/org/aspectj/systemtest/ajc160/Ajc160Tests.java [deleted file]
tests/src/org/aspectj/systemtest/ajc160/AllTestsAspectJ160.java [deleted file]
tests/src/org/aspectj/systemtest/ajc160/ajc160.xml [deleted file]

diff --git a/tests/src/org/aspectj/systemtest/ajc154/Ajc154Tests.java b/tests/src/org/aspectj/systemtest/ajc154/Ajc154Tests.java
new file mode 100644 (file)
index 0000000..b1998b3
--- /dev/null
@@ -0,0 +1,262 @@
+/*******************************************************************************
+ * Copyright (c) 2006 IBM 
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *    Andy Clement - initial API and implementation
+ *******************************************************************************/
+package org.aspectj.systemtest.ajc154;
+
+import java.io.File;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.aspectj.apache.bcel.classfile.ConstantPool;
+import org.aspectj.apache.bcel.classfile.JavaClass;
+import org.aspectj.apache.bcel.classfile.LineNumberTable;
+import org.aspectj.apache.bcel.classfile.Method;
+import org.aspectj.apache.bcel.generic.ConstantPoolGen;
+import org.aspectj.apache.bcel.generic.MethodGen;
+import org.aspectj.apache.bcel.util.ClassPath;
+import org.aspectj.apache.bcel.util.SyntheticRepository;
+import org.aspectj.testing.XMLBasedAjcTestCase;
+import org.aspectj.weaver.patterns.PatternParser;
+import org.aspectj.weaver.tools.ContextBasedMatcher;
+import org.aspectj.weaver.tools.FuzzyBoolean;
+import org.aspectj.weaver.tools.MatchingContext;
+import org.aspectj.weaver.tools.PointcutDesignatorHandler;
+
+import junit.framework.Test;
+
+/**
+ * These are tests for AspectJ1.5.4
+ */
+public class Ajc154Tests extends org.aspectj.testing.XMLBasedAjcTestCase {
+       
+//     public void testNewDesignatorsReferencePointcuts_pr205907() {           
+//             BeanDesignatorHandler beanHandler = new BeanDesignatorHandler();
+//             Set set = new HashSet();
+//             set.add(beanHandler);
+//             PatternParser.setTestDesignators(set);
+//     //parser.registerPointcutDesignatorHandler(beanHandler);
+//             runTest("new pointcut designators in a reference pointcut");
+//     }
+       
+       public void testItdClashForTypesFromAspectPath_pr206732() { runTest("itd clash for types from aspectpath"); } 
+       public void testAnnotationStyleAndMultiplePackages_pr197719() { runTest("annotation style syntax and cross package extension"); }
+       
+       /** Complex test that attempts to damage a class like a badly behaved bytecode transformer would and checks if AspectJ can cope. */
+        public void testCopingWithGarbage_pr175806_1() throws ClassNotFoundException { 
+                
+               // Compile the program we are going to mess with
+           runTest("coping with bad tables");
+           
+           // Load up the class and the method 'main' we are interested in
+           JavaClass jc = getClassFrom(ajc.getSandboxDirectory(),"A");
+           Method[] meths = jc.getMethods();
+           Method oneWeWant = null;
+           for (int i = 0; i < meths.length && oneWeWant==null; i++) {
+                       Method method = meths[i];
+                       if (method.getName().equals("main")) oneWeWant = meths[i];
+           }
+           
+           /**
+            * For the main method:
+                 Stack=2, Locals=3, Args_size=1
+                 0:   iconst_5
+                 1:   istore_1
+                 2:   ldc     #18; //String 3
+                 4:   astore_2
+                 5:   getstatic       #24; //Field java/lang/System.out:Ljava/io/PrintStream;
+                 8:   aload_2
+                 9:   invokevirtual   #30; //Method java/io/PrintStream.println:(Ljava/lang/String;)V
+                 12:  goto    23
+                 15:  pop
+                 16:  getstatic       #24; //Field java/lang/System.out:Ljava/io/PrintStream;
+                 19:  iload_1
+                 20:  invokevirtual   #33; //Method java/io/PrintStream.println:(I)V
+                 23:  return
+                Exception table:
+                 from   to  target type
+                   2    15    15   Class java/lang/Exception
+               
+                LineNumberTable:
+                 line 4: 0
+                 line 6: 2
+                 line 7: 5
+                 line 8: 15
+                 line 9: 16
+                 line 11: 23
+                LocalVariableTable:
+                 Start  Length  Slot  Name   Signature
+                 0      24      0    argv       [Ljava/lang/String;
+                 2      22      1    i       I
+                 5      10      2    s       Ljava/lang/String;
+            */
+           
+           ConstantPool cp = oneWeWant.getConstantPool();
+           ConstantPoolGen cpg = new ConstantPoolGen(cp);
+           
+           // Damage the line number table, entry 2 (Line7:5) so it points to an invalid (not on an instruction boundary) position of 6
+           oneWeWant.getLineNumberTable().getLineNumberTable()[2].setStartPC(6);
+
+           // Should be 'rounded down' when transforming it into a MethodGen, new position will be '5'
+//         System.out.println("BEFORE\n"+oneWeWant.getLineNumberTable().toString());
+           MethodGen toTransform = new MethodGen(oneWeWant,"A",cpg,false);
+           LineNumberTable lnt = toTransform.getMethod().getLineNumberTable();
+           assertTrue("Should have been 'rounded down' to position 5 but is "+lnt.getLineNumberTable()[2].getStartPC(), lnt.getLineNumberTable()[2].getStartPC()==5);
+//         System.out.println("AFTER\n"+lnt.toString());    
+        }
+        
+        public void testCopingWithGarbage_pr175806_2() throws ClassNotFoundException { 
+        
+               // Compile the program we are going to mess with
+           runTest("coping with bad tables");
+           
+           // Load up the class and the method 'main' we are interested in
+           JavaClass jc = getClassFrom(ajc.getSandboxDirectory(),"A");
+           Method[] meths = jc.getMethods();
+           Method oneWeWant = null;
+           for (int i = 0; i < meths.length && oneWeWant==null; i++) {
+                       Method method = meths[i];
+                       if (method.getName().equals("main")) oneWeWant = meths[i];
+           }
+           // see previous test for dump of main method
+           
+           ConstantPool cp = oneWeWant.getConstantPool();
+           ConstantPoolGen cpg = new ConstantPoolGen(cp);
+           
+           // Damage the local variable table, entry 2 (" 2      22      1    i       I") so it points to an invalid start pc of 3
+           oneWeWant.getLocalVariableTable().getLocalVariable(1).setStartPC(3);
+
+           // Should be 'rounded down' when transforming it into a MethodGen, new position will be '2'             
+           // This next line will go BANG with an NPE if we don't correctly round the start pc down to 2
+           MethodGen toTransform = new MethodGen(oneWeWant,"A",cpg,true);
+        }
+         
+
+  public void testGenericAspectGenericPointcut_pr174449() { runTest("problem with generic aspect and generic pointcut");}
+  public void testGenericAspectGenericPointcut_noinline_pr174449() { runTest("problem with generic aspect and generic pointcut - noinline");}
+  public void testGenericMethodsAndOrdering_ok_pr171953_2() { runTest("problem with generic methods and ordering - ok");}
+  public void testGenericMethodsAndOrdering_bad_pr171953_2() { runTest("problem with generic methods and ordering - bad");}
+  public void testItdAndJoinpointSignatureCollection_ok_pr171953() { runTest("problem with itd and join point signature collection - ok");}
+  public void testItdAndJoinpointSignatureCollection_bad_pr171953() { runTest("problem with itd and join point signature collection - bad");}
+  public void testGenericMethodsAndItds_pr171952() { runTest("generic methods and ITDs");}
+  //public void testUsingDecpAnnotationWithoutAspectAnnotation_pr169428() { runTest("using decp annotation without aspect annotation");}
+  public void testItdsParameterizedParameters_pr170467() { runTest("itds and parameterized parameters");}
+  public void testComplexGenerics_pr168044() { runTest("complex generics - 1");}
+  public void testIncorrectlyMarkingFieldTransient_pr168063() { runTest("incorrectly marking field transient");}
+  public void testInheritedAnnotations_pr169706() { runTest("inherited annotations");}
+  public void testGenericFieldNPE_pr165885() { runTest("generic field npe");}
+  public void testIncorrectOptimizationOfIstore_pr166084() { runTest("incorrect optimization of istore"); }
+  public void testDualParameterizationsNotAllowed_pr165631() { runTest("dual parameterizations not allowed"); }
+       
+       public void testSuppressWarnings1_pr166238() {
+               runTest("Suppress warnings1");
+       }
+
+       public void testSuppressWarnings2_pr166238() {
+               runTest("Suppress warnings2");
+       }
+  public void testNullReturnedFromGetField_pr172107() { runTest("null returned from getField()"); }
+       
+  /////////////////////////////////////////
+  public static Test suite() {
+    return XMLBasedAjcTestCase.loadSuite(Ajc154Tests.class);
+  }
+
+  protected File getSpecFile() {
+    return new File("../tests/src/org/aspectj/systemtest/ajc154/ajc154.xml");
+  }
+  
+  public SyntheticRepository createRepos(File cpentry) {
+       ClassPath cp = new ClassPath(cpentry+File.pathSeparator+System.getProperty("java.class.path"));
+       return SyntheticRepository.getInstance(cp);
+  }
+  
+  protected JavaClass getClassFrom(File where,String clazzname) throws ClassNotFoundException {
+       SyntheticRepository repos = createRepos(where);
+       return repos.loadClass(clazzname);
+  }
+  // ---
+       private class BeanDesignatorHandler implements PointcutDesignatorHandler {
+
+               private String askedToParse;
+               public boolean simulateDynamicTest = false;
+               
+               public String getDesignatorName() {
+                       return "bean";
+               }
+       
+               /* (non-Javadoc)
+                * @see org.aspectj.weaver.tools.PointcutDesignatorHandler#parse(java.lang.String)
+                */
+               public ContextBasedMatcher parse(String expression) {
+                       this.askedToParse = expression;
+                       return new BeanPointcutExpression(expression,this.simulateDynamicTest);
+               }
+               
+               public String getExpressionLastAskedToParse() {
+                       return this.askedToParse;
+               }
+       }
+       
+       private class BeanPointcutExpression implements ContextBasedMatcher {
+
+               private final String beanNamePattern;
+               private final boolean simulateDynamicTest;
+
+               public BeanPointcutExpression(String beanNamePattern, boolean simulateDynamicTest) {
+                       this.beanNamePattern = beanNamePattern;
+                       this.simulateDynamicTest = simulateDynamicTest;                 
+               }
+
+
+               public boolean couldMatchJoinPointsInType(Class aClass) {
+                       return true;
+               }
+               
+               /* (non-Javadoc)
+                * @see org.aspectj.weaver.tools.ContextBasedMatcher#couldMatchJoinPointsInType(java.lang.Class)
+                */
+               public boolean couldMatchJoinPointsInType(Class aClass, MatchingContext context) {
+                       if (this.beanNamePattern.equals(context.getBinding("beanName"))) {
+                               return true;
+                       } else {
+                               return false;
+                       }
+               }
+
+
+               /* (non-Javadoc)
+                * @see org.aspectj.weaver.tools.ContextBasedMatcher#mayNeedDynamicTest()
+                */
+               public boolean mayNeedDynamicTest() {
+                       return this.simulateDynamicTest;
+               }
+
+
+               public FuzzyBoolean matchesStatically(MatchingContext matchContext) {
+                       if (this.simulateDynamicTest) return FuzzyBoolean.MAYBE;
+                       if (this.beanNamePattern.equals(matchContext.getBinding("beanName"))) {
+                               return FuzzyBoolean.YES;
+                       } else {
+                               return FuzzyBoolean.NO;
+                       }
+               }
+
+
+               /* (non-Javadoc)
+                * @see org.aspectj.weaver.tools.ContextBasedMatcher#matchesDynamically(org.aspectj.weaver.tools.MatchingContext)
+                */
+               public boolean matchesDynamically(MatchingContext matchContext) {
+                       return this.beanNamePattern.equals(matchContext.getBinding("beanName"));
+               }
+       }               
+
+  
+}
\ No newline at end of file
diff --git a/tests/src/org/aspectj/systemtest/ajc154/AllTestsAspectJ154.java b/tests/src/org/aspectj/systemtest/ajc154/AllTestsAspectJ154.java
new file mode 100644 (file)
index 0000000..71f6d18
--- /dev/null
@@ -0,0 +1,25 @@
+/*******************************************************************************
+ * Copyright (c) 2006 IBM 
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *    Andy Clement - initial API and implementation
+ *******************************************************************************/
+package org.aspectj.systemtest.ajc154;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+public class AllTestsAspectJ154 {
+
+       public static Test suite() {
+               TestSuite suite = new TestSuite("AspectJ 1.5.4 tests");
+               //$JUnit-BEGIN$
+               suite.addTest(Ajc154Tests.suite());
+        //$JUnit-END$
+               return suite;
+       }
+}
diff --git a/tests/src/org/aspectj/systemtest/ajc154/ajc154.xml b/tests/src/org/aspectj/systemtest/ajc154/ajc154.xml
new file mode 100644 (file)
index 0000000..a2d3f79
--- /dev/null
@@ -0,0 +1,160 @@
+<!DOCTYPE suite SYSTEM "../tests/ajcTestSuite.dtd"[]>
+
+<!-- AspectJ v1.6.0 Tests -->
+<suite>
+
+   <ajc-test dir="bugs154/pr206732" title="itd clash for types from aspectpath">
+     <compile outjar="foo.jar" files="Advised.aj"/>
+     <compile files="Ref.aj" aspectpath="foo.jar"/>
+   </ajc-test>
+
+   <ajc-test dir="bugs154/pr175806" title="coping with bad tables">
+     <compile options="-1.5" files="A.java"/>
+   </ajc-test>
+   
+   <ajc-test dir="bugs154/pr174449" title="problem with generic aspect and generic pointcut">
+     <compile options="-1.5" files="Foo.java"/>
+     <run class="Foo">
+       <stderr>
+         <line text="around advice executing: servant class is class Boo"/>
+         <line text="around advice executing: servant class is class Goo"/>
+       </stderr>
+     </run>
+   </ajc-test>
+   
+   <ajc-test dir="bugs154/pr174449" title="problem with generic aspect and generic pointcut - noinline">
+     <compile options="-1.5 -XnoInline" files="Foo.java"/>
+     <run class="Foo">
+       <stderr>
+         <line text="around advice executing: servant class is class Boo"/>
+         <line text="around advice executing: servant class is class Goo"/>
+       </stderr>
+     </run>
+   </ajc-test>
+   
+   <ajc-test dir="bugs154/pr171953_2" title="problem with generic methods and ordering - ok">
+        <compile options="-1.5" files="test/ListFactoryAspect.aj, test/AbstractProcessor.java,test/ListFactory.java,test/ListFactoryConsumer.java,test/Processor.java,test/SimpleListFactoryConsumer.java">
+        </compile>
+   </ajc-test>
+   
+   <ajc-test dir="bugs154/pr171953_2" title="problem with generic methods and ordering - bad">
+        <compile options="-1.5" files="test/ListFactory.java,test/ListFactoryConsumer.java,test/SimpleListFactoryConsumer.java,test/Processor.java,test/ListFactoryAspect.aj,test/AbstractProcessor.java">
+        </compile>
+   </ajc-test>
+
+   <ajc-test dir="bugs154/pr171953" title="problem with itd and join point signature collection - bad">
+     <compile options="-1.5 -showWeaveInfo" files="test/AbstractExecutable.java,test/AnotherExecutable.java,test/Executable.java,test/ExecutionAspect.aj,test/SecondTestExecutable.java test/SubTestExecutable.java test/TestExecutable.java">
+       <message kind="weave" text="Join point 'method-execution(void test.SecondTestExecutable.execute())' in Type 'test.SecondTestExecutable' (SecondTestExecutable.java:5) advised by around advice from 'test.ExecutionAspect' (ExecutionAspect.aj:9)"/>
+       <message kind="weave" text="Extending interface set for type 'test.AbstractExecutable' (AbstractExecutable.java) to include 'java.io.Serializable' (ExecutionAspect.aj)"/>
+       <message kind="weave" text="Join point 'method-execution(void test.SubTestExecutable.execute())' in Type 'test.SubTestExecutable' (SubTestExecutable.java:6) advised by around advice from 'test.ExecutionAspect' (ExecutionAspect.aj:9)"/>
+       <message kind="weave" text="Join point 'method-execution(void test.TestExecutable.execute())' in Type 'test.TestExecutable' (TestExecutable.java:5) advised by around advice from 'test.ExecutionAspect' (ExecutionAspect.aj:9)"/>
+     </compile>       
+     <run class="test.SecondTestExecutable"/>
+   </ajc-test>
+
+   <ajc-test dir="bugs154/pr171953" title="problem with itd and join point signature collection - ok">
+     <compile options="-1.5 -showWeaveInfo" files="test/SecondTestExecutable.java test/AbstractExecutable.java test/AnotherExecutable.java  test/Executable.java test/ExecutionAspect.aj test/RunnableAspect.aj test/SubTestExecutable.java test/TestExecutable.java">
+       <message kind="weave" text="Join point 'method-execution(void test.SecondTestExecutable.execute())' in Type 'test.SecondTestExecutable' (SecondTestExecutable.java:5) advised by around advice from 'test.ExecutionAspect' (ExecutionAspect.aj:9)"/>
+       <message kind="weave" text="Extending interface set for type 'test.AbstractExecutable' (AbstractExecutable.java) to include 'java.io.Serializable' (ExecutionAspect.aj)"/>
+       <message kind="weave" text="Join point 'method-execution(void test.SubTestExecutable.execute())' in Type 'test.SubTestExecutable' (SubTestExecutable.java:6) advised by around advice from 'test.ExecutionAspect' (ExecutionAspect.aj:9)"/>
+       <message kind="weave" text="Join point 'method-execution(void test.TestExecutable.execute())' in Type 'test.TestExecutable' (TestExecutable.java:5) advised by around advice from 'test.ExecutionAspect' (ExecutionAspect.aj:9)"/>
+     </compile>       
+     <run class="test.SecondTestExecutable"/>
+   </ajc-test>
+
+    <ajc-test dir="bugs154/pr171952" title="generic methods and ITDs">
+      <compile files="Foo.java,FooAspect.java" options="-1.5"/>
+    </ajc-test>
+    
+    <ajc-test dir="bugs154/pr169428" title="using decp annotation without aspect annotation">
+      <compile files="AnAspect.java" options="-1.5">
+        <message kind="error" text="Found @AspectJ annotations in a non @Aspect type 'AnAspect'"/>
+      </compile>
+    </ajc-test>
+    
+    <ajc-test dir="bugs154/pr170467" title="itds and parameterized parameters">
+      <compile files="Bug.aj" options="-1.5"/>
+      <compile files="Bug2.aj" options="-1.5"/>
+    </ajc-test>
+    
+    <ajc-test dir="bugs154/pr169706" title="inherited annotations">
+      <compile files="A.java,B.java,C.java,MyAspect.java,MyAnnotation.java,Test.java" options="-1.5 -showWeaveInfo">
+        <message kind="weave" text="Join point 'method-call(void C.foo())' in Type 'Test' (Test.java:5) advised by before advice from 'MyAspect' (MyAspect.java:4)"/>
+         </compile>
+    </ajc-test>
+    
+    <ajc-test dir="bugs154/pr165885" title="generic field npe">
+      <compile files="Concrete.java,Abstract.java,Aspect.java" options="-1.5">
+        <message kind="warning" line="8" text="foo"/>
+         </compile>
+    </ajc-test>
+    
+    <ajc-test dir="bugs154/pr168044" title="complex generics - 1">
+      <compile files="AbstractNode.java" options="-1.5">
+         </compile>
+    </ajc-test>
+    
+    <ajc-test dir="bugs154/pr168063" title="incorrectly marking field transient">
+      <compile files="A.java"/>
+      <run class="A">
+        <stdout>
+          <line text="It worked, data preserved!"/>
+        </stdout>
+      </run>
+    </ajc-test>
+    
+    <ajc-test dir="bugs154/pr166084" title="incorrect optimization of istore">
+      <compile files="X.java" inpath="simple.jar"/>
+         <run class="Simple"/>
+    </ajc-test>
+       
+    <ajc-test dir="bugs154/pr165631" title="dual parameterizations not allowed">
+      <!-- two variations of the same situation, should fail in the same way -->
+      <compile files="Bug.java" options="-1.5">
+        <message kind="error" line="12" text="Cannot declare parent B"/>
+      </compile>
+      <compile files="Bug2.java" options="-1.5">
+        <message kind="error" line="13" text="Cannot declare parent B"/>
+      </compile>
+    </ajc-test>
+
+    <ajc-test dir="ltw"
+      title="Suppress warnings1"
+      keywords="xlint, ltw, nowarn, pr166238">
+        <compile
+            files="Main.java"
+        >
+        </compile>    
+        <run class="Main" ltw="aop-noxlintfile-nowarn.xml">
+            <stderr/> <!-- no warnings from missing xlint file: they are suppressed -->
+        </run>        
+    </ajc-test>
+
+    <ajc-test dir="ltw"
+      title="Suppress warnings2"
+      keywords="xlint, ltw, nowarn, pr166238">
+        <compile
+            files="Main.java"
+        >
+        </compile>    
+        <run class="Main" ltw="aop-noxlintfile-warnnone.xml">
+            <stderr/> <!-- no warnings from missing xlint file: they are suppressed -->
+        </run>
+    </ajc-test>
+    
+    <ajc-test dir="bugs154/pr172107" title="null returned from getField()"
+               keywords="pr172107">
+        <compile files="ReadWriteAJBug172107.java,Instrumentation.aj"/>
+               <run class="ReadWriteAJBug172107"/>
+    </ajc-test>
+    
+    <ajc-test dir="bugs154/pr197719" title="annotation style syntax and cross package extension">
+      <compile files="test/aspects/C1.java,test/aspects/C3.java,test/aspects/MyAnn.java,test/aspects/MyAnnAspect.java,test/aspects2/C2.java" options="-1.5"/>
+      <run class="test.aspects2.C2"/>
+    </ajc-test>
+    
+    <ajc-test dir="bugs154/pr205907" title="new pointcut designators in a reference pointcut">
+      <compile files="Test.aj"/>
+    </ajc-test>
+
+</suite>
\ No newline at end of file
diff --git a/tests/src/org/aspectj/systemtest/ajc160/Ajc160Tests.java b/tests/src/org/aspectj/systemtest/ajc160/Ajc160Tests.java
deleted file mode 100644 (file)
index 08a701c..0000000
+++ /dev/null
@@ -1,168 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006 IBM 
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *    Andy Clement - initial API and implementation
- *******************************************************************************/
-package org.aspectj.systemtest.ajc160;
-
-import java.io.File;
-
-import org.aspectj.apache.bcel.classfile.ConstantPool;
-import org.aspectj.apache.bcel.classfile.JavaClass;
-import org.aspectj.apache.bcel.classfile.LineNumberTable;
-import org.aspectj.apache.bcel.classfile.Method;
-import org.aspectj.apache.bcel.generic.ConstantPoolGen;
-import org.aspectj.apache.bcel.generic.MethodGen;
-import org.aspectj.apache.bcel.util.ClassPath;
-import org.aspectj.apache.bcel.util.SyntheticRepository;
-import org.aspectj.testing.XMLBasedAjcTestCase;
-
-import junit.framework.Test;
-
-/**
- * These are tests for AspectJ1.6 - they do not require a 1.6 VM.
- */
-public class Ajc160Tests extends org.aspectj.testing.XMLBasedAjcTestCase {
-       
-       /** Complex test that attempts to damage a class like a badly behaved bytecode transformer would and checks if AspectJ can cope. */
-        public void testCopingWithGarbage_pr175806_1() throws ClassNotFoundException { 
-                
-               // Compile the program we are going to mess with
-           runTest("coping with bad tables");
-           
-           // Load up the class and the method 'main' we are interested in
-           JavaClass jc = getClassFrom(ajc.getSandboxDirectory(),"A");
-           Method[] meths = jc.getMethods();
-           Method oneWeWant = null;
-           for (int i = 0; i < meths.length && oneWeWant==null; i++) {
-                       Method method = meths[i];
-                       if (method.getName().equals("main")) oneWeWant = meths[i];
-           }
-           
-           /**
-            * For the main method:
-                 Stack=2, Locals=3, Args_size=1
-                 0:   iconst_5
-                 1:   istore_1
-                 2:   ldc     #18; //String 3
-                 4:   astore_2
-                 5:   getstatic       #24; //Field java/lang/System.out:Ljava/io/PrintStream;
-                 8:   aload_2
-                 9:   invokevirtual   #30; //Method java/io/PrintStream.println:(Ljava/lang/String;)V
-                 12:  goto    23
-                 15:  pop
-                 16:  getstatic       #24; //Field java/lang/System.out:Ljava/io/PrintStream;
-                 19:  iload_1
-                 20:  invokevirtual   #33; //Method java/io/PrintStream.println:(I)V
-                 23:  return
-                Exception table:
-                 from   to  target type
-                   2    15    15   Class java/lang/Exception
-               
-                LineNumberTable:
-                 line 4: 0
-                 line 6: 2
-                 line 7: 5
-                 line 8: 15
-                 line 9: 16
-                 line 11: 23
-                LocalVariableTable:
-                 Start  Length  Slot  Name   Signature
-                 0      24      0    argv       [Ljava/lang/String;
-                 2      22      1    i       I
-                 5      10      2    s       Ljava/lang/String;
-            */
-           
-           ConstantPool cp = oneWeWant.getConstantPool();
-           ConstantPoolGen cpg = new ConstantPoolGen(cp);
-           
-           // Damage the line number table, entry 2 (Line7:5) so it points to an invalid (not on an instruction boundary) position of 6
-           oneWeWant.getLineNumberTable().getLineNumberTable()[2].setStartPC(6);
-
-           // Should be 'rounded down' when transforming it into a MethodGen, new position will be '5'
-//         System.out.println("BEFORE\n"+oneWeWant.getLineNumberTable().toString());
-           MethodGen toTransform = new MethodGen(oneWeWant,"A",cpg,false);
-           LineNumberTable lnt = toTransform.getMethod().getLineNumberTable();
-           assertTrue("Should have been 'rounded down' to position 5 but is "+lnt.getLineNumberTable()[2].getStartPC(), lnt.getLineNumberTable()[2].getStartPC()==5);
-//         System.out.println("AFTER\n"+lnt.toString());    
-        }
-        
-        public void testCopingWithGarbage_pr175806_2() throws ClassNotFoundException { 
-        
-               // Compile the program we are going to mess with
-           runTest("coping with bad tables");
-           
-           // Load up the class and the method 'main' we are interested in
-           JavaClass jc = getClassFrom(ajc.getSandboxDirectory(),"A");
-           Method[] meths = jc.getMethods();
-           Method oneWeWant = null;
-           for (int i = 0; i < meths.length && oneWeWant==null; i++) {
-                       Method method = meths[i];
-                       if (method.getName().equals("main")) oneWeWant = meths[i];
-           }
-           // see previous test for dump of main method
-           
-           ConstantPool cp = oneWeWant.getConstantPool();
-           ConstantPoolGen cpg = new ConstantPoolGen(cp);
-           
-           // Damage the local variable table, entry 2 (" 2      22      1    i       I") so it points to an invalid start pc of 3
-           oneWeWant.getLocalVariableTable().getLocalVariable(1).setStartPC(3);
-
-           // Should be 'rounded down' when transforming it into a MethodGen, new position will be '2'             
-           // This next line will go BANG with an NPE if we don't correctly round the start pc down to 2
-           MethodGen toTransform = new MethodGen(oneWeWant,"A",cpg,true);
-        }
-         
-
-  public void testGenericAspectGenericPointcut_pr174449() { runTest("problem with generic aspect and generic pointcut");}
-  public void testGenericAspectGenericPointcut_noinline_pr174449() { runTest("problem with generic aspect and generic pointcut - noinline");}
-  public void testGenericMethodsAndOrdering_ok_pr171953_2() { runTest("problem with generic methods and ordering - ok");}
-  public void testGenericMethodsAndOrdering_bad_pr171953_2() { runTest("problem with generic methods and ordering - bad");}
-  public void testItdAndJoinpointSignatureCollection_ok_pr171953() { runTest("problem with itd and join point signature collection - ok");}
-  public void testItdAndJoinpointSignatureCollection_bad_pr171953() { runTest("problem with itd and join point signature collection - bad");}
-  public void testGenericMethodsAndItds_pr171952() { runTest("generic methods and ITDs");}
-  //public void testUsingDecpAnnotationWithoutAspectAnnotation_pr169428() { runTest("using decp annotation without aspect annotation");}
-  public void testItdsParameterizedParameters_pr170467() { runTest("itds and parameterized parameters");}
-  public void testComplexGenerics_pr168044() { runTest("complex generics - 1");}
-  public void testIncorrectlyMarkingFieldTransient_pr168063() { runTest("incorrectly marking field transient");}
-  public void testInheritedAnnotations_pr169706() { runTest("inherited annotations");}
-  public void testGenericFieldNPE_pr165885() { runTest("generic field npe");}
-  public void testIncorrectOptimizationOfIstore_pr166084() { runTest("incorrect optimization of istore"); }
-  public void testDualParameterizationsNotAllowed_pr165631() { runTest("dual parameterizations not allowed"); }
-       
-       public void testSuppressWarnings1_pr166238() {
-               runTest("Suppress warnings1");
-       }
-
-       public void testSuppressWarnings2_pr166238() {
-               runTest("Suppress warnings2");
-       }
-  public void testNullReturnedFromGetField_pr172107() { runTest("null returned from getField()"); }
-       
-  /////////////////////////////////////////
-  public static Test suite() {
-    return XMLBasedAjcTestCase.loadSuite(Ajc160Tests.class);
-  }
-
-  protected File getSpecFile() {
-    return new File("../tests/src/org/aspectj/systemtest/ajc160/ajc160.xml");
-  }
-  
-  public SyntheticRepository createRepos(File cpentry) {
-       ClassPath cp = new ClassPath(cpentry+File.pathSeparator+System.getProperty("java.class.path"));
-       return SyntheticRepository.getInstance(cp);
-  }
-  
-  protected JavaClass getClassFrom(File where,String clazzname) throws ClassNotFoundException {
-       SyntheticRepository repos = createRepos(where);
-       return repos.loadClass(clazzname);
-  }
-
-  
-}
\ No newline at end of file
diff --git a/tests/src/org/aspectj/systemtest/ajc160/AllTestsAspectJ160.java b/tests/src/org/aspectj/systemtest/ajc160/AllTestsAspectJ160.java
deleted file mode 100644 (file)
index 1e93dca..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006 IBM 
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *    Andy Clement - initial API and implementation
- *******************************************************************************/
-package org.aspectj.systemtest.ajc160;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
-public class AllTestsAspectJ160 {
-
-       public static Test suite() {
-               TestSuite suite = new TestSuite("AspectJ 1.6.0 tests");
-               //$JUnit-BEGIN$
-               suite.addTest(Ajc160Tests.suite());
-        //$JUnit-END$
-               return suite;
-       }
-}
diff --git a/tests/src/org/aspectj/systemtest/ajc160/ajc160.xml b/tests/src/org/aspectj/systemtest/ajc160/ajc160.xml
deleted file mode 100644 (file)
index 8fb99f2..0000000
+++ /dev/null
@@ -1,150 +0,0 @@
-<!DOCTYPE suite SYSTEM "../tests/ajcTestSuite.dtd"[]>
-
-<!-- AspectJ v1.6.0 Tests -->
-<suite>
-
- <!-- first section - dont need a 1.6 vm but fixed in the 1.6 branch of AspectJ -->
-   <ajc-test dir="bugs160/pr175806" title="coping with bad tables">
-     <compile options="-1.5" files="A.java"/>
-   </ajc-test>
-   
-   <ajc-test dir="bugs160/pr174449" title="problem with generic aspect and generic pointcut">
-     <compile options="-1.5" files="Foo.java"/>
-     <run class="Foo">
-       <stderr>
-         <line text="around advice executing: servant class is class Boo"/>
-         <line text="around advice executing: servant class is class Goo"/>
-       </stderr>
-     </run>
-   </ajc-test>
-   
-   <ajc-test dir="bugs160/pr174449" title="problem with generic aspect and generic pointcut - noinline">
-     <compile options="-1.5 -XnoInline" files="Foo.java"/>
-     <run class="Foo">
-       <stderr>
-         <line text="around advice executing: servant class is class Boo"/>
-         <line text="around advice executing: servant class is class Goo"/>
-       </stderr>
-     </run>
-   </ajc-test>
-   
-   <ajc-test dir="bugs160/pr171953_2" title="problem with generic methods and ordering - ok">
-        <compile options="-1.5" files="test/ListFactoryAspect.aj, test/AbstractProcessor.java,test/ListFactory.java,test/ListFactoryConsumer.java,test/Processor.java,test/SimpleListFactoryConsumer.java">
-        </compile>
-   </ajc-test>
-   
-   <ajc-test dir="bugs160/pr171953_2" title="problem with generic methods and ordering - bad">
-        <compile options="-1.5" files="test/ListFactory.java,test/ListFactoryConsumer.java,test/SimpleListFactoryConsumer.java,test/Processor.java,test/ListFactoryAspect.aj,test/AbstractProcessor.java">
-        </compile>
-   </ajc-test>
-
-   <ajc-test dir="bugs160/pr171953" title="problem with itd and join point signature collection - bad">
-     <compile options="-1.5 -showWeaveInfo" files="test/AbstractExecutable.java,test/AnotherExecutable.java,test/Executable.java,test/ExecutionAspect.aj,test/SecondTestExecutable.java test/SubTestExecutable.java test/TestExecutable.java">
-       <message kind="weave" text="Join point 'method-execution(void test.SecondTestExecutable.execute())' in Type 'test.SecondTestExecutable' (SecondTestExecutable.java:5) advised by around advice from 'test.ExecutionAspect' (ExecutionAspect.aj:9)"/>
-       <message kind="weave" text="Extending interface set for type 'test.AbstractExecutable' (AbstractExecutable.java) to include 'java.io.Serializable' (ExecutionAspect.aj)"/>
-       <message kind="weave" text="Join point 'method-execution(void test.SubTestExecutable.execute())' in Type 'test.SubTestExecutable' (SubTestExecutable.java:6) advised by around advice from 'test.ExecutionAspect' (ExecutionAspect.aj:9)"/>
-       <message kind="weave" text="Join point 'method-execution(void test.TestExecutable.execute())' in Type 'test.TestExecutable' (TestExecutable.java:5) advised by around advice from 'test.ExecutionAspect' (ExecutionAspect.aj:9)"/>
-     </compile>       
-     <run class="test.SecondTestExecutable"/>
-   </ajc-test>
-
-   <ajc-test dir="bugs160/pr171953" title="problem with itd and join point signature collection - ok">
-     <compile options="-1.5 -showWeaveInfo" files="test/SecondTestExecutable.java test/AbstractExecutable.java test/AnotherExecutable.java  test/Executable.java test/ExecutionAspect.aj test/RunnableAspect.aj test/SubTestExecutable.java test/TestExecutable.java">
-       <message kind="weave" text="Join point 'method-execution(void test.SecondTestExecutable.execute())' in Type 'test.SecondTestExecutable' (SecondTestExecutable.java:5) advised by around advice from 'test.ExecutionAspect' (ExecutionAspect.aj:9)"/>
-       <message kind="weave" text="Extending interface set for type 'test.AbstractExecutable' (AbstractExecutable.java) to include 'java.io.Serializable' (ExecutionAspect.aj)"/>
-       <message kind="weave" text="Join point 'method-execution(void test.SubTestExecutable.execute())' in Type 'test.SubTestExecutable' (SubTestExecutable.java:6) advised by around advice from 'test.ExecutionAspect' (ExecutionAspect.aj:9)"/>
-       <message kind="weave" text="Join point 'method-execution(void test.TestExecutable.execute())' in Type 'test.TestExecutable' (TestExecutable.java:5) advised by around advice from 'test.ExecutionAspect' (ExecutionAspect.aj:9)"/>
-     </compile>       
-     <run class="test.SecondTestExecutable"/>
-   </ajc-test>
-
-    <ajc-test dir="bugs160/pr171952" title="generic methods and ITDs">
-      <compile files="Foo.java,FooAspect.java" options="-1.5"/>
-    </ajc-test>
-    
-    <ajc-test dir="bugs160/pr169428" title="using decp annotation without aspect annotation">
-      <compile files="AnAspect.java" options="-1.5">
-        <message kind="error" text="Found @AspectJ annotations in a non @Aspect type 'AnAspect'"/>
-      </compile>
-    </ajc-test>
-    
-    <ajc-test dir="bugs160/pr170467" title="itds and parameterized parameters">
-      <compile files="Bug.aj" options="-1.5"/>
-      <compile files="Bug2.aj" options="-1.5"/>
-    </ajc-test>
-    
-    <ajc-test dir="bugs160/pr169706" title="inherited annotations">
-      <compile files="A.java,B.java,C.java,MyAspect.java,MyAnnotation.java,Test.java" options="-1.5 -showWeaveInfo">
-        <message kind="weave" text="Join point 'method-call(void C.foo())' in Type 'Test' (Test.java:5) advised by before advice from 'MyAspect' (MyAspect.java:4)"/>
-         </compile>
-    </ajc-test>
-    
-    <ajc-test dir="bugs160/pr165885" title="generic field npe">
-      <compile files="Concrete.java,Abstract.java,Aspect.java" options="-1.5">
-        <message kind="warning" line="8" text="foo"/>
-         </compile>
-    </ajc-test>
-    
-    <ajc-test dir="bugs160/pr168044" title="complex generics - 1">
-      <compile files="AbstractNode.java" options="-1.5">
-         </compile>
-    </ajc-test>
-    
-    <ajc-test dir="bugs160/pr168063" title="incorrectly marking field transient">
-      <compile files="A.java"/>
-      <run class="A">
-        <stdout>
-          <line text="It worked, data preserved!"/>
-        </stdout>
-      </run>
-    </ajc-test>
-    
-    <ajc-test dir="bugs160/pr166084" title="incorrect optimization of istore">
-      <compile files="X.java" inpath="simple.jar"/>
-         <run class="Simple"/>
-    </ajc-test>
-       
-    <ajc-test dir="bugs160/pr165631" title="dual parameterizations not allowed">
-      <!-- two variations of the same situation, should fail in the same way -->
-      <compile files="Bug.java" options="-1.5">
-        <message kind="error" line="12" text="Cannot declare parent B"/>
-      </compile>
-      <compile files="Bug2.java" options="-1.5">
-        <message kind="error" line="13" text="Cannot declare parent B"/>
-      </compile>
-    </ajc-test>
-
-    <ajc-test dir="ltw"
-      title="Suppress warnings1"
-      keywords="xlint, ltw, nowarn, pr166238">
-        <compile
-            files="Main.java"
-        >
-        </compile>    
-        <run class="Main" ltw="aop-noxlintfile-nowarn.xml">
-            <stderr/> <!-- no warnings from missing xlint file: they are suppressed -->
-        </run>        
-    </ajc-test>
-
-    <ajc-test dir="ltw"
-      title="Suppress warnings2"
-      keywords="xlint, ltw, nowarn, pr166238">
-        <compile
-            files="Main.java"
-        >
-        </compile>    
-        <run class="Main" ltw="aop-noxlintfile-warnnone.xml">
-            <stderr/> <!-- no warnings from missing xlint file: they are suppressed -->
-        </run>
-    </ajc-test>
-    
-    <ajc-test dir="bugs160/pr172107" title="null returned from getField()"
-               keywords="pr172107">
-        <compile files="ReadWriteAJBug172107.java,Instrumentation.aj"/>
-               <run class="ReadWriteAJBug172107"/>
-    </ajc-test>
-    
- <!-- second section - need a 1.6 vm -->
-
-</suite>
\ No newline at end of file