diff --git a/VERSION.txt b/VERSION.txt index 35d4808..5df12a2 100644 --- a/VERSION.txt +++ b/VERSION.txt @@ -5,6 +5,9 @@ Release notes: 1.7.0 (not yet released) +#51: `TypeResolver.resolve(Long[].class)` should not return a `ResolvedType` + whose parent type is null + (reported by @ljnelson) #75: Move JDK baseline to Java 8 (contributed by Dave B, @mebigfatguy) #83: Simplify code by not calling `Set.contains()` before `add()` diff --git a/src/main/java/com/fasterxml/classmate/types/ResolvedArrayType.java b/src/main/java/com/fasterxml/classmate/types/ResolvedArrayType.java index 4630f3a..b7c81d8 100644 --- a/src/main/java/com/fasterxml/classmate/types/ResolvedArrayType.java +++ b/src/main/java/com/fasterxml/classmate/types/ResolvedArrayType.java @@ -7,8 +7,21 @@ public final class ResolvedArrayType extends ResolvedType { - protected final ResolvedType _elementType; + /** + * All Java Arrays extend {@link java.lang.Object} so we need + * a reference + *
+ * Note that direct construction is used instead of construction via
+ * {@link TypeResolver} due to complexity of doing latter: {@code java.lang.Object}
+ * also does not implement any interfaces so this should be safe enough.
+ *
+ * @since 1.7
+ */
+ private final static ResolvedObjectType PARENT_TYPE =
+ ResolvedObjectType.create(Object.class, null, null, null);
+ protected final ResolvedType _elementType;
+
/*
/**********************************************************************
/* Life cycle
@@ -34,7 +47,7 @@ public boolean canCreateSubtypes() {
*/
@Override
- public ResolvedType getParentClass() { return null; }
+ public ResolvedType getParentClass() { return PARENT_TYPE; }
@Override
public ResolvedType getSelfReferencedType() { return null; }
@@ -69,7 +82,7 @@ public boolean isInterface() {
/*
/**********************************************************************
- /* Accessors for raw (minimally procesed) members
+ /* Accessors for raw (minimally processed) members
/**********************************************************************
*/
diff --git a/src/main/java/com/fasterxml/classmate/types/ResolvedObjectType.java b/src/main/java/com/fasterxml/classmate/types/ResolvedObjectType.java
index 5b54221..9b354a8 100644
--- a/src/main/java/com/fasterxml/classmate/types/ResolvedObjectType.java
+++ b/src/main/java/com/fasterxml/classmate/types/ResolvedObjectType.java
@@ -83,20 +83,6 @@ public ResolvedObjectType(Class> erased, TypeBindings bindings,
_modifiers = erased.getModifiers();
}
- @Deprecated // since 1.1; removed from 1.2 -- kept for binary backwards compatibility
- public ResolvedObjectType(Class> erased, TypeBindings bindings,
- ResolvedObjectType superClass, List