BeanShell and Parameterized Classes

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

BeanShell and Parameterized Classes

Jesse Pavel
Hello,

Can BeanShell not work with (the raw version of) types that have parameters?

I have an interface and a class:

public interface IdentifierProvider extends Iterable<String>

public class CTagsFileProvider implements IdentifierProvider, Serializable

and in a BeanShell script, I try to cast an instance of
CTagsFileProvider to IdentifierProvider, with

Interpreter i = new Interpreter();
IdentifierProvider p = (IdentifierProvider)i.eval
        ("(IdentifierProvider)new CTagsFileProvider()");

but I get

Target exception: java.lang.ClassCastException: Cannot cast
com.illengineer.jcc.CTagsFileProvider to com.illengineer.j
cc.IdentifierProvider

        at bsh.UtilTargetError.toEvalError(UtilTargetError.java:70)
        at bsh.UtilEvalError.toEvalError(UtilEvalError.java:90)
        at bsh.BSHCastExpression.eval(BSHCastExpression.java:68)
        at bsh.Interpreter.eval(Interpreter.java:645)
        at bsh.Interpreter.eval(Interpreter.java:739)
        at bsh.Interpreter.eval(Interpreter.java:728)

even though CTagsFileProvider implements that interface, and the cast
can be performed in Java without a hitch.

It doesn't sound right...


Thanks,
Jesse



-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
Beanshell-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/beanshell-users