Skip to content

Commit

Permalink
Merge branch '2.7'
Browse files Browse the repository at this point in the history
  • Loading branch information
cowtowncoder committed Feb 22, 2016
2 parents 8319bc7 + d64199a commit 23fe0ff
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 1 deletion.
3 changes: 3 additions & 0 deletions release-notes/CREDITS
Original file line number Diff line number Diff line change
Expand Up @@ -419,3 +419,6 @@ Aleks Seovic (aseovic@github)
or a timezone are specified
(2.7.1)

Timur Shakurov (saladinkzn@github)
* Reported #1134: Jackson 2.7 doesn't work with jdk6 due to use of `Collections.emptyIterator()`
(2.7.2)
2 changes: 2 additions & 0 deletions release-notes/VERSION
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ Project: jackson-databind
2.7.2 (not released yet)

#1129: When applying type modifiers, don't ignore container types.
#1134: Jackson 2.7 doesn't work with jdk6 due to use of `Collections.emptyIterator()`
(reported by Timur S, saladinkzn@github)

2.7.1-1 (03-Feb-2016)

Expand Down
23 changes: 22 additions & 1 deletion src/main/java/com/fasterxml/jackson/databind/util/ClassUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,24 @@ public final class ClassUtil
{
private final static Class<?> CLS_OBJECT = Object.class;

/*
/**********************************************************
/* Helper classes
/**********************************************************
*/

/* 21-Feb-2016, tatu: Unfortunately `Collections.emptyIterator()` only
* comes with JDK7, so we'll still have to include our bogus implementation
* for as long as we want JDK6 runtime compatibility
*/
private final static class EmptyIterator<T> implements Iterator<T> {
@Override public boolean hasNext() { return false; }
@Override public T next() { throw new NoSuchElementException(); }
@Override public void remove() { throw new UnsupportedOperationException(); }
}

private final static EmptyIterator<?> EMPTY_ITERATOR = new EmptyIterator<Object>();

/*
/**********************************************************
/* Simple factory methods
Expand All @@ -20,8 +38,11 @@ public final class ClassUtil
/**
* @since 2.7
*/
@SuppressWarnings("unchecked")
public static <T> Iterator<T> emptyIterator() {
return Collections.emptyIterator();
// 21-Feb-2016, tatu: As per above, use a locally defined empty iterator
// return Collections.emptyIterator();
return (Iterator<T>) EMPTY_ITERATOR;
}

/*
Expand Down

0 comments on commit 23fe0ff

Please sign in to comment.