Beanshell - using arraylist

Coder picture Coder · Jul 20, 2012 · Viewed 7.8k times · Source

I am using beanshell and i want to use arraylist

My code -

import java.util.*; 

List test= new ArrayList();
test.add("Last Name");

But I am getting following exception

Caused by: org.apache.bsf.BSFException: BeanShell script error:Typed variable declaration : 
Attempt to resolve method: add() on undefined variable or class name: test: at Line: 206

Any idea what is causing the problem?

Thanks

Answer

Andrew Yaremchyk picture Andrew Yaremchyk · Jul 5, 2017

Try ArrayList test = new ArrayList(); That worked fine for me. Guess that the BeanShell doesn't work with polymorphism.