// 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);
package org.aspectj.weaver.reflect;
+import java.lang.reflect.Method;
import java.util.HashSet;
import java.util.Set;
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++) {
package org.aspectj.weaver.reflect;
+import java.lang.reflect.Method;
import java.util.HashSet;
import java.util.Set;
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