Requesting new features

View: New views
5 Messages — Rating Filter:   Alert me  

Parent Message unknown Requesting new features

by Ilya Nedoluzhko :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Dear author of Janino!

Your API proved very useful for me, but there a some restrictions which
makes me grieve.
1) Why package definition is not supported? It is very useful because in
case of defined package I don't need to import some classes which are
physically located in this package. Moreover, in this case code to be
excuted will be absolutely legal to be exported into *.java file and
compiled using JDK, if it exists.
2) While it is crucial to keep library size small - I agree, it is
necessary to support new Java 5 features, such as templates, foreach-style
cycles and autoboxing. Especially the last ones, because of importance in
scripting.

Thank you for your work and good luck!
Ilya Nedoluzhko aka RebornCrusader

Re: Requesting new features

by Arno Unkrig :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Ilya Nedoluzhko wrote:
1) Why package definition is not supported? It is very useful because in case of defined package I don't need to import some classes which are physically located in this package. Moreover, in this case code to be excuted will be absolutely legal to be exported into *.java file and compiled using JDK, if it exists.
Hm. I don't quite get your point. All of ExpressionEvaluator, ScriptEvaluator and ClassBodyEvaluator support a setClassName() method, which allows you to define a custom class name and package.

SimpleCompiler and Compiler compile complete compilation units, where you can define your package and class name yourself.

So where is your problem?

2) While it is crucial to keep library size small - I agree, it is necessary to support new Java 5 features, such as templates, foreach-style cycles and autoboxing. Especially the last ones, because of importance in scripting.
I added this as a feature request to JIRA, see

http://jira.codehaus.org/browse/JANINO-72

Please register on CODEHAUS JIRA and click "Watch it" on that page to monitor progress.

CU

Arno


Re: Requesting new features

by Ilya Nedoluzhko :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.
On 1/7/07, Arno Unkrig <arno@...> wrote:
Hm. I don't quite get your point. All of ExpressionEvaluator, ScriptEvaluator and ClassBodyEvaluator support a setClassName() method, which allows you to define a custom class name and package.

SimpleCompiler and Compiler compile complete compilation units, where you can define your package and class name yourself.

So where is your problem?


I anticipated that it is possible to use java-class source file "as is" without any additional external calls. It seems I can't just read and execute, I need to "setClassName". So, if I want to launch such code...
====================================
package my.cool.package;

public class My  {
    // etc.
}

====================================
...I have to cut first row, call setClassName() method and use generic procedure to launch code? It is not a problem, but why don't to do this inside Janino?

2) While it is crucial to keep library size small - I agree, it is necessary to support new Java 5 features, such as templates, foreach-style cycles and autoboxing. Especially the last ones, because of importance in scripting.
I added this as a feature request to JIRA, see
That's nice, but I think autoboxing isn't the only thing to care about. There a many other things that are very usefull. Anyway, it is better than nothing.
 
Best regards, 
Ilya Nedoluzhko aka RebornCrusader

Re: Requesting new features

by Arno Unkrig :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Ilya,

Ilya Nedoluzhko schrieb:
...

> I anticipated that it is possible to use java-class source file "as is"
> without any additional external calls. It seems I can't just read and
> execute, I need to "setClassName". So, if I want to launch such code...
> ====================================
> package my.cool.package;
>
> public class My  {
>     // etc.
> }
>
> ====================================
> ...I have to cut first row, call setClassName() method and use generic
> procedure to launch code? It is not a problem, but why don't to do this
> inside Janino?

Now I got your point. Just call

     Reader r = new StringRead(
         "package my.cool.package; public class My { ... }"
     );
     Class c = new SimpleCompiler(null, r)
         .getClassLoader()
         .loadClass("my.cool.package.My");

That should do the job.

>
>         2) While it is crucial to keep library size small - I agree, it
>         is necessary to support new Java 5 features, such as templates,
>         foreach-style cycles and autoboxing. Especially the last ones,
>         because of importance in scripting.
>
>     I added this as a feature request to JIRA, see
>
> That's nice, but I think autoboxing isn't the only thing to care about.
> There a many other things that are very usefull. Anyway, it is better
> than nothing.

Feel free to post them on JIRA!


CU

Arno


---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email


static imports

by Mark Proctor :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

In JBoss Rules we allow users to use "functions" in their code, this
currently involves regexp muning to turn it into a static method call.
However
We are getting to the stage where this is just getting nasty. We have
since found that the Eclipse JDT compiler allows you to use static
imports and still  target jdk1.4 bytecode, so we are now thinking of
adopting this to ease our coding. The downside of this means that unless
Janino was able to support static imports we may have to drop support
for Janino in JBoss Rules. So my request is, could static import support
be built into Janino?

Thanks

Mark

---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email