final ClassLoader classLoader,
final ParserContext parserContext,
final int languageLevel) {
MVEL.COMPILER_OPT_ALLOW_NAKED_METH_CALL = true;
ExpressionCompiler compiler = new ExpressionCompiler( text.trim() );
if ( MVELDebugHandler.isDebugMode() ) {
parserContext.setDebugSymbols( true );
}
synchronized ( COMPILER_LOCK ) {
ClassLoader tempClassLoader = Thread.currentThread().getContextClassLoader();
Thread.currentThread().setContextClassLoader( classLoader );
AbstractParser.setLanguageLevel( languageLevel );
Serializable expr = null;
try {
expr = compiler.compile( parserContext );
} finally {
// make sure that in case of exceptions the context classloader is properly restored
Thread.currentThread().setContextClassLoader( tempClassLoader );
}