Consider an example, hastily taken from a real-life:
public interface SmartResponseData {}
class DeflateOStream extends java.io.OutputStream
implements SmartResponseData {}
public class SmartResponse {
?SmartResponseData os = null;
}
public void finish(SmartResponse sr){
let os = sr.os;
if (os instanceof DeflateOStream) os.close();
}
The "os.close()" here will emit the
aload_N
instanceof DeflateOStream
ifeq NN
aload_N
checkcast java/io/Closable
invokeinterface java/io/Closable.close
under Nice 0.9.12, Java 1.5.0_04.
java/io/Closable is absent from Java 1.4, therefore the
code which is perfectly compatible with Java 1.4
becames incompatible becouse Nice used a Closable
interface to invoke close.
Nice should have preferred direct invocation of
checkcast DeflateOStream
invoke DeflateOStream.close
or nearest invocation of
checkcast java/io/OutputStream
invoke java/io/OutputStream.close
whereas Nice seems to choose which class to use for
invocation just at random.
Logged In: YES
user_id=88952
I was first tempted to answer "why not compile with 1.4 if
you want to be compatible with it?". But I looked into it,
and it might be easy enough to get the desired behaviour. It
might even bring some runtime speedup (in case the JIT does
not optimize it already). I'm checking the change at the moment.
Note that to be sure to be compatible with a certain JRE
version, you better compile with the corresponding JDK, but
I guess you know that ;-)