So, this blog is basically saying that if you want to have backwards compatible code, don't use libraries that aren't backwards compatible? This seems like a pretty basic concept to me. :-)
Actually, his problem was probably caused by a string concatenation that the compiler tried to optimize. In my experience, all you have to do is use a little common sense and work a bit and your code should be perfectly backward compatible. (using the Sun compiler rather than ejc or something like that is helpful too)
@guymac
Then these options are evil catch. I wonder how JDK can compile 1.4-compatible code when I use, for example, generics in it? .class bytecode AFAIK contains JRE's minimal version number, inside which it can run. So compiler should obey these options fullier and not to allow to successfully build a project, in which I try to compile my (forced to) 1.4 code against any 1.5 libraby, be it genuine Sun package or third party one.
Comments
csar replied ago:
This seems not to be so rare, I also ran into this: http://www.saager.org/2006/08/12/to-deprecate-or-to-be-deprecated.html (See there also how you can cause trouble using JDK6 to produce code that won't compile without any clean remedy),
daniel replied ago:
So, this blog is basically saying that if you want to have backwards compatible code, don't use libraries that aren't backwards compatible? This seems like a pretty basic concept to me. :-)
Actually, his problem was probably caused by a string concatenation that the compiler tried to optimize. In my experience, all you have to do is use a little common sense and work a bit and your code should be perfectly backward compatible. (using the Sun compiler rather than ejc or something like that is helpful too)
guymac replied ago:
Isn't this obvious? The -source and -target switches only check syntax / language features, not use of particular API methods / classes.
unchqua replied ago:
@guymac
Then these options are evil catch. I wonder how JDK can compile 1.4-compatible code when I use, for example, generics in it? .class bytecode AFAIK contains JRE's minimal version number, inside which it can run. So compiler should obey these options fullier and not to allow to successfully build a project, in which I try to compile my (forced to) 1.4 code against any 1.5 libraby, be it genuine Sun package or third party one.
Voters For This Link (14)
Voters Against This Link (0)