Skip to content

Commit 30e602c

Browse files
authored
Merge pull request #267 from java2script/master
description only
2 parents 6ae0b6d + 1096819 commit 30e602c

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

sources/net.sf.j2s.core/doc/howItWorks.md

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@ As such, it use the "legacy" version of the transpiler created and formerly main
77
solely by Zhou Renjien. This code was the basis for SwingJS, and by careful adapting Jmol
88
to fit it, we could make it work with this somewhat quirky code. (For example, there is no
99
support for boxing and unboxing numbers -- int i = Integer.valueOf(3) is not properly turned
10-
into just the number 3. I got around this in those early days by just going through all
10+
into just the number 3.) I got around this in those early days by just going through all
1111
(and I mean ALL) of the Jmol code, making sure there were no implicit boxing or unboxing.
1212

1313
The primary issue with this transpiler is that it does not "qualify" method names.
1414
Thus, BufferedWriter.write(char) and BufferedWriter.write(int) both run through the
15-
same method in JavaScript, and (a very complex and time-expensive) algorithm then
15+
same method in JavaScript, and a (very complex and time-expensive) algorithm then
1616
sorts out based on the JavaScript parameter type what is the MOST LIKELY intended
1717
method target. I did a huge amount of refactoring in Jmol to ensure that it almost
1818
never calls overloaded methods like this.
@@ -64,6 +64,7 @@ The full java2script/SwingJS operation involves two parts: Creating the JavaScri
6464
The code for these two parts are well-separated:
6565

6666
net.sf.j2s.core java2script transpiler
67+
6768
net.sf.j2s.java.core SwingJS runtime
6869

6970

@@ -91,14 +92,14 @@ thank you https://bugs.eclipse.org/bugs/show_bug.cgi?id=525280
9192
]
9293

9394

94-
When it is desired to create the transpiler (net.sf.j2s.core.jar):
95+
When it is desired to create the transpiler (j2s.core.jar):
9596

9697
1) Use File...Export...Deployable plug-ins and fragments
9798
(if you do not see this option, check that you are using Eclipse
9899
Enterprise)
99-
2) Choose net.sf.j2s.core (Version x.x.x), check the directory,
100+
2) Choose j2s.core.jar (Version x.x.x), indicate the output directory,
100101
and press finish.
101-
3) Copy this file to the drop-ins directory, restart Eclipse,
102+
3) Copy this file to the dropins directory, restart Eclipse,
102103
and test.
103104
4) Copy this file to the project dist/swingjs folder and also
104105
to the swingjs/ver/x.x.x folder (or appropriate).
@@ -107,12 +108,9 @@ When it is desired to create the transpiler (net.sf.j2s.core.jar):
107108

108109
I do this with a DOS batch file, which also adds a timestamp.
109110

110-
That's it. I advise to NOT change the version number. I know, this
111-
sounds stupid, but if you change that number, installation in Eclipse requires starting Eclipse with a -clean as the first option. https://www.eclipsezone.com//eclipse/forums/t61566.html
112-
This is pain. If you do not do this clean build, Eclipse just
113-
ignores your drop-in.
111+
That's it.
114112

115-
The dist directory also includes SwingJS-site.zip, created from the net.sf.j2s.core.java project.
113+
The dist directory includes SwingJS-site.zip, created from the net.sf.j2s.core.java project.
116114

117115

118116
**SwingJS runtime maintenance**
@@ -130,7 +128,7 @@ The important thing here is to maintain backward compatibility at all times. It
130128
So, basically, you can add to or modify any of the several thousand classes in j2s.net.sf.java.core/src. Just be careful to allow for what is already there to still run. Adding a new class can be a challenge. Note that we have not implemented serialization or accessibility. This was a design decision based on need. We needed applet code to run, and these two features added far too much complexity to the task. So we ignored them. (Serialization, in particular, is probably not ever going to work in JavaScript, because the java2script transpiler does not preserve enough information about variable types to make that work properly.)
131129

132130

133-
Bob Hanson 2019.10.13
131+
Bob Hanson 2019.10.13, 2023.11.13
134132

135133

136134

0 commit comments

Comments
 (0)