Java2Script maintenance

39 views
Skip to first unread message

ZARZUELA BACHILLER JOSE ANTONIO

unread,
Aug 8, 2011, 6:46:27 AM8/8/11
to java2...@googlegroups.com

Hi,

 

I would be interested in using, upgrading and maintaining this framework. For that it would be very useful to be able to contact the author/owner or the other committer (sebastigurin). I need more information to speed up things.

 

Any help would be appreciated.

 

Thanks in advance.

 


*********************AVISO LEGAL **********************
Este mensaje es privado y confidencial y solamente para la persona a la que va dirigido. Si usted ha recibido este mensaje por error, no debe revelar, copiar, distribuir o usarlo en ningún sentido. Le rogamos lo comunique al remitente y borre dicho mensaje y cualquier documento adjunto que pudiera contener. No hay renuncia a la confidencialidad ni a ningún privilegio por causa de transmisión errónea o mal funcionamiento.
Cualquier opinión expresada en este mensaje pertenece únicamente al autor remitente, y no representa necesariamente la opinión de ISBAN, a no ser que expresamente se diga y el remitente esté autorizado para hacerlo.
Los correos electrónicos no son seguros, no garantizan la confidencialidad ni la correcta recepción de los mismos, dado que pueden ser interceptados, manipulados, destruidos, llegar con demora o incompletos, o con virus. ISBAN no se hace responsable de los cambios, alteraciones, errores u omisiones que pudieran hacerse al mensaje una vez enviado.
Este mensaje sólo tiene una finalidad de información, y no debe interpretarse como una oferta de venta o de compra de valores ni de instrumentos financieros relacionados.

**********************DISCLAIMER*****************
This message is private and confidential and it is intended exclusively for the addressee. If you receive this message by mistake, you should not disseminate, distribute or copy this e-mail. Please inform the sender and delete the message and attachments from your system. No confidentiality nor any privilege regarding the information is waived or lost by any mistransmission or malfunction.
Any views or opinions contained in this message are solely those of the author, and do not necessarily represent those of ISBAN, unless otherwise specifically stated and the sender is authorized to do so.
E-mail transmission cannot be guaranteed to be secure, confidential, or error-free, as information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete, or contain viruses. ISBAN does not accept responsibility for any changes, errors or omissions in the contents of this message after it has been sent.
This message is provided for informational purposes and should not be construed as a solicitation or offer to buy or sell any securities or related financial instruments.

Sebastian Gurin

unread,
Aug 8, 2011, 1:47:33 PM8/8/11
to java2...@googlegroups.com
hi. I think the best is you to ask your questions in this group.

Also, In my free time I'm working in a j2s user guide. The docbook sources of the project are located in http://java2script.googlecode.com/svn/trunk/incubator/net.sf.j2s.doc.user-guide/. From there you can generate html, pdf and eclipse documentation files (BTW the project is an eclipse plugin project that documents j2s).

I recently have upladed a fresh version of the guide at http://j2s.sourceforge.net/j2s-user-guide/dist/. html and pdf available.

I think some sections of the guide can be usefull to you, specially those about j2s sources and advance usage.

Note that this is a work in progress project and some sections need a lot of work. If you are good writing in English feel free to send me patches with corrections or contributions to the guide.

Regards.

P/d : Rengian: I added a link to the user guide in the documentation page of j2s.sf.net project page.

On Mon, 8 Aug 2011 12:46:27 +0200
ZARZUELA BACHILLER JOSE ANTONIO <jzar...@isban.es> wrote:

> Hi,
>
> I would be interested in using, upgrading and maintaining this framework. For that it would be very useful to be able to contact the author/owner or the other committer (sebastigurin). I need more information to speed up things.
>
> Any help would be appreciated.
>
> Thanks in advance.
>
>
> *********************AVISO LEGAL **********************

> Este mensaje es privado y confidencial y solamente para la persona a la que va dirigido. Si usted ha recibido este mensaje por error, no debe revelar, copiar, distribuir o usarlo en ning?n sentido. Le rogamos lo comunique al remitente y borre dicho mensaje y cualquier documento adjunto que pudiera contener. No hay renuncia a la confidencialidad ni a ning?n privilegio por causa de transmisi?n err?nea o mal funcionamiento.
> Cualquier opini?n expresada en este mensaje pertenece ?nicamente al autor remitente, y no representa necesariamente la opini?n de ISBAN, a no ser que expresamente se diga y el remitente est? autorizado para hacerlo.
> Los correos electr?nicos no son seguros, no garantizan la confidencialidad ni la correcta recepci?n de los mismos, dado que pueden ser interceptados, manipulados, destruidos, llegar con demora o incompletos, o con virus. ISBAN no se hace responsable de los cambios, alteraciones, errores u omisiones que pudieran hacerse al mensaje una vez enviado.
> Este mensaje s?lo tiene una finalidad de informaci?n, y no debe interpretarse como una oferta de venta o de compra de valores ni de instrumentos financieros relacionados.


