Author: sebb
Date: Mon Nov 30 17:21:48 2009
New Revision: 885509
URL: http://svn.apache.org/viewvc?rev=885509&view=rev
Log:
Document why cast is safe
Typo in message: iterative => iterator
Modified:
commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/util/introspection/UberspectImpl.java
Modified:
commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/util/introspection/UberspectImpl.java
URL:
http://svn.apache.org/viewvc/commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/util/introspection/UberspectImpl.java?rev=885509&r1=885508&r2=885509&view=diff
==============================================================================
---
commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/util/introspection/UberspectImpl.java
(original)
+++
commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/util/introspection/UberspectImpl.java
Mon Nov 30 17:21:48 2009
@@ -65,7 +65,6 @@
/**
* {...@inheritdoc}
*/
- @SuppressWarnings("unchecked")
public Iterator<?> getIterator(Object obj, DebugInfo info) {
if (obj.getClass().isArray()) {
return new ArrayIterator(obj);
@@ -75,15 +74,17 @@
return ((Map<?,?>) obj).values().iterator();
} else if (obj instanceof Iterator<?>) {
rlog.warn(info.debugString()
- + "The iterative is not resetable; if used more than once,
"
+ + "The iterator is not resetable; if used more than once, "
+ "this may lead to unexpected results.");
return ((Iterator<?>) obj);
} else if (obj instanceof Enumeration<?>) {
rlog.warn(info.debugString()
- + "The iterative is not resetable; if used more than once,
"
+ + "The iterator is not resetable; if used more than once, "
+ "this may lead to unexpected results.");
- return new EnumerationIterator<Object>((Enumeration<Object>) obj);
+ @SuppressWarnings("unchecked") // OK because of instanceof check
above
+ final Enumeration<Object> enumObj = (Enumeration<Object>) obj;
+ return new EnumerationIterator<Object>(enumObj);
} else {
// look for an iterator() method to support the JDK5 Iterable
// interface or any user tools/DTOs that want to work in