freemarker-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Daniel Dekany (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (FREEMARKER-24) Support of default methods in object model
Date Sat, 21 May 2016 06:39:12 GMT

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

Daniel Dekany commented on FREEMARKER-24:
-----------------------------------------

Note that that's the duplicate of https://sourceforge.net/p/freemarker/feature-requests/92/
(see some details there). That's the old tracker, so no problem, leave this open.

> 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
>            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)

Mime
View raw message