I have an application which introduces variables into a stack of frames (so that I can have same variable redefined) and I am trying to integrate this with beanshell. I want to be able to make a call to beanshell code through my application passing all the variables defined within my application. I extended NameSpace and things work fine if the variables defined in my app are used only at the top level of the script. But to access them within blocks, I need to refer them using the "this" notation. Which is a pain.
After looking at the issue a little, the problem is that BlockNameSpace doesn't overwrite the getVariable method and directly call the getParent().getVariable(name); As a result, the BlockNameSpace.super's getVariable gets called which inturn ends up calling getParent().getVariableImpl(name,recurse). However, since my extended NameSpace doesn't really store the variables as Variable objects, and as I am not implementing getVariableImpl, it ends up returning null. Hopefully this will be fixed so that it's possible to expose application variables through custom namespaces by just implementing the setVariable and getVariable methods and not the getVariableImpl