Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
None
-
None
-
None
Description
Consider the following code:
<#list orders.get(type) as order></#list>
where orders is com.google.common.collect.ArrayListMultimap. An IllegalAccessException is thrown, because com.google.common.collect.AbstractListMultimap where the get method is defined is package-private.
---- FTL stack trace ("~" means nesting-related): - Failed at: #list orders.get(type) as order [in template "admin-orders.ftl" at line 4, column 9] ---- at freemarker.ext.beans._MethodUtil.newInvocationTemplateModelException(_MethodUtil.java:289) at freemarker.ext.beans._MethodUtil.newInvocationTemplateModelException(_MethodUtil.java:252) at freemarker.ext.beans.SimpleMethodModel.exec(SimpleMethodModel.java:77) at freemarker.core.MethodCall._eval(MethodCall.java:65) at freemarker.core.Expression.eval(Expression.java:83) at freemarker.core.IteratorBlock.acceptWithResult(IteratorBlock.java:98) at freemarker.core.IteratorBlock.accept(IteratorBlock.java:93) at freemarker.core.Environment.visit(Environment.java:366) at freemarker.core.IteratorBlock$IterationContext.executedNestedContentForCollOrSeqListing(IteratorBlock.java:291) at freemarker.core.IteratorBlock$IterationContext.executeNestedContent(IteratorBlock.java:271) at freemarker.core.IteratorBlock$IterationContext.accept(IteratorBlock.java:242) at freemarker.core.Environment.visitIteratorBlock(Environment.java:642) at freemarker.core.IteratorBlock.acceptWithResult(IteratorBlock.java:107) at freemarker.core.IteratorBlock.accept(IteratorBlock.java:93) at freemarker.core.Environment.visit(Environment.java:330) at freemarker.core.Environment.visit(Environment.java:336) at freemarker.core.Environment.process(Environment.java:309) at freemarker.template.Template.process(Template.java:384) at puu.page.PageHandler.getRendered(PageHandler.java:550) ... 36 common frames omitted Caused by: java.lang.IllegalAccessException: class freemarker.ext.beans.BeansWrapper cannot access a member of class com.google.common.collect.AbstractListMultimap with modifiers "public volatile" at java.base/jdk.internal.reflect.Reflection.newIllegalAccessException(Reflection.java:361) at java.base/java.lang.reflect.AccessibleObject.checkAccess(AccessibleObject.java:591) at java.base/java.lang.reflect.Method.invoke(Method.java:558) at freemarker.ext.beans.BeansWrapper.invokeMethod(BeansWrapper.java:1505) at freemarker.ext.beans.SimpleMethodModel.exec(SimpleMethodModel.java:72) ... 52 common frames omitted
Tested in 2.3.29, 2.3.28, 2.3.23. Strangely it occasionally randomly does work.