[ 
https://issues.apache.org/jira/browse/FREEMARKER-24?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15712836#comment-15712836
 ] 

Daniel DeGroff commented on FREEMARKER-24:
------------------------------------------

In the original issue linked above on SourceForge [~ddek...@freemail.hu] 
indicates FreeMarker is using {{java.bean.Introspector}}. 

There is an open JDK bug for the {{java.bean.Introspector}} ignoring default 
methods.  [JDK-8071693|https://bugs.openjdk.java.net/browse/JDK-8071693] If 
this is the root cause then this issue affects all FreeMarker versions and is 
not a FreeMarker bug. I have observed it on version {{2.3.23}}. 



> Support of default methods in object model
> ------------------------------------------
>
>                 Key: FREEMARKER-24
>                 URL: https://issues.apache.org/jira/browse/FREEMARKER-24
>             Project: Apache Freemarker
>          Issue Type: Improvement
>          Components: engine
>    Affects Versions: 2.3.24-incubating
>            Reporter: Emmanuel Keller
>            Priority: Minor
>
> The default object method model currently does not support default methods:
> https://docs.oracle.com/javase/tutorial/java/IandI/defaultmethods.html
> Here is the current error:
> {noformat}
> FTL stack trace ("~" means nesting-related):
>       - Failed at: #if task.switchable  [in template "...../home.ftl" at line 
> 43, column 25]
> ----
>       at 
> freemarker.core.InvalidReferenceException.getInstance(InvalidReferenceException.java:131)
>       at 
> freemarker.core.UnexpectedTypeException.newDesciptionBuilder(UnexpectedTypeException.java:77)
>       at 
> freemarker.core.UnexpectedTypeException.<init>(UnexpectedTypeException.java:40)
>       at 
> freemarker.core.NonBooleanException.<init>(NonBooleanException.java:44)
>       at freemarker.core.Expression.modelToBoolean(Expression.java:142)
>       at freemarker.core.Expression.evalToBoolean(Expression.java:125)
>       at freemarker.core.Expression.evalToBoolean(Expression.java:110)
>       at freemarker.core.ConditionalBlock.accept(ConditionalBlock.java:46)
>       at freemarker.core.Environment.visit(Environment.java:324)
>       at freemarker.core.MixedContent.accept(MixedContent.java:54)
>       at 
> freemarker.core.Environment.visitByHiddingParent(Environment.java:345)
>       at 
> freemarker.core.IteratorBlock$IterationContext.executeNestedBlockInner(IteratorBlock.java:240)
>       at 
> freemarker.core.IteratorBlock$IterationContext.executeNestedBlock(IteratorBlock.java:220)
>       at 
> freemarker.core.IteratorBlock$IterationContext.accept(IteratorBlock.java:194)
>       at freemarker.core.Environment.visitIteratorBlock(Environment.java:572)
>       at freemarker.core.IteratorBlock.acceptWithResult(IteratorBlock.java:78)
>       at freemarker.core.IteratorBlock.accept(IteratorBlock.java:64)
>       at freemarker.core.Environment.visit(Environment.java:324)
>       at freemarker.core.MixedContent.accept(MixedContent.java:54)
>       at freemarker.core.Environment.visit(Environment.java:324)
>       at freemarker.core.Environment.process(Environment.java:302)
>       at freemarker.template.Template.process(Template.java:325)
>       at com.qwazr.tools.FreeMarkerTool.template(FreeMarkerTool.java:86)
>       at com.qwazr.tools.FreeMarkerTool.template(FreeMarkerTool.java:101)
> {noformat}
> To reproduce this.
> 1. Use an interface
> {code:java}
> public interface UpdatableTask extends Runnable {
>     default boolean isSwitchable() {
>         return false;
>     }
> }
> {code}
> 2. Use an object that implements this interface with the following template:
> {code}
> <#if task.switchable>
> ...
> </#if>
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to