Reputation: 1
I need to add more logs to several classes of specific java module (module is compiled, no sources available). I have successfully extracted sources, but i am confused on which JDK version is to be used to re-compile modified classes.
javap -verbose className.class
shows
...
major version: 46
...
Doesn't 46 version
mean that initially class were compiled with JDK 1.2
But source file contains imports from java nio:
import java.nio.ByteBuffer;
which was implemented in the java 5 The question is: How its can be?
Notes:
+ the whole systems running under open-jdk 1.5
+ date of creation module ~2006 year
Upvotes: 0
Views: 151
Reputation: 111259
The compiler generates class files compatible withh older versions when you use the -target command line switch.
The files you have were probably compiled with -source 1.2 target 1.2
. The compatibility only affects what bytecode instructions are used, it doesn't stop you from using newer APIs.
Upvotes: 1