Skip to content
This repository has been archived by the owner on Jun 28, 2019. It is now read-only.

[limitations] J2S limitations

qi.zhang edited this page Dec 23, 2013 · 1 revision

This page tries to summarize what we see as J2S limitations for MayLoon, and the solutions/workarounds available.


  • Dependency handling for derived classes
If you try to construct an instance of derived class in the base class, j2s class loader will fail to find the derived class.

Workaroud: Use reflection to find the derived class.

Reference: git commit 989e3934f11bd8062b1945282b60584a90bdb0c1 - "Using java reflection to fix the former bug"

  • No String.length()
Some java lib class implementation use this method, like Pattern.spit(CharSequence cs) which could not be replaced by String(str).length directly.

Workaround: Replace the parameter String to StringBuilder or StringBuffer works. CharSequence is an interface that has Length() method, and String is an implementation of CharSequence.

  • Support for jave enum
Is not perfect.

Workaroud: Replace the enum with a class.

Reference: git commit aad5d452a809eef225729c1b64fb36ba4facc143

  • Existing method is complained as undefined because of incorrect override signature
git commit 348556bf172d98562e2c9cde6d523bf85a95a2dc