I believe the answer is "yes and no" :(
 
<disclaimer - I'm not an expert ... just a user >
 
eval of the script ensures that the structure of the script is valid and "compiles" so thats your "yes".
BUT ... you can still get runtime crashes on things that pure java would give you compile time crashes.
Much of this is due to the defered typing ... and simply cannot be done statically.
 
Simple example
 
 
equals( foo , bar )
{
   return foo.equalsIgnoreCase(bar);
}
 
 
Try to validate this statically ... it will "compile" ...
Running
 
equals( "a" , "b" ) ;     // great
equals( 1 , 2 );          // runtime failure ...
 
 
This is just one obvious example but shows the concept.   This is true actually in pure java too but its a much more constrained set of expressions that can cause errors.
 
So I think the best you can do is eval ...
 
 
 
 
----- Original Message -----
From: Frederic Tardif
To: beanshell-users@lists.sourceforge.net ; Rémy Beaumont
Sent: Monday, March 26, 2007 2:37 PM
Subject: [Beanshell-users] Is it possible to enforce beanshell compilationbefore a release????

Since I did not have a clear answer from my previous email "test script compilation", I will ring the bell again:

I have a bunch of beanshells and I would simply like to do a dummy junit test that "compile" each of them to ensure that they are valid.
Eval of the interpreter seems to do some syntaxic checks but no real compilation verification.
Is there any way of doing this?

It is a big issue for us to ensure the compilation of the scripts before releasing on production environnement.

If it is not possible to do so, we will need to revert our utilisation of the beanshells and move on some other framework that will enforce compilation.

Thanks
Frederic


  


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV


_______________________________________________
Beanshell-users mailing list
Beanshell-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/beanshell-users