Many frameworks, I have seen document the fact that their source code should be build on say jdk1.4.2 , but once compiled and jared, it runs on jdk1.3.x I am not able to understand the logic .. can anyone help?
I can think of at least three cases (importing classes from the default package, using the new keyword "assert", or calling a newly deprecated method) where JDK 1.4's compiler would reject or warn about code that would compile without comment under JDK 1.3.
in case of deprecation, the compiler would warn.. so that is fine .. the assert keyword was introduced in 1.4? and in case of methods which are removed , if the code compiles on 1.3 and run on 1.4, shouldn't it give an error?
Sometimes people will tell you to compile on 1.(x-1) because 1.x will give warnings, because they don't want you to see the warnings and think the code is bad. That's just silly, but it's what some people do.
If you compile code that uses "assert" with the 1.4 compiler, you just get a warning, so again, it's not an error.
But the "import from the default package" thing is a hard error in 1.4. If you have a class Foo in the default package (i.e., not in a package) and another class in a named package, then that second class's source could include
in 1.3, but with the 1.4 compiler, this won't compile.
This is easy enough to fix for the developers, but some people resist it, for some reason.