From bd951ed3eaf19b17ac1b1541d6072246a21a2ca8 Mon Sep 17 00:00:00 2001 From: acolyer Date: Tue, 25 Oct 2005 04:48:48 +0000 Subject: added a test to make sure primitives work (they do), and also tidied up the array test in ReflectionWorld --- weaver/src/org/aspectj/weaver/reflect/ReflectionWorld.java | 7 ++++--- weaver/testsrc/org/aspectj/weaver/reflect/ReflectionWorldTest.java | 6 ++++++ 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/weaver/src/org/aspectj/weaver/reflect/ReflectionWorld.java b/weaver/src/org/aspectj/weaver/reflect/ReflectionWorld.java index 789dc5806..6ffc84b51 100644 --- a/weaver/src/org/aspectj/weaver/reflect/ReflectionWorld.java +++ b/weaver/src/org/aspectj/weaver/reflect/ReflectionWorld.java @@ -46,11 +46,12 @@ public class ReflectionWorld extends World { public ResolvedType resolve(Class aClass) { // classes that represent arrays return a class name that is the signature of the array type, ho-hum... String className = aClass.getName(); - if (!className.startsWith("[")) { - return resolve(className); - } else { + if (aClass.isArray()) { return resolve(UnresolvedType.forSignature(className)); } + else{ + return resolve(className); + } } /* (non-Javadoc) diff --git a/weaver/testsrc/org/aspectj/weaver/reflect/ReflectionWorldTest.java b/weaver/testsrc/org/aspectj/weaver/reflect/ReflectionWorldTest.java index 4bc879dae..662d9beb2 100644 --- a/weaver/testsrc/org/aspectj/weaver/reflect/ReflectionWorldTest.java +++ b/weaver/testsrc/org/aspectj/weaver/reflect/ReflectionWorldTest.java @@ -33,4 +33,10 @@ public class ReflectionWorldTest extends TestCase { assertTrue(rt.isArray()); } + public void testPrimitiveTypes() { + ReflectionWorld world = new ReflectionWorld(); + assertEquals("int",ResolvedType.INT,world.resolve(int.class)); + assertEquals("void",ResolvedType.VOID,world.resolve(void.class)); + } + } -- cgit v1.2.3