#63 polymorphism with hotspot/classic differ

open
nobody
General (151)
5
2002-06-07
2002-06-07
Anonymous
No

Having a script like:

//startscript///////////////////
perform(Callback callbackobject){
callbackobject.install(super);
}
//return (Sub1)this; //switch between the two types..
return (Sub2)this;
//startscript///////////////////

and the classes:

public class Callback {
public void install(Sub1 s){
System.out.println("install(Sub1)");
}
public void install(Sub2 s){
System.out.println("install(Sub1)");
}
}

public class Base{
//...
}
public class Sub1 extends Base{
//...
}
public class Sub2 extends Base{
//...
}

running the script in jdk1.3.0-classic gives correct
output.
running the same in jdk1.3.0-hotspot sometimes takes
wrong install-method!
workaround is to cast return-value to the correct Type:

//startscript///////////////////
perform(Callback callbackobject){
callbackobject.install((Sub2)super);
}
return (Sub2)this;
//startscript///////////////////

...which is not really bad.

The fact that beanshell (or java) behaves different
in -classic mode is really ugly, since we develop in
classic mode cause of the debuggers slow speed with
hotspot.

Discussion

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks