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

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

        at bsh.UtilTargetError.toEvalError(
        at bsh.UtilEvalError.toEvalError(
        at bsh.BSHCastExpression.eval(
        at bsh.Interpreter.eval(
        at bsh.Interpreter.eval(
        at bsh.Interpreter.eval(

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

It doesn't sound right...


This 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 >>
Beanshell-users mailing list
[hidden email]