Skip to content
Louis Grignon edited this page Nov 20, 2016 · 37 revisions

Welcome to the JSweet wiki!

Current target version

Current target: 1.2.0 (see all issues).

Next version (1.3 or 2.0) wishlist

Mixins

Current mixins are not standard and too complicated to use in a regular Java environment (they require a plugin or a specific classpath configuration). We need to make mixins easier. Something like:

public class MyClass extends jsweet.lang.Object { }
@Mixin
public class MyMixin extends MyClass {
  public void addedMethod();
  public String addedProperty
}

Usage:

MyClass o = ...;
o.$mixin(MyMixin.class).addedMethod();

Better jsweet.lang.Object and util APIs

Add/change the following utility methods:

  • <T> T $mixin(Class<T> mixinClass)
  • jsweet.lang.Object $get(String key)
  • ? <T extends jsweet.lang.Object> T $getAs(String key)
  • String $getString(String key)
  • boolean $getBoolean(String key)
  • double $getNumber(String key)
  • Object $getObject(String key)
  • jsweet.lang.Object $apply(Object... args)
  • String $applyForString(Object... args)
  • boolean $applyForBoolean(Object... args)
  • double $applyForNumber(Object... args)
  • Object $applyForObject(Object... args)
  • ? <T extends jsweet.lang.Object> T $any()

Change the current convention of apply() as $apply()

Remove the jsweet.util.Globals.$apply(), jsweet.util.Globals.$get(), jsweet.util.Globals.$set() utility methods (should use the new Object API instead).

Rename jsweet.util.Globals.object() to jsweet.util.Globals.$object() for consistency reason and avoid clashes with local variables. Same for string, number utility methods?

Handle system APIs as regular candies

  • jsweet.dom -> def.dom
  • jsweet.lang -> def.js

We then need to be able to declare the "system" packages to handle special cases (could be a transpiler option or an annotation on the package).

Candies generation tool

Useful for private or custom .d.ts definitions or to scaffold a not properly handled automatically generated candy Example:

mvn jsweet:generate-candy ./typings/myLib/myLib.d.ts ./typings/dependency/dep.d.ts

It could be pretty straightforward to implement by calling the existing online candy generator (simple ajax POST to a Web API: send the .d.ts and its dependencies to the given URL, and download the resulting candy JAR with javadoc)

Clone this wiki locally