Menu

#22 Cast doesn't look at all interfaces supported by object

closed-fixed
5
2004-01-01
2004-01-01
No

test4 in the file attached to bug#868686 generates this
error:

net.janino.Java$CompileException: File C:\apps\janino-
1.0.7\tests\src\MiscTests.java, Line 51, Column 30:
Cannot cast "InterfaceA" to "InterfaceB"

Discussion

  • Arno Unkrig

    Arno Unkrig - 2004-01-01

    Logged In: YES
    user_id=865893

    Could reproduce it:

    interface I1 {
    }

    interface I2 {
    }

    public class A implements I1, I2 {
    public static void main(String[] args) {
    A a = new A();
    I1 i1 = a;
    I2 i2 = a;

    i2 = (I2) i1; //// Cannot cast "I1" to "I2"
    }
    }
    Will work on it.

     
  • Arno Unkrig

    Arno Unkrig - 2004-01-01
    • status: open --> closed-fixed
     
  • Arno Unkrig

    Arno Unkrig - 2004-01-01

    Logged In: YES
    user_id=865893

    Missing JLS features 5.1.5.5 ... 5.1.5.7 were implemented.
    Therefore, the new "isPublic()", "isFinal()" and
    "isAbstract()" methods were added to class "IClass".

    (The relevant one here is 5.1.5.7.)

    Will be released with version 1.0.8.

     

Log in to post a comment.