You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@kudu.apache.org by "Dan Burkert (JIRA)" <ji...@apache.org> on 2017/10/10 23:34:00 UTC

[jira] [Commented] (KUDU-2188) kudu-client JAR built via JDK8 depends on Java 8 APIs

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

Dan Burkert commented on KUDU-2188:
-----------------------------------

Fixed by https://github.com/apache/kudu/commit/afdeb9ea218216631ae325b3205c23adb1061037

This issue caused the kudu-client 1.0.0, 1.1.0, 1.2.0, 1.3.0, 1.4.0, and 1.5.0 published jars to be non-compatible with JRE 8.  Since it's not a regression and no one has ever filed a bug about it, I don't think we should consider this an issue worthy of special patch release.

> kudu-client JAR built via JDK8 depends on Java 8 APIs
> -----------------------------------------------------
>
>                 Key: KUDU-2188
>                 URL: https://issues.apache.org/jira/browse/KUDU-2188
>             Project: Kudu
>          Issue Type: Bug
>          Components: java
>    Affects Versions: 1.5.0
>            Reporter: Adar Dembo
>            Assignee: Adar Dembo
>            Priority: Critical
>
> Even though we build our Java artifacts against JDK7 (by specifying source=1.7 and target=1.7) and we try to avoid introducing Java 8 only dependencies, there is one case where we've failed to do that. The issue is with ConcurrentHashMap.keySet(), which returns a Set in Java 7 and a ConcurrentHashMap.KeySetView in Java 8. The latter is a class that only exists in Java 8, but because it's a subtype of Set, it's legal to make that kind of API change.
> We use ConcurrentHashMap.keySet() in our Statistics.getTableSet() method, and as a result, if you build kudu-client using JDK8, you'll end up with a reference to a class that's only found in Java 8.
> I wrote a small test program to verify that this is indeed a problem:
> {noformat}
> import org.apache.kudu.client.Statistics;
> class Main {
>     public static void main(String[] args) {
>         Statistics s = new Statistics();
>         s.getTabletSet();
>     }
> }
> {noformat}
> And, after first building the kudu-client JAR with JDK8, here is how I compiled and ran the test program:
> {noformat}
> $ /opt/toolchain/openjdk-64bit-1.7.0.6/bin/javac -cp kudu/java/kudu-client/target/kudu-client-1.6.0-SNAPSHOT.jar Main.java
> $ /opt/toolchain/openjdk-64bit-1.7.0.6/bin/java -cp kudu/java/kudu-client/target/kudu-client-1.6.0-SNAPSHOT.jar:. Main
> Exception in thread "main" java.lang.NoSuchMethodError: java.util.concurrent.ConcurrentHashMap.keySet()Ljava/util/concurrent/ConcurrentHashMap$KeySetView;
>     at org.apache.kudu.client.Statistics.getTabletSet(Statistics.java:144)
>     at Main.main(Main.java:6)
> {noformat}
> I don't know which of our release artifacts have this issue. This Statistics API is quite old so it presumably affects any that have been built by RMs using JDK8 rather than JDK7.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)