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.
Ticket has been migrated to github.
Please follow up on this over here: https://github.com/beanshell/beanshell/issues/201