JS: fix native toString in Java String class

Fix #847
This commit is contained in:
Alexey Andreev 2023-11-05 10:20:49 +01:00
parent 8b6c6a5ca9
commit 485d23d675

View File

@ -176,8 +176,8 @@ public class Renderer implements RenderingManager {
}
private void renderJavaStringToString() {
writer.appendClass("java.lang.String").append(".prototype.toString").ws().append("=").ws().append("()")
.sameLineWs().append("=>").ws().append("{").indent().softNewLine();
writer.appendClass("java.lang.String").append(".prototype.toString").ws().append("=").ws()
.append("function()").ws().append("{").indent().softNewLine();
writer.append("return ").appendFunction("$rt_ustr").append("(this);").softNewLine();
writer.outdent().append("};").newLine();
writer.appendClass("java.lang.String").append(".prototype.valueOf").ws().append("=").ws()
@ -186,7 +186,7 @@ public class Renderer implements RenderingManager {
private void renderJavaObjectToString() {
writer.appendClass("java.lang.Object").append(".prototype.toString").ws().append("=").ws()
.append("()").sameLineWs().append("=>").ws().append("{").indent().softNewLine();
.append("function()").ws().append("{").indent().softNewLine();
writer.append("return ").appendFunction("$rt_ustr").append("(")
.appendMethodBody(Object.class, "toString", String.class).append("(this));")
.softNewLine();