You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@metamodel.apache.org by kaspersorensen <gi...@git.apache.org> on 2017/05/01 12:24:58 UTC

[GitHub] metamodel pull request #142: Deprecated Ref, Func and Predicate in favor of ...

GitHub user kaspersorensen opened a pull request:

    https://github.com/apache/metamodel/pull/142

    Deprecated Ref, Func and Predicate in favor of java.util.function

    "Ref" to be replaced by Supplier.
    "Func" to be replaced by Function.
    "Predicate" to be replaced by Predicate.
    "Action" to extend Consumer (allowing for throwing checked exceptions).
    "UncheckedFunc to extend Function.
    
    Also added `@SuppressWarning` on method that the Java 8 compiler is
    emitting warnings for while the code being alright.
    
    I think I still need a JIRA issue for this, but any feedback on the code front is very welcome.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/kaspersorensen/metamodel java-8-functions

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/metamodel/pull/142.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #142
    
----
commit f015665d88ae5066e8657575bb01baa7af0a0f13
Author: Kasper S�rensen <i....@gmail.com>
Date:   2017-04-29T23:05:07Z

    Deprecated Ref, Func and Predicate in favor of java.util.function
    
    "Ref" to be replaced by Supplier.
    "Func" to be replaced by Function.
    "Predicate" to be replaced by Predicate.
    "Action" to extend Consumer (allowing for throwing checked exceptions).
    "UncheckedFunc to extend Function.
    
    Also added `@SuppressWarning` on method that the Java 8 compiler is
    emitting warnings for while the code being alright.

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] metamodel pull request #142: Deprecated Ref, Func and Predicate in favor of ...

Posted by tomaszguzialek <gi...@git.apache.org>.
Github user tomaszguzialek commented on a diff in the pull request:

    https://github.com/apache/metamodel/pull/142#discussion_r114184509
  
    --- Diff: core/src/main/java/org/apache/metamodel/CompositeDataContext.java ---
    @@ -27,17 +27,17 @@
     import java.util.List;
     import java.util.Map;
     import java.util.Set;
    +import java.util.function.Function;
     
     import org.apache.metamodel.data.DataSet;
     import org.apache.metamodel.query.FromItem;
     import org.apache.metamodel.query.Query;
     import org.apache.metamodel.schema.CompositeSchema;
     import org.apache.metamodel.schema.Schema;
     import org.apache.metamodel.schema.Table;
    -import org.apache.metamodel.util.Func;
     import org.slf4j.Logger;
     import org.slf4j.LoggerFactory;
    -
    +//
    --- End diff --
    
    I guess this is some leftover...


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] metamodel issue #142: Deprecated Ref, Func and Predicate in favor of java.ut...

Posted by LosD <gi...@git.apache.org>.
Github user LosD commented on the issue:

    https://github.com/apache/metamodel/pull/142
  
    Haven't checked line-by-line, but approach LGTM, and happy to see standard classes replacing our own. 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] metamodel issue #142: Deprecated Ref, Func and Predicate in favor of java.ut...

Posted by kaspersorensen <gi...@git.apache.org>.
Github user kaspersorensen commented on the issue:

    https://github.com/apache/metamodel/pull/142
  
    I'm gonna take that as a go-ahead. But thinking about it a bit more, I guess it shouldn't be merged to master, but rather the `5.x` branch since this is going to require Java 8.
    
    I'll prepare the branch to be `5.x` compatible.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] metamodel pull request #142: Deprecated Ref, Func and Predicate in favor of ...

Posted by kaspersorensen <gi...@git.apache.org>.
Github user kaspersorensen commented on a diff in the pull request:

    https://github.com/apache/metamodel/pull/142#discussion_r114239647
  
    --- Diff: core/src/main/java/org/apache/metamodel/CompositeDataContext.java ---
    @@ -27,17 +27,17 @@
     import java.util.List;
     import java.util.Map;
     import java.util.Set;
    +import java.util.function.Function;
     
     import org.apache.metamodel.data.DataSet;
     import org.apache.metamodel.query.FromItem;
     import org.apache.metamodel.query.Query;
     import org.apache.metamodel.schema.CompositeSchema;
     import org.apache.metamodel.schema.Schema;
     import org.apache.metamodel.schema.Table;
    -import org.apache.metamodel.util.Func;
     import org.slf4j.Logger;
     import org.slf4j.LoggerFactory;
    -
    +//
    --- End diff --
    
    Hmm yes, odd, I don't recall why though, but will remove shortly.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] metamodel issue #142: Deprecated Ref, Func and Predicate in favor of java.ut...

Posted by kaspersorensen <gi...@git.apache.org>.
Github user kaspersorensen commented on the issue:

    https://github.com/apache/metamodel/pull/142
  
    Any final verdicts from anyone?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] metamodel pull request #142: Deprecated Ref, Func and Predicate in favor of ...

Posted by kaspersorensen <gi...@git.apache.org>.
Github user kaspersorensen closed the pull request at:

    https://github.com/apache/metamodel/pull/142


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] metamodel issue #142: Deprecated Ref, Func and Predicate in favor of java.ut...

Posted by LosD <gi...@git.apache.org>.
Github user LosD commented on the issue:

    https://github.com/apache/metamodel/pull/142
  
    Aren't all the `@SuppressWarning("resource")` hiding actual bad code?
    
    I remember looking into our `Closeable` usage before and being horrified.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] metamodel issue #142: Deprecated Ref, Func and Predicate in favor of java.ut...

Posted by kaspersorensen <gi...@git.apache.org>.
Github user kaspersorensen commented on the issue:

    https://github.com/apache/metamodel/pull/142
  
    Oh, I guess they may be eclipse-specific, although I hope not. I did evaluate each case of adding the annotation, and felt that they where all safe cases. But in general I agree that I prefer to fix the cause of the warning. Sometimes the compilers/tools analysis is wrong though; typically when you wrap a closeable in another closeable, you shouldn't close the inner object because that would make the wrapper object unusable (an example of this in MetaModel is around `DataSet` implementations that wrap other `DataSet`s).


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---