>
> **********************DISCLAIMER*****************
> This message is private and confidential and it is intended exclusively for the addressee. If you receive this message by mistake, you should not disseminate, distribute or copy this e-mail. Please inform the sender and delete the message and attachments from your system. No confidentiality nor any privilege regarding the information is waived or lost by any mistransmission or malfunction.
> Any views or opinions contained in this message are solely those of the author, and do not necessarily represent those of ISBAN, unless otherwise specifically stated and the sender is authorized to do so.
> E-mail transmission cannot be guaranteed to be secure, confidential, or error-free, as information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete, or contain viruses. ISBAN does not accept responsibility for any changes, errors or omissions in the contents of this message after it has been sent.
> This message is provided for informational purposes and should not be construed as a solicitation or offer to buy or sell any securities or related financial instruments.
>

> --
> You received this message because you are subscribed to the Google Groups "Java2Script" group.
> To post to this group, send email to java2...@googlegroups.com.
> To unsubscribe from this group, send email to java2script...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/java2script?hl=en.
>


--
Sebastian Gurin <sgu...@softpoint.org>

JZarzuela

unread,
Aug 9, 2011, 4:08:04 AM8/9/11
to java2...@googlegroups.com
Hi, 

Thanks for the quick response. I asked for the emails because I though this group's activity was stopped.


In our case, the interest in J2S comes from a project we are working on. We need a cross-compilation from Java to JS. It's not related to creating SWT applications that can be seen as HTML in a browser. The idea is not to create a whole application but just event-handlers and "simple" code.

So, we've been looking for something that could suit us and we came across J2S, which looks great for our purposes. After the first tests, now we need more information about some aspects, not related with the Eclipse plugin stuff yet, but with the "coverage" of Java 5 in the JS implementation.

On that aspect, and because the lack of formal information about it, we have "introspected" the JS code to find out what packages and classes inside them are implemented. But it's quite hard and error prone to do it that way. For us, it's a requirement to guide our future users and don't let them code anything in Java that wouldn't work when cross-compiled to JS. At the same time, there are some Java classes, methods, etc, that are a must so we would enhance the JS framework in order to support them.

Another issue for us is to ensure as much as possible that both implementations (native Java and cross-compiled JS) behaves the same. 


So far, we have found some issues that we'll try to solve:
  • Some important missing classes: Our users will need some basic utility classes. So we've looking for an JS implementation to add it to your framework. We already have something that could work (still in progress).
    • Date and Number formatting
    • Some classes in java.math package (i.e.: java.math.BigDecimal)
    • java.lang.Math
    • java.util.Calendar
    • java.util.TimeZone (SimpleTimeZone)
  • Some important missing methods: We have seen that some classes are present but they don't implement all the Java methods present in their counterparts. To detected this is specially difficult for us
  • Exception handling: It's slightly different in JS than in Java
    • Case 1: Code like this: myArray[very_big_index], will throw an ArrayOutOfBoundsException in Java and will return a NULL value in JS. Probably causing a totally different error afterwards. With multi-dimensional arrays it's even worse.
    • Case 2: Code like this: catch(Exception ex) or catch(Throwable th), won't work in JS if a "native" JS error is thrown. They are missed in the "InstanceOf" comparation.
  • Numeric precision: We are not completely sure about if the arithmetic operations (float, double, int, long, etc) will return the same results in both implementations.
  • RegExpr compatible behavior:  We are not completely sure about if the implementation of java.util.regex.Pattern & Matcher will behave the same in Java and JS. 
  • Overload method calls: We have found some differences in how an overload method is called in Java and JS. The first, computes it at compilation time and the second does it at runtime. Resulting in invoking different code in each case.

Now we are just begging with our project and things about these issues will go slowly. But we expect to work on this hardly soon. So, any help with this kind of information about the JS framework we're requesting or with the already found issues I mentioned will be greatly appreciated.


JZarzuela


Sebastian Gurin

unread,
Aug 9, 2011, 11:46:30 AM8/9/11
to java2...@googlegroups.com
Hi J.

I have uploaded a project that I hope can be of some utility for you:

http://java2script.googlecode.com/svn/trunk/incubator/net.sf.j2s.test.mauve/

