From 001e0c01f5d2e194ac2c3c2d0d9e6f82b0ce8580 Mon Sep 17 00:00:00 2001 From: aclement Date: Fri, 10 Jun 2011 22:48:24 +0000 Subject: [PATCH] added test for multidim array primitives --- .../org/aspectj/weaver/CommonWorldTests.java | 48 ++++++++++++++++--- 1 file changed, 42 insertions(+), 6 deletions(-) diff --git a/org.aspectj.matcher/testsrc/org/aspectj/weaver/CommonWorldTests.java b/org.aspectj.matcher/testsrc/org/aspectj/weaver/CommonWorldTests.java index f6a44c87c..e4dcc8873 100644 --- a/org.aspectj.matcher/testsrc/org/aspectj/weaver/CommonWorldTests.java +++ b/org.aspectj.matcher/testsrc/org/aspectj/weaver/CommonWorldTests.java @@ -45,11 +45,11 @@ public abstract class CommonWorldTests extends TestCase { world = getWorld(); } - private final UnresolvedType[] primitiveTypeXs = UnresolvedType.forSignatures(new String[] { "B", "S", "C", "I", "J", "F", "D", + private final UnresolvedType[] primitiveTypes = UnresolvedType.forSignatures(new String[] { "B", "S", "C", "I", "J", "F", "D", "V" }); public void testPrimitiveTypes() { - ResolvedType[] primitives = world.resolve(primitiveTypeXs); + ResolvedType[] primitives = world.resolve(primitiveTypes); for (int i = 0, len = primitives.length; i < len; i++) { ResolvedType ty = primitives[i]; modifiersTest(ty, Modifier.PUBLIC | Modifier.FINAL); @@ -90,7 +90,7 @@ public abstract class CommonWorldTests extends TestCase { } private void primAssignTest(String sig, String[] lowers) { - ResolvedType[] primitives = getWorld().resolve(primitiveTypeXs); + ResolvedType[] primitives = getWorld().resolve(primitiveTypes); UnresolvedType tx = UnresolvedType.forSignature(sig); ResolvedType ty = getWorld().resolve(tx, true); assertTrue("Couldnt find type " + tx, !ty.isMissing()); @@ -112,7 +112,7 @@ public abstract class CommonWorldTests extends TestCase { } public void testPrimitiveArrays() { - ResolvedType[] primitives = world.resolve(primitiveTypeXs); + ResolvedType[] primitives = world.resolve(primitiveTypes); for (int i = 0, len = primitives.length; i < len; i++) { ResolvedType ty = primitives[i]; UnresolvedType tx = UnresolvedType.forSignature("[" + ty.getSignature()); @@ -121,8 +121,10 @@ public abstract class CommonWorldTests extends TestCase { modifiersTest(aty, Modifier.PUBLIC | Modifier.FINAL); fieldsTest(aty, ResolvedMember.NONE); methodsTest(aty, ResolvedMember.NONE); - interfaceTest(aty, new ResolvedType[] { world.getCoreType(UnresolvedType.CLONEABLE), - world.getCoreType(UnresolvedType.SERIALIZABLE) }); + interfaceTest( + aty, + new ResolvedType[] { world.getCoreType(UnresolvedType.CLONEABLE), + world.getCoreType(UnresolvedType.SERIALIZABLE) }); superclassTest(aty, UnresolvedType.OBJECT); pointcutsTest(aty, ResolvedMember.NONE); @@ -144,6 +146,40 @@ public abstract class CommonWorldTests extends TestCase { } } } + // double dimension arrays + for (int i = 0, len = primitives.length; i < len; i++) { + ResolvedType ty = primitives[i]; + UnresolvedType tx = UnresolvedType.forSignature("[[" + ty.getSignature()); + ResolvedType aty = getWorld().resolve(tx, true); + assertTrue("Couldnt find type " + tx, !aty.isMissing()); + modifiersTest(aty, Modifier.PUBLIC | Modifier.FINAL); + fieldsTest(aty, ResolvedMember.NONE); + methodsTest(aty, ResolvedMember.NONE); + interfaceTest( + aty, + new ResolvedType[] { world.getCoreType(UnresolvedType.CLONEABLE), + world.getCoreType(UnresolvedType.SERIALIZABLE) }); + superclassTest(aty, UnresolvedType.OBJECT); + + pointcutsTest(aty, ResolvedMember.NONE); + isInterfaceTest(aty, false); + isClassTest(aty, false); + isAspectTest(aty, false); + for (int j = 0; j < len; j++) { + ResolvedType ty1 = primitives[j]; + isCoerceableFromTest(aty, ty1, false); + tx = UnresolvedType.forSignature("[[" + ty1.getSignature()); + ResolvedType aty1 = getWorld().resolve(tx, true); + assertTrue("Couldnt find type " + tx, !aty1.isMissing()); + if (ty.equals(ty1)) { + isCoerceableFromTest(aty, aty1, true); + isAssignableFromTest(aty, aty1, true); + } else { + isCoerceableFromTest(aty, aty1, false); + isAssignableFromTest(aty, aty1, false); + } + } + } } // ---- tests for parts of ResolvedType objects -- 2.39.5