Janino Autoboxing

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

Janino Autoboxing

by Joe White-3 :: 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.

I have a question regarding Autoboxing and Janino. I was looking at Jira 72 (http://jira.codehaus.org/browse/JANINO-72) which indicates that autoboxing should be supported. I’ve included a test java file that relies on autoboxing below that fails when I attempt to compile it using the Compiler class. Should the test file below be compilable by Janino?

 

Thank you for your help,

Joe White

 

The exception is:

 

File C:\test\TestCompile.java, Line 25, Column 27: Binary numeric promotion not possible on types "java.lang.Double" and "java.lang.Double"

java.lang.RuntimeException: SNO: Conversion failed

 

I ran the test by calling:

 

try{

            String[] files = {"C:/test/TestCompile.java"};

             org.codehaus.janino.Compiler.main(files);

            }catch(Exception e){

                  System.out.println(e);

            }

 

 

/****************************Test Java File**************************************/

package com.sample;

 

public class TestCompile {

 

      public Double test;

      public Double test2;

      public Double getTest() {

            return test;

      }

      public void setTest(Double test) {

            this.test = test;

      }

      public Double getTest2() {

            return test2;

      }

      public void setTest2(Double test2) {

            this.test2 = test2;

      }

     

     

 

      public static void main(String[] args){

            TestCompile t = new TestCompile();

           

            double out = t.getTest()*t.getTest2();

            System.out.println(out);

      }

}


Re: Janino Autoboxing

by Philipp Hagemeister :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

Hi Joe,

which version of Janino and JVM do you use? Testing your test with
2.5.11 and 2.5.13  (with Sun Java 6 Client) yields a correct result (a
null pointer exception on running, no compilation problems), both called
from the command line and with your starter program. The exception looks
like an internal error (somehow confusing Double); but Arno knows
(infinitely ;) ) more.

However, note that Compiler.main is a frontend intended for command line
usage. I'm not sure that that is what you want to achieve when you're
calling from Java coded.

Can you post the complete test as a ZIP file?

Kind Regards,

Philipp Hagemeister


Joe White wrote:
| I have a question regarding Autoboxing and Janino. I was looking at Jira
| 72 (http://jira.codehaus.org/browse/JANINO-72) which indicates that
| autoboxing should be supported. I've included a test java file that
| relies on autoboxing below that fails when I attempt to compile it using
| the Compiler class. Should the test file below be compilable by Janino?
|
|
|
| Thank you for your help,
|
| Joe White
|
|
|
| The exception is:
|
|
|
| File C:\test\TestCompile.java, Line 25, Column 27: Binary numeric
| promotion not possible on types "java.lang.Double" and
| "java.lang.Double"
|
| java.lang.RuntimeException: SNO: Conversion failed
|
|
|
| I ran the test by calling:
|
|
|
| try{
|
|             String[] files = {"C:/test/TestCompile.java"};
|
|              org.codehaus.janino.Compiler.main(files);
|
|             }catch(Exception e){
|
|                   System.out.println(e);
|
|             }
|
|
|
|
|
| /****************************Test Java
| File**************************************/
|
| package com.sample;
|
|
|
| public class TestCompile {
|
|
|
|       public Double test;
|
|       public Double test2;
|
|       public Double getTest() {
|
|             return test;
|
|       }
|
|       public void setTest(Double test) {
|
|             this.test = test;
|
|       }
|
|       public Double getTest2() {
|
|             return test2;
|
|       }
|
|       public void setTest2(Double test2) {
|
|             this.test2 = test2;
|
|       }
|
|
|
|
|
|
|
|       public static void main(String[] args){
|
|             TestCompile t = new TestCompile();
|
|
|
|             double out = t.getTest()*t.getTest2();
|
|             System.out.println(out);
|
|       }
|
| }
|
|

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.7 (GNU/Linux)

iD8DBQFH/pey9eq1gvr7CFwRCsVzAKCHsOURaxU5kXmJXsPirqN/zK1R+wCfaO1g
fvSKmLCXRUI3CCgFnwzgq00=
=4vpL
-----END PGP SIGNATURE-----

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

    http://xircles.codehaus.org/manage_email



RE: Janino Autoboxing

by Joe White-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Phillip,
Thank you for your quick response. Since receiving your email I have
discovered that Drools libraries appear to be the culprit of the error
in my test. If I run the test with none of the drools libraries on the
classpath (or with janino.jar first) it works perfectly. If the Drools
library is on the classpath it fails as I published earlier.

The list of jars in the Drools library is included below. Do you know of
any of the jars listed below that could conflict with Janino to
potentially cause problems? I will also go back to the drools mailing
list and see if I can track down the issue on that side of things.

Thank you for your help,

Joe


antlr-runtime.jar
drools-compiler.jar
drools-core.jar
drools-decisiontables.jar
drools-jsr94.jar
jsr94.jar
junit.jar
jxl.jar
mvel14.jar
xercesImpl.jar
xml-apis.jar
xpp3.jar
xpp3_min.jar
xstream.jar
org.eclipse.jdt.core_3.2.3.v_686_R32x.jar


-----Original Message-----
From: Philipp Hagemeister [mailto:phihag@...]
Sent: Thursday, April 10, 2008 4:42 PM
To: Joe White
Cc: user@...
Subject: Re: [janino-user] Janino Autoboxing

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

Hi Joe,

which version of Janino and JVM do you use? Testing your test with
2.5.11 and 2.5.13  (with Sun Java 6 Client) yields a correct result (a
null pointer exception on running, no compilation problems), both called
from the command line and with your starter program. The exception looks
like an internal error (somehow confusing Double); but Arno knows
(infinitely ;) ) more.

