@@ -0,0 +1,1899 @@
+package org.jtwig.integration.expression;%0A%0Aimport com.google.common.collect.ImmutableList;%0Aimport org.jtwig.JtwigModel;%0Aimport org.jtwig.JtwigTemplate;%0Aimport org.jtwig.environment.EnvironmentConfiguration;%0Aimport org.jtwig.environment.EnvironmentConfigurationBuilder;%0Aimport org.jtwig.property.resolver.PropertyResolver;%0Aimport org.jtwig.property.selection.cache.SelectionPropertyResolverPersistentCache;%0Aimport org.junit.Before;%0Aimport org.junit.Test;%0A%0Aimport java.util.List;%0Aimport java.util.concurrent.ConcurrentHashMap;%0A%0Aimport static org.hamcrest.MatcherAssert.assertThat;%0Aimport static org.hamcrest.core.Is.is;%0A%0Apublic class PolymorphicVariableTest %7B%0A%0A%09private List%3CParentClass%3E list;%0A%09private EnvironmentConfiguration configuration;%0A%0A%09private abstract class ParentClass %7B%0A%09%09public abstract String getType();%0A%09%7D%0A%0A%09private class ConcreteClassA extends ParentClass %7B%0A%09%09public String getType() %7B%0A%09%09%09return %22A%22;%0A%09%09%7D%0A%09%7D%0A%0A%09private class ConcreteClassB extends ParentClass %7B%0A%09%09public String getType() %7B%0A%09%09%09return %22B%22;%0A%09%09%7D%0A%09%7D%0A%0A%09@Before%0A%09public void setupTestInstances() %7B%0A%09%09list = ImmutableList.of(%0A%09%09%09%09new ConcreteClassA(),%0A%09%09%09%09new ConcreteClassB(),%0A%09%09%09%09new ConcreteClassA()%0A%09%09);%0A%09%7D%0A%0A%09@Before%0A%09public void setupConfiguration() %7B%0A%09%09final ConcurrentHashMap%3CObject, PropertyResolver%3E resolverHashMap = new ConcurrentHashMap%3C%3E();%0A%09%09final SelectionPropertyResolverPersistentCache resolverCache = new SelectionPropertyResolverPersistentCache(resolverHashMap);%0A%0A%09%09configuration = EnvironmentConfigurationBuilder.configuration()%0A%09%09%09%09.propertyResolver().withCache(resolverCache).and()%0A%09%09%09%09.build();%0A%09%7D%0A%0A%09@Test%0A%09public void testPolymorphicVariableIsAcceessibleInPresenceOfPersistantResolverCache() %7B%0A%09%09String result = JtwigTemplate.inlineTemplate(%22%7B%25 for item in list %25%7D%7B%7B item.type %7D%7D%7B%25 endfor %25%7D%22, configuration)%0A%09%09%09%09.render(JtwigModel.newModel().with(%22list%22, list));%0A%0A%09%09assertThat(result, is(%22ABA%22));%0A%09%7D%0A%7D%0A

Add Test to highlight Problem mentioned in jtwig/jtwig#343