Skip to content

Commit

Permalink
Revert "Fix #4443: detect Iterable as IterationType (#4487)"
Browse files Browse the repository at this point in the history
This reverts commit db623a8.
  • Loading branch information
cowtowncoder committed Apr 27, 2024
1 parent 0919bc0 commit 0611a67
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 20 deletions.
2 changes: 0 additions & 2 deletions release-notes/VERSION-2.x
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ Project: jackson-databind

2.18.0 (not yet released)

#4443: Add `Iterable<T>` as recognized `IterationType` instance (along with
`Iterable`, `Stream`)
#4453: Allow JSON Integer to deserialize into a single-arg constructor of
parameter type `double`
(contributed by David M)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1637,9 +1637,7 @@ protected JavaType _fromWellKnownClass(ClassStack context, Class<?> rawType, Typ
// detected, related to difficulties in propagating type upwards (Iterable, for
// example, is a weak, tag-on type). They may be detectable in future.
// 23-May-2023, tatu: As of 2.16 we do, however, recognized certain `IterationType`s.
if (rawType == Iterator.class || rawType == Stream.class
// 18-Apr-2024, tatu: [databind#4443] allow exact `Iterable`
|| rawType == Iterable.class) {
if (rawType == Iterator.class || rawType == Stream.class) {
return _iterationType(rawType, bindings, superClass, superInterfaces);
}
if (BaseStream.class.isAssignableFrom(rawType)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -324,8 +324,6 @@ public void testIterationTypesDirect() throws Exception
Iterator.class, Object.class);
_verifyIteratorType(tf.constructType(Stream.class),
Stream.class, Object.class);
_verifyIteratorType(tf.constructType(Iterable.class),
Iterable.class, Object.class);

// Then generic but direct
JavaType t = _verifyIteratorType(tf.constructType(new TypeReference<Iterator<String>>() { }),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,19 +165,6 @@ public void testIterator()
assertNull(t.containedType(1));
}

// [databind#4443]
@Test
public void testIterable()
{
TypeFactory tf = TypeFactory.defaultInstance();
JavaType t = tf.constructType(new TypeReference<Iterable<String>>() { });
assertEquals(IterationType.class, t.getClass());
assertTrue(t.isIterationType());
assertSame(Iterable.class, t.getRawClass());
assertEquals(1, t.containedTypeCount());
assertEquals(tf.constructType(String.class), t.containedType(0));
assertNull(t.containedType(1));
}
/**
* Test for verifying that parametric types can be constructed
* programmatically
Expand Down

0 comments on commit 0611a67

Please sign in to comment.