You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by Emmanuel Espina <es...@gmail.com> on 2011/11/08 23:56:23 UTC

ScriptTransformer uses reflection

I was testing the scripting capabilities of Solr and found that the
ScriptTransformer of the DIH has a curiously complex code. It uses Java
reflection where it could have used regular Java objects creation and
method invocation. This has given me some issues testing other scripting
engines.

Does anyone knows/remembers the reason for this use of reflection?

Thanks

Emma

Re: ScriptTransformer uses reflection

Posted by Shalin Shekhar Mangar <sh...@gmail.com>.
On Wed, Nov 9, 2011 at 4:26 AM, Emmanuel Espina <es...@gmail.com>wrote:

>  I was testing the scripting capabilities of Solr and found that the
> ScriptTransformer of the DIH has a curiously complex code. It uses Java
> reflection where it could have used regular Java objects creation and
> method invocation. This has given me some issues testing other scripting
> engines.
>
> Does anyone knows/remembers the reason for this use of reflection?
>

That is because Solr is on Java 5 but the script engine APIs are available
only with Java 6. This is why it inits the engine using reflection and
fails if the classes are not found. I believe Solr 3.x is still on Java 5
so we must continue with that code for a while longer.

-- 
Regards,
Shalin Shekhar Mangar.