Skip to content

Commit

Permalink
Revert "Fix #4443: detect Iterable as IterationType" (#4505)
Browse files Browse the repository at this point in the history
  • Loading branch information
cowtowncoder authored Apr 27, 2024
1 parent 0919bc0 commit c176809
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 19 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 @@ -1638,8 +1638,12 @@ protected JavaType _fromWellKnownClass(ClassStack context, Class<?> rawType, Typ
// 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) {
// 27-Apr-2024, tatu: Tried to do [databind#4443] for 2.18 but that caused
// regression so cannot add "Iterable.class" without figuring out issue
// with HPPC `ObjectArrayList`s type hierarchy first
//
// || rawType == Iterable.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 c176809

Please sign in to comment.