aboutsummaryrefslogtreecommitdiffstats
path: root/weaver5
diff options
context:
space:
mode:
authoraclement <aclement>2005-11-23 16:30:16 +0000
committeraclement <aclement>2005-11-23 16:30:16 +0000
commit5cba2054c0bbfb4bdf2f00f044e841741055282c (patch)
treeb27497f6572f0c84572fd4d6f124d683ab523825 /weaver5
parenta4caeb95261431c81f7beb0cddbff3b0865e614d (diff)
downloadaspectj-5cba2054c0bbfb4bdf2f00f044e841741055282c.tar.gz
aspectj-5cba2054c0bbfb4bdf2f00f044e841741055282c.zip
some fixes for 117622
Diffstat (limited to 'weaver5')
-rw-r--r--weaver5/java5-src/org/aspectj/weaver/reflect/Java15ReflectionBasedReferenceTypeDelegate.java26
-rw-r--r--weaver5/java5-testsrc/org/aspectj/weaver/TestJava5ReflectionBasedReferenceTypeDelegate.java25
2 files changed, 47 insertions, 4 deletions
diff --git a/weaver5/java5-src/org/aspectj/weaver/reflect/Java15ReflectionBasedReferenceTypeDelegate.java b/weaver5/java5-src/org/aspectj/weaver/reflect/Java15ReflectionBasedReferenceTypeDelegate.java
index c1f3c9fd4..47f4918cc 100644
--- a/weaver5/java5-src/org/aspectj/weaver/reflect/Java15ReflectionBasedReferenceTypeDelegate.java
+++ b/weaver5/java5-src/org/aspectj/weaver/reflect/Java15ReflectionBasedReferenceTypeDelegate.java
@@ -79,8 +79,9 @@ public class Java15ReflectionBasedReferenceTypeDelegate extends
public AnnotationX[] getAnnotations() {
// AMC - we seem not to need to implement this method...
- throw new UnsupportedOperationException("getAnnotations on Java15ReflectionBasedReferenceTypeDelegate is not implemented yet");
- //return super.getAnnotations();
+ //throw new UnsupportedOperationException("getAnnotations on Java15ReflectionBasedReferenceTypeDelegate is not implemented yet");
+ // FIXME is this the right implementation in the reflective case?
+ return super.getAnnotations();
}
public ResolvedType[] getAnnotationTypes() {
@@ -127,7 +128,7 @@ public class Java15ReflectionBasedReferenceTypeDelegate extends
}
public ResolvedType getSuperclass() {
- if (superclass == null)
+ if (superclass == null && getBaseClass()!=Object.class) // superclass of Object is null
superclass = fromType(this.getBaseClass().getGenericSuperclass());
return superclass;
}
@@ -267,7 +268,24 @@ public class Java15ReflectionBasedReferenceTypeDelegate extends
private ResolvedType fromType(Type aType) {
if (aType instanceof Class) {
- return getWorld().resolve(((Class)aType).getName());
+ Class clazz = (Class)aType;
+ String name = clazz.getName();
+ /**
+ * getName() can return:
+ *
+ * 1. If this class object represents a reference type that is not an array type
+ * then the binary name of the class is returned
+ * 2. If this class object represents a primitive type or void, then the
+ * name returned is a String equal to the Java language keyword corresponding to the primitive type or void.
+ * 3. If this class object represents a class of arrays, then the internal form
+ * of the name consists of the name of the element type preceded by one or more '[' characters representing the depth of the array nesting.
+ */
+ if (clazz.isArray()) {
+ UnresolvedType ut = UnresolvedType.forSignature(name);
+ return getWorld().resolve(ut);
+ } else {
+ return getWorld().resolve(name);
+ }
} else if (aType instanceof ParameterizedType) {
ParameterizedType pt = (ParameterizedType) aType;
ResolvedType baseType = fromType(pt.getRawType());
diff --git a/weaver5/java5-testsrc/org/aspectj/weaver/TestJava5ReflectionBasedReferenceTypeDelegate.java b/weaver5/java5-testsrc/org/aspectj/weaver/TestJava5ReflectionBasedReferenceTypeDelegate.java
new file mode 100644
index 000000000..450d00c6d
--- /dev/null
+++ b/weaver5/java5-testsrc/org/aspectj/weaver/TestJava5ReflectionBasedReferenceTypeDelegate.java
@@ -0,0 +1,25 @@
+package org.aspectj.weaver;
+
+import org.aspectj.weaver.reflect.ReflectionBasedReferenceTypeDelegateTest;
+
+public class TestJava5ReflectionBasedReferenceTypeDelegate extends ReflectionBasedReferenceTypeDelegateTest {
+
+ public void testResolveGeneric() {
+ UnresolvedType collectionType = UnresolvedType.forName("java.util.Collection<E>");
+// ResolvedType rt= world.resolve(collectionType);
+// ResolvedMember[] methods = world.resolve(collectionType).getDeclaredMethods();
+// assertTrue(findMethod("toArray", methods) != -1);
+ }
+
+ public void testResolveClass() {
+ //stack overflow
+ world.resolve("java.lang.Class");
+ }
+
+ // just here to override the super one so it doesnt run in this case ;)
+ public void testGetDeclaredMethods() {
+
+ }
+
+
+}