However, note that Compiler.main is a frontend intended for command line
usage. I'm not sure that that is what you want to achieve when you're
calling from Java coded.

Can you post the complete test as a ZIP file?

Kind Regards,

Philipp Hagemeister


Joe White wrote:
| I have a question regarding Autoboxing and Janino. I was looking at
Jira
| 72 (http://jira.codehaus.org/browse/JANINO-72) which indicates that
| autoboxing should be supported. I've included a test java file that
| relies on autoboxing below that fails when I attempt to compile it
using
| the Compiler class. Should the test file below be compilable by
Janino?
|
|
|
| Thank you for your help,
|
| Joe White
|
|
|
| The exception is:
|
|
|
| File C:\test\TestCompile.java, Line 25, Column 27: Binary numeric
| promotion not possible on types "java.lang.Double" and
| "java.lang.Double"
|
| java.lang.RuntimeException: SNO: Conversion failed
|
|
|
| I ran the test by calling:
|
|
|
| try{
|
|             String[] files = {"C:/test/TestCompile.java"};
|
|              org.codehaus.janino.Compiler.main(files);
|
|             }catch(Exception e){
|
|                   System.out.println(e);
|
|             }
|
|
|
|
|
| /****************************Test Java
| File**************************************/
|
| package com.sample;
|
|
|
| public class TestCompile {
|
|
|
|       public Double test;
|
|       public Double test2;
|
|       public Double getTest() {
|
|             return test;
|
|       }
|
|       public void setTest(Double test) {
|
|             this.test = test;
|
|       }
|
|       public Double getTest2() {
|
|             return test2;
|
|       }
|
|       public void setTest2(Double test2) {
|
|             this.test2 = test2;
|
|       }
|
|
|
|
|
|
|
|       public static void main(String[] args){
|
|             TestCompile t = new TestCompile();
|
|
|
|             double out = t.getTest()*t.getTest2();
|
|             System.out.println(out);
|
|       }
|
| }
|
|

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.7 (GNU/Linux)

iD8DBQFH/pey9eq1gvr7CFwRCsVzAKCHsOURaxU5kXmJXsPirqN/zK1R+wCfaO1g
fvSKmLCXRUI3CCgFnwzgq00=
=4vpL
-----END PGP SIGNATURE-----

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

    http://xircles.codehaus.org/manage_email



RE: Janino Autoboxing

by Joe White-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Phillip,

My previous email can be ignored. I found an antique version of Janino
hiding in a library from a totally different part of my project.

Thanks again for your help,

Joe

-----Original Message-----
From: Philipp Hagemeister [mailto:phihag@...]
Sent: Thursday, April 10, 2008 4:42 PM
To: Joe White
Cc: user@...
Subject: Re: [janino-user] Janino Autoboxing

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

Hi Joe,

which version of Janino and JVM do you use? Testing your test with
2.5.11 and 2.5.13  (with Sun Java 6 Client) yields a correct result (a
null pointer exception on running, no compilation problems), both called
from the command line and with your starter program. The exception looks
like an internal error (somehow confusing Double); but Arno knows
(infinitely ;) ) more.

However, note that Compiler.main is a frontend intended for command line
usage. I'm not sure that that is what you want to achieve when you're
calling from Java coded.

Can you post the complete test as a ZIP file?

Kind Regards,

Philipp Hagemeister


Joe White wrote:
| I have a question regarding Autoboxing and Janino. I was looking at
Jira
| 72 (http://jira.codehaus.org/browse/JANINO-72) which indicates that
| autoboxing should be supported. I've included a test java file that
| relies on autoboxing below that fails when I attempt to compile it
using
| the Compiler class. Should the test file below be compilable by
Janino?
|
|
|
| Thank you for your help,
|
| Joe White
|
|
|
| The exception is:
|
|
|
| File C:\test\TestCompile.java, Line 25, Column 27: Binary numeric
| promotion not possible on types "java.lang.Double" and
| "java.lang.Double"
|
| java.lang.RuntimeException: SNO: Conversion failed
|
|
|
| I ran the test by calling:
|
|
|
| try{
|
|             String[] files = {"C:/test/TestCompile.java"};
|
|              org.codehaus.janino.Compiler.main(files);
|
|             }catch(Exception e){
|
|                   System.out.println(e);
|
|             }
|
|
|
|
|
| /****************************Test Java
| File**************************************/
|
| package com.sample;
|
|
|
| public class TestCompile {
|
|
|
|       public Double test;
|
|       public Double test2;
|
|       public Double getTest() {
|
|             return test;
|
|       }
|
|       public void setTest(Double test) {
|
|             this.test = test;
|
|       }
|
|       public Double getTest2() {
|
|             return test2;
|
|       }
|
|       public void setTest2(Double test2) {
|
|             this.test2 = test2;
|
|       }
|
|
|
|
|
|
|
|       public static void main(String[] args){
|
|             TestCompile t = new TestCompile();
|
|
|
|             double out = t.getTest()*t.getTest2();
|
|             System.out.println(out);
|
|       }
|
| }
|
|

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.7 (GNU/Linux)

iD8DBQFH/pey9eq1gvr7CFwRCsVzAKCHsOURaxU5kXmJXsPirqN/zK1R+wCfaO1g
fvSKmLCXRUI3CCgFnwzgq00=
=4vpL
-----END PGP SIGNATURE-----

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

    http://xircles.codehaus.org/manage_email