3
votes

I remember I used to work at a company that couldn't run their JVM software on the OpenJDK JVM. They had to use the Oracle JVM. (Full disclosure: they were writing in groovy/grails.)

But I look at a lot of other JVM applications, and they seem to work fine on both JVMs. The OpenJDK JVM seems to be a solid implementation.

Being a Clojure enthusiast, I want to be able to code for both JVMs.

So, specifically:

  1. What are some common "gotchas" which, if you were targeting one JVM, you would have to be careful about when writing for a different JVM?
  2. Are there any language specific pitfalls, especially when it comes to clojure?
  3. When writing a clojure application, is there any common pitfalls in targeting both JVMs?
1
Though a totally valid question that would probably generate some meaningful discussion, I'm not sure that it is appropriate for SO - rmlan
Agree with @rmlan. Try the Clojure mailing list groups.google.com/forum/#!forum/clojure or the #clojure irc channel on freenode.net - Diego Basch
I have to agree -- this is too broad to be a good fit here, despite being an interesting topic. - Charles Duffy
As long as you stay with the public API and don't generate bytecode all should be fine. The problem being, that is not enough in many cases. So if you turn to non-publich API and use for example Unsafe or things like sun.reflect.MagicAccessorImpl you can already get into trouble. Not only because another JVM might not provide them, also because the implementation might differ. When it comes to bytecode I know for sure there is at least one point in which OpenJDK and OracleJDK usually differ and that is for malformed generics. Oracle tends to ignore them, OpenJDK tends to throw a NPE. - blackdrag

1 Answers

4
votes

I don't know of any significant issues between different JDKs for Clojure. We do matrix test builds on several JDK versions and providers - see http://build.clojure.org/job/clojure-test-matrix/ for the current list.