[ 
https://issues.apache.org/jira/browse/OPENJPA-2894?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Pawel Veselov updated OPENJPA-2894:
-----------------------------------
    Description: 
>From {{PredicateImpl}}:
{code:java}
    public PredicateImpl add(Expression<Boolean> s) {
        synchronized (_exps) {
                _exps.add((Predicate)s); // all boolean expressions are 
Predicate
                }
        return this;
    }
{code}

However, a function that returns a boolean is an {{Expression<Boolean>}}, but 
is not a {{Predicate}}

Test case: 
https://github.com/veselov/Standalone-JPA-Test-Demo/tree/OPENJPA-2894 (run 
{{mvn package}} on JDK 1.8)


  was:
>From {{PredicateImpl}}:
{code:java}
    public PredicateImpl add(Expression<Boolean> s) {
        synchronized (_exps) {
                _exps.add((Predicate)s); // all boolean expressions are 
Predicate
                }
        return this;
    }
{code}

However, a function that returns a boolean is an {{Expression<Boolean>}}, but 
is not a {{Predicate}}

Test case: 
https://github.com/veselov/Standalone-JPA-Test-Demo/tree/OPENJPA-2894 (run 
{{mvn package}} on JDK 1.8)
I'm going to try fixing this by just removing {{Predicate}} type cast, it just 
looks wrong.



> All boolean expressions are not predicates
> ------------------------------------------
>
>                 Key: OPENJPA-2894
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-2894
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: criteria
>    Affects Versions: 3.1.2, 3.2.0
>            Reporter: Pawel Veselov
>            Priority: Major
>
> From {{PredicateImpl}}:
> {code:java}
>     public PredicateImpl add(Expression<Boolean> s) {
>       synchronized (_exps) {
>               _exps.add((Predicate)s); // all boolean expressions are 
> Predicate
>               }
>         return this;
>     }
> {code}
> However, a function that returns a boolean is an {{Expression<Boolean>}}, but 
> is not a {{Predicate}}
> Test case: 
> https://github.com/veselov/Standalone-JPA-Test-Demo/tree/OPENJPA-2894 (run 
> {{mvn package}} on JDK 1.8)



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to