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

Tilmann Zäschke commented on JDO-751:
-------------------------------------

I completely agree, that defeats the purpose of {{Optional}} :-). My argument 
is simply that unfortunately the way that Java implements it, you _can_ have a 
{{null}} reference to an {{Optional}}. Of course JDOQL could implement 
different semantics than Java by ignoring the case that a reference to an 
{{Optional}} can be {{null}}, but it it would still be exactly that: different 
semantics. 

We can of course use different semantic in JDOQL and Java. But considering how 
unlikely it is that a Field is of type {{Optional}} (after all it seems to be 
discouraged by the Java people), I'm not sure that the potential benefits of a 
shortcut are worth the potential future risk of deviating from Java.

Yes, comparing an {{Optional}} to {{null}} seems silly, but that doesn't mean 
that nobody is going to do it or even find a clever use for it.

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

Reply via email to