[
https://issues.apache.org/jira/browse/JDO-751?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15144996#comment-15144996
]
Tilmann Zäschke commented on JDO-751:
-------------------------------------
Just to repeat what was send at the end of the telecon: I favour the dual way
of allowing both {{postcode!=null}} and {{postcode.isPresent()}} in JDOQL. The
problem is that this can cause collision if the object referenced by the
{{Optional}} has the same method names as {{Optional}}. Currently, the only
problem occurs if the with {{Optional<List>}} because {{List}} also has a get
method, although with a different signature.
The problem is that, if we allow {{Optional}} methods and at the same time
allow the short-cut with auto-dereferencing then we may get into trouble in
future. If we ever think about admitting method calls on domain objects, then
these could conflict with the methods of {{Optional}}. Similarily, we would be
in trouble if Java ever decides to add a {{isPresent()}} method to {{List}} or
{{Map}} (for whatever reason).
Fun question (not a likely use-case): How do we treat
{{Optional<Optional<Department>>}} where department is null? Should JDOQL do
double-auto-dereferencing?
> Support for Java8 Optional
> --------------------------
>
> Key: JDO-751
> URL: https://issues.apache.org/jira/browse/JDO-751
> Project: JDO
> Issue Type: New Feature
> Components: specification, tck
> Reporter: Andy Jefferson
>
> java.util.Optional provides a feature that is available in other languages.
> Since JDO 3.2 will be for Java8+ then it makes sense to add support for this
> as a "supported persistable type"
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)