Skip to content

Commit

Permalink
Removed reflection trick unnecessary since we require Java 5
Browse files Browse the repository at this point in the history
  • Loading branch information
ddekany committed Jan 20, 2017
1 parent 7418c10 commit c23e0ba
Showing 1 changed file with 1 addition and 13 deletions.
14 changes: 1 addition & 13 deletions src/main/java/freemarker/ext/beans/BeansWrapper.java
Expand Up @@ -94,18 +94,6 @@ public class BeansWrapper implements RichObjectWrapper, WriteProtectable {
@Deprecated
static final Object CAN_NOT_UNWRAP = ObjectWrapperAndUnwrapper.CANT_UNWRAP_TO_TARGET_CLASS;

private static final Class<?> ITERABLE_CLASS;
static {
Class<?> iterable;
try {
iterable = Class.forName("java.lang.Iterable");
} catch (ClassNotFoundException e) {
// We're running on a pre-1.5 JRE
iterable = null;
}
ITERABLE_CLASS = iterable;
}

private static final Constructor<?> ENUMS_MODEL_CTOR = enumsModelCtor();

/**
Expand Down Expand Up @@ -1119,7 +1107,7 @@ private Object tryUnwrapTo(final TemplateModel model, Class<?> targetClass, fina
}
}

if (Collection.class == targetClass || ITERABLE_CLASS == targetClass) {
if (Collection.class == targetClass || Iterable.class == targetClass) {
if (model instanceof TemplateCollectionModel) {
return new CollectionAdapter((TemplateCollectionModel) model,
this);
Expand Down

0 comments on commit c23e0ba

Please sign in to comment.