[
https://issues.apache.org/jira/browse/FREEMARKER-145?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17134802#comment-17134802
]
Alfio Gloria commented on FREEMARKER-145:
-----------------------------------------
Added a minimal test project.
in ClassIntrospector#addBeanInfoToClassIntrospectionData
Java 8: pdas.get(6).getReadMethod().getReturnType() -> java.nio.file.Path
Java 9: pdas.get(6).getReadMethod().getReturnType() -> sun.nio.fs.UnixPath
I investigated in difference between UnixPath class in java 8 an java 9. The
only difference is that in Java 8 UnixPath extends AbstractPath while in Java 9
it directly implements Path interface.
> Can't access nio Path.getParent() in templates
> ----------------------------------------------
>
> Key: FREEMARKER-145
> URL: https://issues.apache.org/jira/browse/FREEMARKER-145
> Project: Apache Freemarker
> Issue Type: Bug
> Components: engine
> Affects Versions: 2.3.30
> Reporter: Alfio Gloria
> Priority: Major
> Attachments: freemarkertest.zip
>
>
> When using something like ${data.path.parent} freemarker throws an exception
> "The following has evaluated to null or missing" (obviously on a path that
> has non null parent).
> After some investigation i figured out that freemarker does not recognize
> getParent() as a valid bean method.
> This seems due to a condition in ClassIntrospector, line 827:
> if (am.getReturnType() == m.getReturnType())
> where
> am.getReturnType() -> java.nio.file.Path
> m.getReturnType() -> sun.nio.fs.UnixPath
> I don't know the rationale of the aforementioned condition but it seems weird
> to me that I can reference a Path object with ${data.path} but not with
> ${data.path.parent} since they are both sun.nio.fs.UnixPath objects
--
This message was sent by Atlassian Jira
(v8.3.4#803005)