]> source.dussan.org Git - aspectj.git/commitdiff
tests for pr11280, update to reflection api to get classloading right for test suite...
authoracolyer <acolyer>
Mon, 28 Nov 2005 12:08:29 +0000 (12:08 +0000)
committeracolyer <acolyer>
Mon, 28 Nov 2005 12:08:29 +0000 (12:08 +0000)
tests/bugs150/Pr112880.aj [new file with mode: 0644]
tests/src/org/aspectj/systemtest/ajc150/Ajc150Tests.java
tests/src/org/aspectj/systemtest/ajc150/ajc150.xml
weaver/src/org/aspectj/weaver/reflect/ReflectionBasedReferenceTypeDelegateFactory.java

diff --git a/tests/bugs150/Pr112880.aj b/tests/bugs150/Pr112880.aj
new file mode 100644 (file)
index 0000000..14a3d9d
--- /dev/null
@@ -0,0 +1,37 @@
+
+abstract class AbstractAttributeGuiFactory<A,B> {
+       
+       public A getThis() {
+               return null;
+       }
+       
+       public B getThat() {
+               return null;
+       }
+       
+}
+
+class ColorAttributeGuiFactory extends AbstractAttributeGuiFactory<C1,C2> {}
+
+class C1 {}
+
+class C2 {}
+
+aspect ForceParameterization {
+       
+       
+       before() : call(C1 *(..)) || call(C2 *(..)) {
+               System.out.println("method returning C1 or C2");
+       }
+       
+}
+
+public class Pr112880 {
+       
+       public static void main(String[] args) {
+               ColorAttributeGuiFactory f = new ColorAttributeGuiFactory();
+               f.getThis();
+               f.getThat();
+       }
+       
+}
\ No newline at end of file
index c0ae2744141b13a2d337a73e1b4d656c9bd0954f..282e04c8bee295cf8f7272425cb30c16c1cd0e19 100644 (file)
@@ -747,6 +747,10 @@ public class Ajc150Tests extends org.aspectj.testing.XMLBasedAjcTestCase {
          runTest("parameterized pointcut and advice");
   }
   
+  public void testDoublyParameterizedAbstractType() {
+         runTest("double parameter generic abstract type");
+  }
+  
   /*
    * Load-time weaving bugs
    */
index 311903ca13e8978865af25635a8d9e0ebb318c06..bc6d6d0099dd500847664e84d5b2539260a881c0 100644 (file)
                                <line text="AA.going()"/>
                        </stdout>
                </run>
-    </ajc-test>acj
+    </ajc-test>
     
+    <ajc-test dir="bugs150" pr="112880" title="double parameter generic abstract type">
+         <compile files="Pr112880.aj" options="-1.5">
+         </compile>
+         <run class="Pr112880">
+               <stdout>
+                       <line text="method returning C1 or C2"/>
+                       <line text="method returning C1 or C2"/>
+               </stdout>
+         </run>
+    </ajc-test>
     
     <ajc-test dir="bugs150/pr114005" title="Annotated ITDFs - 2">
       <compile files="Declaration2.java" options="-1.5"/>
index c48b19cf1cb0bc1d5625ac8c3e4e3df42d453a33..fc19988b5648dabcbf69150b02affc8ffa2f610e 100644 (file)
@@ -49,17 +49,16 @@ public class ReflectionBasedReferenceTypeDelegateFactory {
        
        private static ReflectionBasedReferenceTypeDelegate create15Delegate(ReferenceType forReferenceType, Class forClass, ClassLoader usingClassLoader, World inWorld) {
                try {
-                       // important that we use *our own* classloader for the next call...
-                       Class delegateClass = Class.forName("org.aspectj.weaver.reflect.Java15ReflectionBasedReferenceTypeDelegate",false,ReflectionBasedReferenceTypeDelegate.class.getClassLoader()); 
+                       Class delegateClass = Class.forName("org.aspectj.weaver.reflect.Java15ReflectionBasedReferenceTypeDelegate",false,usingClassLoader);//ReflectionBasedReferenceTypeDelegate.class.getClassLoader()); 
                        ReflectionBasedReferenceTypeDelegate ret = (ReflectionBasedReferenceTypeDelegate) delegateClass.newInstance();
                        ret.initialize(forReferenceType,forClass,usingClassLoader,inWorld);
                        return ret;
                } catch (ClassNotFoundException cnfEx) {
-                       return null;
+                       throw new IllegalStateException("Attempted to create Java 1.5 reflection based delegate but org.aspectj.weaver.reflect.Java15ReflectionBasedReferenceTypeDelegate was not found on classpath");
                } catch (InstantiationException insEx) {
-                       return null;
+                       throw new IllegalStateException("Attempted to create Java 1.5 reflection based delegate but InstantiationException: " + insEx + " occured");
                } catch (IllegalAccessException illAccEx) {
-                       return null;
+                       throw new IllegalStateException("Attempted to create Java 1.5 reflection based delegate but IllegalAccessException: " + illAccEx + " occured");
                }
        }