Adar Dembo created KUDU-2188:
--------------------------------

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

Reply via email to