Originally posted by: manly
Originally posted by: glugglug
Number 3 is wrong. As specific examples, device drivers and virtual memory management code would be impossible to write in java.
Another thing to consider is that most of your standard java packages, including even java.lang, are NOT written in java, they are JNI calls to C++ DLLs. If they were in java the language would be many times slower than it is.
An OS written in Delphi wouldn't be such a bad idea.... dynamic sized strings in that can be like 2GB, so it would be hard to overflow them and manipulating them is in many cases faster than C/C++. If you look at it almost all buffer overflows are from user-input strings being read into static character arrays.
I believe your second assertion is
completely false. Most of the Java platform libraries, and even the massive J2EE stack are "Pure Java" code. Certain things are implemented in JNI for obvious reasons, but as time goes by, the JVM obviates that. As one example,
java.math used to be natively implemented, but was rewritten in Java in Java2 1.3.
Sun and IBM wrote
JavaOS a while back, and decided there pretty much wasn't a market for it.
Out of curiosity I went and downloaded the latest java2 source & parsed it, and came up with the following counts of JNI methods from each java file. Its a lot less than I expected, not sure if this is from java technology improving, or from faster computers making it practical to do more in the JVM:
27 java/util/prefs/WindowsPreferences.java
24 com/sun/corba/se/internal/io/IIOPInputStream.java
23 java/lang/Class.java
21 java/security/cert/X509CertSelector.java
21 java/lang/reflect/Array.java
18 java/net/PlainDatagramSocketImpl.java
17 com/sun/corba/se/internal/corba/TypeCodeImpl.java
16 java/io/Win32FileSystem.java
15 java/lang/StrictMath.java
15 java/io/WinNTFileSystem.java
15 com/sun/corba/se/internal/core/CodeSetComponentInfo.java
14 java/lang/Thread.java
12 java/util/zip/ZipFile.java
12 java/net/PlainSocketImpl.java
12 java/lang/ClassLoader.java
12 com/sun/corba/se/internal/io/IIOPOutputStream.java
11 java/io/RandomAccessFile.java
11 com/sun/imageio/plugins/jpeg/JPEGImageReader.java
10 com/sun/imageio/plugins/jpeg/JPEGImageWriter.java
10 com/sun/corba/se/internal/core/CodeSetConversion.java
9 java/util/zip/Inflater.java
9 java/util/zip/Deflater.java
9 java/lang/System.java
9 java/lang/Runtime.java
8 java/nio/Bits.java
7 java/lang/Object.java
7 java/lang/Compiler.java
7 java/io/FileInputStream.java
7 java/awt/datatransfer/SystemFlavorMap.java
6 java/security/AccessController.java
6 java/io/FileOutputStream.java
6 java/awt/Component.java
5 javax/swing/RepaintManager.java
5 java/net/NetworkInterface.java
5 java/lang/Win32Process.java
5 java/lang/SecurityManager.java
5 java/awt/KeyboardFocusManager.java
4 javax/print/PrintServiceLookup.java
4 javax/imageio/spi/ImageReaderWriterSpi.java
4 java/awt/Font.java
4 java/awt/Container.java
4 com/sun/imageio/plugins/jpeg/JPEG.java
4 com/sun/corba/se/internal/io/ObjectStreamClass.java
3 org/omg/CORBA/TypeCode.java
3 org/omg/CORBA/TCKind.java
3 java/text/Bidi.java
3 java/nio/MappedByteBuffer.java
3 java/net/Inet6AddressImpl.java
3 java/net/Inet4AddressImpl.java
3 java/lang/Throwable.java
3 java/lang/Float.java
3 java/lang/Double.java
3 java/io/ObjectInputStream.java
3 java/awt/print/PrinterJob.java
3 java/awt/JobAttributes.java
3 java/awt/Cursor.java
3 com/sun/java/swing/plaf/windows/XPStyle.java
3 com/sun/corba/se/internal/io/LibraryManager.java
3 com/sun/corba/se/internal/corba/ORB.java
2 javax/imageio/metadata/IIOMetadata.java
2 java/util/zip/ZipEntry.java
2 java/util/zip/CRC32.java
2 java/util/zip/Adler32.java
2 java/util/TimeZone.java
2 java/security/cert/X509Certificate.java
2 java/net/SocketOutputStream.java
2 java/net/SocketInputStream.java
2 java/net/InetAddress.java
2 java/lang/Shutdown.java
2 java/lang/Package.java
2 java/io/ObjectStreamClass.java
2 java/io/ObjectOutputStream.java
2 java/io/FileDescriptor.java
2 java/awt/image/ColorModel.java
2 java/awt/AWTEvent.java
2 com/sun/corba/se/internal/orbutil/ObjectStreamClass_1_3_1.java
2 com/sun/corba/se/internal/DynamicAny/DynAnyUtil.java
2 com/sun/corba/se/internal/corba/TCUtility.java
2 com/sun/corba/se/internal/corba/ORBSingleton.java
2 com/sun/corba/se/internal/corba/AnyImpl.java
1 org/omg/DynamicAny/DynAnyFactoryOperations.java
1 org/omg/DynamicAny/_DynAnyFactoryStub.java
1 org/omg/CORBA/portable/ValueFactory.java
1 org/omg/CORBA/ORB.java
1 org/omg/CORBA/DATA_CONVERSION.java
1 org/apache/xpath/res/XPATHErrorResources_sv.java
1 org/apache/xml/utils/synthetic/Class.java
1 org/apache/xml/utils/FastStringBuffer.java
1 org/apache/xalan/res/XSLTErrorResources_sv.java
1 javax/swing/text/View.java
1 javax/swing/text/DefaultCaret.java
1 javax/print/PrintService.java
1 javax/print/DocPrintJob.java
1 javax/print/Doc.java
1 javax/naming/CompositeName.java
1 java/util/ResourceBundle.java
1 java/util/logging/FileHandler.java
1 java/util/jar/JarFile.java
1 java/sql/DriverManager.java
1 java/sql/Connection.java
1 java/nio/DirectByteBuffer.java
1 java/nio/channels/FileLock.java
1 java/nio/ByteOrder.java
1 java/nio/ByteBuffer.java
1 java/net/Inet6Address.java
1 java/net/Inet4Address.java
1 java/net/DatagramPacket.java
1 java/lang/String.java
1 java/lang/StackTraceElement.java
1 java/lang/reflect/Proxy.java
1 java/lang/reflect/Modifier.java
1 java/lang/ref/Finalizer.java
1 java/io/FileSystem.java
1 java/io/FileNotFoundException.java
1 java/awt/Window.java
1 java/awt/Toolkit.java
1 java/awt/TextField.java
1 java/awt/TextArea.java
1 java/awt/ScrollPaneAdjustable.java
1 java/awt/ScrollPane.java
1 java/awt/Scrollbar.java
1 java/awt/Rectangle.java
1 java/awt/Paint.java
1 java/awt/MenuItem.java
1 java/awt/MenuComponent.java
1 java/awt/MenuBar.java
1 java/awt/Menu.java
1 java/awt/Label.java
1 java/awt/Insets.java
1 java/awt/image/SinglePixelPackedSampleModel.java
1 java/awt/image/SampleModel.java
1 java/awt/image/Raster.java
1 java/awt/image/Kernel.java
1 java/awt/image/IndexColorModel.java
1 java/awt/image/ComponentSampleModel.java
1 java/awt/image/BufferedImage.java
1 java/awt/GradientPaint.java
1 java/awt/Frame.java
1 java/awt/FontMetrics.java
1 java/awt/FileDialog.java
1 java/awt/event/MouseEvent.java
1 java/awt/event/KeyEvent.java
1 java/awt/event/InputEvent.java
1 java/awt/Event.java
1 java/awt/dnd/DropTarget.java
1 java/awt/Dimension.java
1 java/awt/Dialog.java
1 java/awt/Color.java
1 java/awt/CheckboxMenuItem.java
1 java/awt/Checkbox.java
1 java/awt/Button.java
1 java/awt/AWTKeyStroke.java
1 com/sun/security/auth/module/UnixSystem.java
1 com/sun/security/auth/module/SolarisSystem.java
1 com/sun/security/auth/module/NTSystem.java
1 com/sun/naming/internal/FactoryEnumeration.java
1 com/sun/java/swing/plaf/windows/WindowsLookAndFeel.java
1 com/sun/imageio/plugins/png/PNGMetadata.java
1 com/sun/corba/se/internal/util/JDKClassLoader.java
1 com/sun/corba/se/internal/util/JDKBridge.java
1 com/sun/corba/se/internal/orbutil/resources/sunorb_de.java
1 com/sun/corba/se/internal/orbutil/ORBConstants.java
1 com/sun/corba/se/internal/orbutil/ObjectStreamField.java
1 com/sun/corba/se/internal/orbutil/ObjectStreamClassUtil_1_3.java
1 com/sun/corba/se/internal/io/ValueUtility.java
1 com/sun/corba/se/internal/io/ObjectStreamField.java
1 com/sun/corba/se/internal/DynamicAny/DynAnyBasicImpl.java
1 com/sun/corba/se/internal/corba/ServerDelegate.java
1 com/sun/corba/se/internal/corba/ClientDelegate.java