It is the gnu mauve java test suite (http://sources.redhat.com/mauve/) modified for J2S. You must compile the project using the latest J2S sources from svn for this to work. mauve have tests for each main class in java.lang and java.util, and I have developed tools that run all tests and show reports. It is all in that project, make sure you read readme.txt.

I hope this can help you realizing better what it is working in J2S and what not. I have deployed an OLD version of the tests with reports for java.lang and java.util here: http://yui4java.sourceforge.net/j2sMauve/web/. Please use firefox and disable any javascript debugger and be patient: a lot of js files are loaded..

Now , my reply between your lines about your comments:

On Tue, 9 Aug 2011 01:08:04 -0700 (PDT)
JZarzuela <jzar...@gmail.com> wrote:

> Hi,
>
> Thanks for the quick response. I asked for the emails because I though this
> group's activity was stopped.
>
>
> In our case, the interest in J2S comes from a project we are working on. We
> need a cross-compilation from Java to JS. It's not related to creating SWT
> applications that can be seen as HTML in a browser. The idea is not to
> create a whole application but just event-handlers and "simple" code.
>
> So, we've been looking for something that could suit us and we came across
> J2S, which looks great for our purposes. After the first tests, now we need
> more information about some aspects, not related with the Eclipse plugin
> stuff yet, but with the "coverage" of Java 5 in the JS implementation.
>
> On that aspect, and because the lack of formal information about it, we have
> "introspected" the JS code to find out what packages and classes inside them
> are implemented. But it's quite hard and error prone to do it that way. For
> us, it's a requirement to guide our future users and don't let them code
> anything in Java that wouldn't work when cross-compiled to JS. At the same
> time, there are some Java classes, methods, etc, that are a must so we would
> enhance the JS framework in order to support them.


I will tell my opinion about what is (not) supported and why.

* Java language syntax is mostly well supported
* java.lang.reflection is not supported.
* some parts of java.util, like Date, Calendar and regexp is not supported or only partially supported mainly because the heavy java code involved in its implementation. IMHO J2S author idea here is not to put the big code required for these utils to work inside the j2slib and instead encourage the user to use javascript builtin tools for dates, regexp, etc. BTW, GWT do not support java.util.Date and Calendar I think for the same reason.
* collections and general utilities in java.util work well in general.


>
> Another issue for us is to ensure as much as possible that both
> implementations (native Java and cross-compiled JS) behaves the same.
>
>
> So far, we have found some issues that we'll try to solve:
>

> - *Some important missing classes*: Our users will need some basic

> utility classes. So we've looking for an JS implementation to add it to your
> framework. We already have something that could work (still in progress).

> - Date and Number formatting
> - Some classes in java.math package (i.e.: java.math.BigDecimal)
> - java.lang.Math
> - java.util.Calendar
> - java.util.TimeZone (SimpleTimeZone)
>
>
> - *Some important missing methods*: We have seen that some classes are

> present but they don't implement all the Java methods present in their

> counterparts. *To detected this is specially difficult for us*.
>
>
> - *Exception handling*: It's slightly different in JS than in Java
> - *Case 1*: Code like this: *myArray[very_big_index]*, will throw an

> ArrayOutOfBoundsException in Java and will return a NULL value in JS.
> Probably causing a totally different error afterwards. With
> multi-dimensional arrays it's even worse.

> - *Case 2*: Code like this: catch(Exception ex) or catch(Throwable

> th), won't work in JS if a "native" JS error is thrown. They are missed in
> the "InstanceOf" comparation.
>

We have done some work (reflected in latest sources for eclipse 3.6) about exceptions.

I have solved the problem you mention first but for NullPointerException (se thread named "exceptions" in this group). My problem was that, when a NPE occurs in javascript, a javascript native error is throwed instead of a java.lang.NullPointerException. This break the java reference for a lot of standar classes.

The sollution was: 1) reproduce a native NPE and write a javascript function for detecting native NPEs and 2) modify the compiler for detecting NPEs in catch statements and in the case a native NPE is detected, return a java.lang.NullPointerException object.

If you want to know the changes I made for this, please read changes of Class.js in https://code.google.com/p/java2script/source/detail?r=1114 and changes in ASTKeywordVisitor.java in https://code.google.com/p/java2script/source/detail?r=1115

I think the same can be done for other native exceptions like native array IndexOutOfBounds exceptions like you mention. I only fixed NPEs because they where breaking the API in a lot of places.

BTW, javascript native exceptions can be catched with catch(Throwable.... while java exceptions can be catched with catch(Exception... So that is how we differentiate native exceptions from java exceptions.

>
> - *Numeric precision*: We are not completely sure about if the arithmetic

> operations (float, double, int, long, etc) will return the same results in
> both implementations.


javascript numbers are used, so they are all 32 bits...


>
>
> - *RegExpr compatible behavior*: We are not completely sure about if the

> implementation of java.util.regex.Pattern & Matcher will behave the same in
> Java and JS.
>
>


simple tests works, but I also have detected differences and not working situations in complex tests. I'm also interested in fixing this,


> - *Overload method calls*: We have found some differences in how an

> overload method is called in Java and JS. The first, computes it at
> compilation time and the second does it at runtime. Resulting in invoking
> different code in each case.
>
>


Please fill bug reports at http://sourceforge.net/tracker/?group_id=155436&atid=795800 Provice concrete examples if you can.


> Now we are just begging with our project and things about these issues will
> go slowly. But we expect to work on this hardly soon. So, any help with this
> kind of information about the JS framework we're requesting or with the
> already found issues I mentioned will be greatly appreciated.
>
>

good luck


> JZarzuela


>
>
> --
> You received this message because you are subscribed to the Google Groups "Java2Script" group.

> To view this discussion on the web visit https://groups.google.com/d/msg/java2script/-/qdEPuEA0-UcJ.

Reply all
Reply to author
Forward
0 new messages