cincheo / jsweet

A Java to JavaScript transpiler.
http://www.jsweet.org
Other
1.46k stars 160 forks source link

Add support for java.lang.String.equals(java.lang.String) #108

Closed artem-frolov closed 8 years ago

artem-frolov commented 8 years ago

I use jsweet for a code that should work in Java and in Javascript. So I can't use jsweet.lang - such code can not be compiled in Java. It would be great to have java.lang.String.equals method implemented to make strings comparison easier.

renaudpawlak commented 8 years ago

Hi there. JSweet it not ready yet for factorizing behavior between Java and JavaScript. What you can do in the meantime is to have a Java implementation in a method annotated with @Erased (so that it is ignored by the JSweet transpiler), and a JS implementation in another method (which you call from the JavaScript part of the program).

lgrignon commented 8 years ago

Hi. It would be simple to just transpile String.equals to == (@artem-frolov, maybe you should PR this) but there is a larger reflexion to have between ==, hashCode, equals and how to make it work properly in both JS & Java worlds.

This may be the good place to discuss it :)

Thanks for your participation

renaudpawlak commented 8 years ago

With version 1.1.0 and J4TS, JSweet is now Java-friendly :)