Beanshell - using arraylist

I use beanshell and I want to use arraylist

My code is

import java.util.*; List test= new ArrayList(); test.add("Last Name"); 

But I get the 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

+4
source share
2 answers

You need to determine the type of ArrayList. Here you would do it as follows:

 List<String> test = new ArrayList<String>(); 
+2
source

Try ArrayList test = new ArrayList(); It worked for me. Guess that BeanShell is not working with polymorphism.

+1
source

All Articles