Skip to content

Commit 881ddf4

Browse files
committed
updates of transpiler and java
1 parent a3ffd03 commit 881ddf4

File tree

12 files changed

+58
-67
lines changed

12 files changed

+58
-67
lines changed
5 Bytes
Binary file not shown.
5 Bytes
Binary file not shown.

sources/net.sf.j2s.core/src/net/sf/j2s/core/astvisitors/Java2ScriptVisitor.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2989,6 +2989,11 @@ private String clazzArray(ITypeBinding type, int dimFlag) {
29892989
return "Clazz.array(" + params + (dimFlag > 0 ? ")" : "");
29902990
}
29912991

2992+
/**
2993+
* .j2s option j2s.compiler.nonqualified.classes
2994+
*
2995+
* @param names semicolon-separated list. For example, org.jmol.api.js;jspecview.api.js
2996+
*/
29922997
public static void setNoQualifiedNamePackages(String names) {
29932998
names = defaultNonQualified + (names == null ? "" : names);
29942999
nonQualifiedPackages = names.split(";");
@@ -3356,7 +3361,7 @@ private void addPrimitiveTypedExpression(Expression left, IVariableBinding assig
33563361
addParens = true;
33573362
break;
33583363
case "short":
3359-
if (right.equals("byte") && !isDiv)
3364+
if ((rightName.equals("short") || rightName.equals("byte")) && !isDiv)
33603365
break;
33613366
//$FALL-THROUGH$
33623367
case "byte":

sources/net.sf.j2s.java.core/src/javajs/api/js/JSInterface.java

Lines changed: 0 additions & 29 deletions
This file was deleted.

sources/net.sf.j2s.java.core/src/javajs/util/AU.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ public static Object arrayCopyObject(Object array, int newLength) {
139139
/**
140140
* @j2sNative
141141
*
142-
* if (Clazz.array && newLength < oldLength) return Clazz.array(-1, array, 0, newLength);
142+
* if (newLength < oldLength) return Clazz.array(-1, array, 0, newLength);
143143
*/
144144
{}
145145
Object t = newInstanceO(array, newLength);
@@ -181,7 +181,7 @@ public static String[] arrayCopyS(String[] array, int newLength) {
181181
/**
182182
* @j2sNative
183183
*
184-
* if (Clazz.array && newLength < oldLength) return Clazz.array(-1, array, 0, newLength);
184+
* if (newLength < oldLength) return Clazz.array(-1, array, 0, newLength);
185185
*/
186186
{}
187187
String[] t = new String[newLength];
@@ -220,7 +220,7 @@ public static float[] arrayCopyF(float[] array, int newLength) {
220220
/**
221221
* @j2sNative
222222
*
223-
* if (Clazz.array && newLength < oldLength) return Clazz.array(-1, array, 0, newLength);
223+
* if (newLength < oldLength) return Clazz.array(-1, array, 0, newLength);
224224
*/
225225
{}
226226
float[] t = new float[newLength];
@@ -237,7 +237,7 @@ public static int[] arrayCopyI(int[] array, int newLength) {
237237
/**
238238
* @j2sNative
239239
*
240-
* if (Clazz.array && newLength < oldLength) return Clazz.array(-1, array, 0, newLength);
240+
* if (newLength < oldLength) return Clazz.array(-1, array, 0, newLength);
241241
*/
242242
{}
243243
int[] t = new int[newLength];
@@ -265,7 +265,7 @@ public static int[] arrayCopyRangeI(int[] array, int i0, int n) {
265265
/**
266266
* @j2sNative
267267
*
268-
* if (Clazz.array) return Clazz.array(-1, array, i0, n);
268+
* return Clazz.array(-1, array, i0, n);
269269
*
270270
*/
271271
{
@@ -282,7 +282,7 @@ public static int[] arrayCopyRangeRevI(int[] array, int i0, int n) {
282282
/**
283283
* @j2sNative
284284
*
285-
* if (Clazz.array) return Clazz.array(-1, array, i0, n).reverse();
285+
* return Clazz.array(-1, array, i0, n).reverse();
286286
*/
287287
{
288288
}
@@ -300,7 +300,7 @@ public static short[] arrayCopyShort(short[] array, int newLength) {
300300
/**
301301
* @j2sNative
302302
*
303-
* if (Clazz.array && newLength < oldLength) return Clazz.array(-1, array, 0, newLength);
303+
* if (newLength < oldLength) return Clazz.array(-1, array, 0, newLength);
304304
*/
305305
{}
306306
short[] t = new short[newLength];
@@ -317,7 +317,7 @@ public static byte[] arrayCopyByte(byte[] array, int newLength) {
317317
/**
318318
* @j2sNative
319319
*
320-
* if (Clazz.array && newLength < oldLength) return Clazz.array(-1, array, 0, newLength);
320+
* if (newLength < oldLength) return Clazz.array(-1, array, 0, newLength);
321321
*/
322322
{}
323323
byte[] t = new byte[newLength];
@@ -334,7 +334,7 @@ public static boolean[] arrayCopyBool(boolean[] array, int newLength) {
334334
/**
335335
* @j2sNative
336336
*
337-
* if (Clazz.array && newLength < oldLength) return Clazz.array(-1, array, 0, newLength);
337+
* if (newLength < oldLength) return Clazz.array(-1, array, 0, newLength);
338338
*/
339339
{}
340340
boolean[] t = new boolean[newLength];

sources/net.sf.j2s.java.core/src/javajs/util/AjaxURLConnection.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,16 +42,16 @@ protected AjaxURLConnection(URL url) {
4242
*/
4343
@SuppressWarnings("null")
4444
private Object doAjax(boolean isBinary) {
45-
J2SObjectInterface jmol = null;
45+
J2SObjectInterface j2s = null;
4646
/**
4747
* @j2sNative
4848
*
49-
* jmol = J2S || Jmol;
49+
* j2s = J2S;
5050
*
5151
*/
5252
{
5353
}
54-
return jmol._doAjax(url, postOut, bytesOut, isBinary);
54+
return j2s._doAjax(url, postOut, bytesOut, isBinary);
5555
}
5656

5757
@Override

sources/net.sf.j2s.java.core/src/javajs/util/BS.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -818,7 +818,7 @@ public static BS copy(BS bitsetToCopy) {
818818
*
819819
* @j2sNative
820820
*
821-
* bs.words = Clazz.newArray(-1, bitsetToCopy.words, 0, bs.wordsInUse = wordCount);
821+
* bs.words = Clazz.array(-1, bitsetToCopy.words, 0, bs.wordsInUse = wordCount);
822822
*
823823
*/
824824
{

sources/net.sf.j2s.java.core/src/javajs/util/BinaryDocument.java

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -270,14 +270,17 @@ public double readDouble() throws IOException {
270270
*
271271
* @j2sNative
272272
*
273-
* this.readByteArray(this.t8, 0, 8);
274-
* return this.bytesToDoubleToFloat(this.t8, 0, this.isBigEndian);
275-
*
273+
*
276274
*/
277275
{
278276
nBytes += 8;
279-
return (isBigEndian ? ioReadDouble() : Double.longBitsToDouble(readLELong()));
277+
if (true)
278+
return (isBigEndian ? ioReadDouble()
279+
: Double.longBitsToDouble(readLELong()));
280280
}
281+
// this is the JavaScript-only part
282+
this.readByteArray(this.t8, 0, 8);
283+
return bytesToDoubleToFloat(this.t8, 0, this.isBigEndian);
281284
}
282285

283286
private double ioReadDouble() throws IOException {

sources/net.sf.j2s.java.core/srcjs/js/core/corebottom.js

Lines changed: 0 additions & 7 deletions
This file was deleted.

sources/net.sf.j2s.java.core/srcjs/js/core/coretop.js

Lines changed: 0 additions & 4 deletions
This file was deleted.

0 commit comments

Comments
 (0)