What version number to put in JVM class files
I'm writing a compiler that targets the JVM, using the ASM library to
generate class files. JVM class files have a version number field and I'm
trying to figure out what I should put there.
An obvious possibility would be, since I happen to be using Java 1.7, to
put 51, the number corresponding to that version. However, to the best of
my knowledge there's no reason somebody shouldn't be able to use my
compiler to write programs targeting e.g. Java 1.6, so hardcoding that
version number would break that use case.
Is there some minimal/baseline version number such that you can say "it's
safe to use this, it marks the last actual change in the byte code format
or JVM semantics and everything afterwards will support it"?
Conversely, maybe the best option would be to take the version number of
the JVM the compiler is running under? If so, which of the many different
Java version properties accessible at run time, should be used for this
purpose?
No comments:
Post a Comment