A Java to JavaScript transpiler.
OTHER License
Bot releases are hidden (Show)
Optimisation & stabilisation
Published by lgrignon almost 4 years ago
Published by renaudpawlak about 4 years ago
See PR https://github.com/cincheo/jsweet/pull/604 for details.
Published by renaudpawlak over 4 years ago
Published by lgrignon almost 5 years ago
Published by lgrignon over 5 years ago
Published by lgrignon over 5 years ago
Published by renaudpawlak almost 7 years ago
Bug fix version for v2.0.0.
Published by renaudpawlak about 7 years ago
Main new features (see the specifications for full details):
jsweetconfig.json
)jsweet.lang
-> def.js
, jsweet.dom
-> def.dom
, jsweet.util.Globals
-> jsweet.util.Lang
) - older API is deprecated but not removed for backward compatibility$insert
), flexible code replacement annotation (@Replace
), ...Published by renaudpawlak about 7 years ago
This this the second release candidate for JSweet version 2. Compared to rc1, this release contains the improvements below. Many thanks to all the contributors and issue reporters.
equals
method on enums$apply(..)
fixextraSystemPath
option to tune the transpiler path if necessarymoduleResolution
option to enable/disable node module supportPrinterAdapter.addHeader(..)
)@Replace
annotation on constructors (requires new core API)Published by renaudpawlak about 7 years ago
Main new features (see the specifications for full details):
jsweetconfig.json
)jsweet.lang
-> def.js
, jsweet.dom
-> def.dom
, jsweet.util.Globals
-> jsweet.util.Lang
) - older API is deprecated but not removed for backward compatibility$insert
), flexible code replacement annotation (@Replace
), ...Published by renaudpawlak over 7 years ago
JSweet v2 will bring many major improvements, including:
def.*
packagesThe goal of this intermediate release is to have a stable version for those who already want to use JSweet 2 latest capabilities.
Published by renaudpawlak almost 8 years ago
This release contains many bug fixes and new features. It takes into account our last-months experience developing real IONIC/Cordova applications with JSweet, but also many excellent feedbacks from the community (many thanks to the reporters!).
def.*
packages). Now, you can easily write bridges to JavaScript libs in your project if you don't find the corresponding candy. For your definitions to be taken into account, the definitions
option of the compiler needs to be turned on.Object.getClass()
. JSweet now supports expressions such as myObject.getClass() == x.y.z.MyClass.class
.Candies will not be released anymore under the current form. So you should continue using the 1.2 snapshots for this release. Candies will now be publically available for modifications in order to favorize a more collaborative and open approach. This new way of dealing with Candies should be available soon (for the next version).
Published by renaudpawlak over 8 years ago
java.util.function
.instanceof
with functional interfaces (for exemple: if(myFunction instanceof BinaryOperator) { ... }
).Function
.Note: varargs cannot be used in overloaded methods
Published by renaudpawlak over 8 years ago
public class C {
private int size;
public int size() {
return size;
}
}
public class C {
private int size;
public int size() {
return size;
}
public int size(int addTo) {
return size + addTo;
}
public int size(String string) {
return string.length;
}
}
public native void m() /*-{
// JS code
}-*/
String[][] array = new String[2][2];
assert array.length == 2;
assert array[0].length == 2;
assert "abc" instanceof String;
assert true instanceof Boolean;
Object object = new MyInterface() { ... };
assert object instanceof MyInterface;
assert typeof("abc") === "string";
o1 == o2; now generates: o1 === o2;
o1 != o2; => o1 !== o2;
Because of the null/undefined duality in JavaScript, there are exceptions when comparing to null literal:
o == null; => o == null;
null == o; => null == o;
o != null; => o != null;
null != o; => null != o;
jsweet.util.Globals.equalsStrict => ===
jsweet.util.Globals.notEqualsStrict => ===
jsweet.util.Globals.equalsLoose => ==
jsweet.util.Globals.notEqualsLoose => ==
$map("a", 1, "b", true) transpiles to {"a": 1, "b": true}
int i = 2;
void m() {
return new Comparator<String> {
@Override
public int compareTo(String s1, String s2) {
System.out.println("here I can access enclosing class fields: "+i);
return ...;
}
};
}
void m() {
final int i = 3;
return new Comparator<String> {
@Override
public int compareTo(String s1, String s2) {
System.out.println("here I can access final variables: "+i);
return ...;
}
};
}
XX.class.getName()
XX.class.getSimpleName()
java.lang.Math.*
java.lang.String.*
Published by renaudpawlak over 8 years ago
This release contains all the important transpiler features, which have been tested as much as possible.
A stable release can be used with corresponding releases of the candies. By using released candies for a given transpiler stable version, you can rely on the fact that candies will not change. You can confidently use them in long term projects.
A candy (JS library) release for release 1.0.0 is called: libname-x.y.z-1.0.0-yyyyMMdd
, where x.y.z
is the version of the candy and yyyyMMdd
is the date at which the candy was released. Candies for stable releases will be released when necessary, but far less often as SNAPSHOT versions.
To keep being updated every day for a given candy, you should use the SNAPSHOT version of the candy: libname-x.y.z-SNAPSHOT
, which follows the TSD updates on a daily basis. There is no warranty that a snapshot version keeps being compatible with a transpiler stable release, so it is advised to update the transpiler on a regular basis (or to use the latest snapshot) when wanting to follow the TSD modifications on a daily basis.
NOTE on 0.0.0
candy versions: a lot of TSD libraries do not have any version number but instead have a version called latest
. In that case, the JSweet candy version is 0.0.0
, which means latest
.
Published by renaudpawlak over 8 years ago
We decided to do a RC1 before the actual release. Please test that it works for your use cases and we will release the ultimate 1.0.0 ASAP :)
IMPORTANT NOTE: candy versions in snapshots will now correspond to the actual versions on TSD. It was not the case before for some obscure reasons. This means that the old candies will eventually be deleted from our repo and that you will need to redo your dependencies (note that this is exceptional and will now be stable). For the ones wanting to use stable versions of the transpiler and of the candies (instead of snapshots), the new release and candy updating process will be fully explained when releasing v1.0.0.
Also, we added some jar packaging features to this release because it appeared like a must for production environments (check the doc's last section on packaging).