]> source.dussan.org Git - aspectj.git/commitdiff
test and fix for 153535
authoraclement <aclement>
Tue, 15 Aug 2006 11:51:21 +0000 (11:51 +0000)
committeraclement <aclement>
Tue, 15 Aug 2006 11:51:21 +0000 (11:51 +0000)
weaver/src/org/aspectj/weaver/reflect/ReflectionWorld.java
weaver/testsrc/org/aspectj/weaver/reflect/ReflectionBasedReferenceTypeDelegateTest.java
weaver5/java5-testsrc/org/aspectj/weaver/reflect/ReflectionBasedReferenceTypeDelegateTest.java

index a37b4654294f4fa5c421e6acb4cf94d97f8095e5..96266c23a91f9dbb0081ef855e8af8741fefdc99 100644 (file)
@@ -96,7 +96,7 @@ public class ReflectionWorld extends World implements IReflectionWorld {
                // classes that represent arrays return a class name that is the signature of the array type, ho-hum...
                String className = aClass.getName();
                if (aClass.isArray()) {
-                       return world.resolve(UnresolvedType.forSignature(className));
+                       return world.resolve(UnresolvedType.forSignature(className.replace('.','/')));
                }
                else{
                        return world.resolve(className);
index 0450aedebbe600a282fa5a09a6c691cb4721dd4a..0a844ec5d66f6295d6b603f9638fa52bbe3105f9 100644 (file)
@@ -12,6 +12,7 @@
 package org.aspectj.weaver.reflect;
 
 
+import java.lang.reflect.Method;
 import java.util.HashSet;
 import java.util.Set;
 
@@ -99,6 +100,12 @@ public class ReflectionBasedReferenceTypeDelegateTest extends TestCase {
                assertEquals(world.resolve("reflect.tests.C"),d.getSuperclass());
        }
        
+    public void testArrayArgsSig() throws Exception {
+       Method invokeMethod = Method.class.getMethod("invoke", new Class[] { Object.class, Object[].class});
+       ResolvedMember reflectionMethod = ReflectionBasedReferenceTypeDelegateFactory.createResolvedMethod(invokeMethod, world);
+       String exp = "(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;";
+       assertTrue("Expected: \n"+exp+"\n but got:\n"+reflectionMethod.getSignature(), reflectionMethod.getSignature().equals(exp));
+    }
 
        protected int findMethod(String name, ResolvedMember[] methods) {
                for (int i=0; i<methods.length; i++) {
index f9bef9cc9cfff69ef4e1e47801a44a21d5f377c4..4d92b1d6f58faf3235a68dce742ef900440a0834 100644 (file)
@@ -12,6 +12,7 @@
 package org.aspectj.weaver.reflect;
 
 
+import java.lang.reflect.Method;
 import java.util.HashSet;
 import java.util.Set;
 
@@ -296,6 +297,13 @@ public abstract class ReflectionBasedReferenceTypeDelegateTest extends TestCase
                assertTrue("Should be one extra (clinit) in BCEL case, but bcel="+rms1.length+" reflect="+rms2.length,rms1.length==rms2.length+1);
         }
     }
+
+    public void testArrayArgsSig() throws Exception {
+       Method invokeMethod = Method.class.getMethod("invoke", new Class[] { Object.class, Object[].class});
+       ResolvedMember reflectionMethod = ReflectionBasedReferenceTypeDelegateFactory.createResolvedMethod(invokeMethod, world);
+       String exp = "(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;";
+       assertTrue("Expected: \n"+exp+"\n but got:\n"+reflectionMethod.getSignature(), reflectionMethod.getSignature().equals(exp));
+    }
            
        // todo: array of int