Public bug reported:

Binary package hint: bsh

As noted at
http://sourceforge.net/tracker/?func=detail&aid=1781130&group_id=4075&atid=104075
, bsh does not call the correct method when a subclass has the same
static method signature as a superclass.  For example:

class A
{
    public static String foo()
    {
        return "A";
    }
}

class B extends A
{
    public static String foo()
    {
        return "B";
    }
}

public class StaticInherit
{
    public static void main(String[] a)
    {
System.out.println("A.foo: " + A.foo());
System.out.println("(new B()).foo: " + (new B()).foo());
System.out.println("B.foo: " + B.foo());
    }
}

If this file is compiled with javac and run with java, it will output A,
B, B.  However, if entered into Hardy bsh (and run with
StaticInherit.main(new String[]{})), it results in A,  A, A.

This bug has been fixed in beanshell2
(http://code.google.com/p/beanshell2/); see r21
(http://code.google.com/p/beanshell2/source/diff?spec=svn21&old=10&r=21&format=unidiff&path=%2Ftrunk%2Fsrc%2Fbsh%2FReflect.java)
.  It would be great to merge at least this, and it may be wise to start
using them as upstream eventually.

** Affects: bsh (Ubuntu)
     Importance: Undecided
         Status: New

-- 
bsh handles subclassing and static methods incorrectly
https://bugs.launchpad.net/bugs/379304
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to