Interesting, I actually crash the interpreter window in BshUII doing the first one ... that has to be a bug not a feature.
 
----- Original Message -----
From: Peter Haensgen
To: beanshell-users@lists.sourceforge.net
Sent: Wednesday, January 24, 2007 6:23 AM
Subject: [Beanshell-users] Interface inheritance


Hi there,

I have a question regarding interface inheritance in BeanShell.
This code:

interface X
{
}

interface Y extends X
{
}

(which is correct in Java) leads to the following exception when executed by the BeanShell interpreter:

Exception in thread "main" java.lang.ClassFormatError: Interfaces must have java.lang.Object as superclass in class file Y

        at java.lang.ClassLoader.defineClass1(Native Method)
        at java.lang.ClassLoader.defineClass(Unknown Source)
        at java.lang.ClassLoader.defineClass(Unknown Source)
        at bsh.classpath.DiscreteFilesClassLoader.findClass(Unknown Source)
        at bsh.classpath.BshClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at bsh.classpath.ClassManagerImpl.classForName(Unknown Source)
        at bsh.classpath.ClassManagerImpl.defineClass(Unknown Source)
        at bsh.ClassGeneratorImpl.generateClassImpl(Unknown Source)
        at bsh.ClassGeneratorImpl.generateClass(Unknown Source)
        at bsh.BSHClassDeclaration.eval(Unknown Source)
        at bsh.Interpreter.eval(Unknown Source)
        at bsh.Interpreter.source(Unknown Source)
        at bsh.Interpreter.main(Unknown Source)

If I replace the "extends" by an "implements", e.g.

interface X
{
}

interface Y implements X
{
}

everything works fine. However, I would expect that "extends" would work like in Java.

Is this a (known?) bug, or is it a feature?

I'm using bsh-2.0b4.jar.

thanx,
Peter


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV


_______________________________________________
Beanshell-users mailing list
Beanshell-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/beanshell-users