Skip to content

Commit 2d339d7

Browse files
committed
remove native calls
1 parent 6805c2e commit 2d339d7

File tree

2 files changed

+24
-16
lines changed

2 files changed

+24
-16
lines changed

sources/net.sf.j2s.java.core/src/java/io/ObjectInputStream.java

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@
4040
import java.util.concurrent.ConcurrentHashMap;
4141
import java.util.concurrent.ConcurrentMap;
4242
import java.util.concurrent.atomic.AtomicBoolean;
43+
44+
import javajs.util.BC;
45+
4346
import static java.io.ObjectStreamClass.processQueue;
4447
import sun.reflect.misc.ReflectUtil;
4548

@@ -2031,17 +2034,21 @@ private void handleReset() throws StreamCorruptedException {
20312034
* Converts specified span of bytes into float values.
20322035
*/
20332036
// REMIND: remove once hotspot inlines Float.intBitsToFloat
2034-
private static native void bytesToFloats(byte[] src, int srcpos,
2037+
private static void bytesToFloats(byte[] src, int srcpos,
20352038
float[] dst, int dstpos,
2036-
int nfloats);
2039+
int nfloats) {
2040+
BC.bytesToFloats(src, srcpos, dst, dstpos, nfloats);
2041+
}
20372042

20382043
/**
20392044
* Converts specified span of bytes into double values.
20402045
*/
20412046
// REMIND: remove once hotspot inlines Double.longBitsToDouble
2042-
private static native void bytesToDoubles(byte[] src, int srcpos,
2047+
private static void bytesToDoubles(byte[] src, int srcpos,
20432048
double[] dst, int dstpos,
2044-
int ndoubles);
2049+
int ndoubles) {
2050+
BC.bytesToDouble(src, srcpos, dst, dstpos, ndoubles);
2051+
}
20452052

20462053
/**
20472054
* Returns the first non-null class loader (not counting class loaders of

sources/net.sf.j2s.java.core/src/java/io/ObjectStreamClass.java

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -189,13 +189,13 @@ InvalidClassException newInvalidClassException() {
189189
/** superclass descriptor appearing in stream */
190190
private ObjectStreamClass superDesc;
191191

192-
/**
193-
* Initializes native code.
194-
*/
195-
private static native void initNative();
196-
static {
197-
initNative();
198-
}
192+
// /**
193+
// * Initializes native code.
194+
// */
195+
// private static native void initNative();
196+
// static {
197+
// initNative();
198+
// }
199199

200200
/**
201201
* Find the descriptor for a class that can be serialized. Creates an
@@ -1815,11 +1815,12 @@ private static long computeDefaultSUID(Class<?> cl) {
18151815
// }
18161816
}
18171817

1818-
/**
1819-
* Returns true if the given class defines a static initializer method,
1820-
* false otherwise.
1821-
*/
1822-
private native static boolean hasStaticInitializer(Class<?> cl);
1818+
// /**
1819+
// * Ha! We can do this in java2script 3.2.4.10! C$.$static$ === 0
1820+
// * Returns true if the given class defines a static initializer method,
1821+
// * false otherwise.
1822+
// */
1823+
// private native static boolean hasStaticInitializer(Class<?> cl);
18231824

18241825
/**
18251826
* Class for computing and caching field/constructor/method signatures

0 commit comments

Comments
 (0)